Guest User

Untitled

a guest
Jan 19th, 2018
343
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.60 KB | None | 0 0
  1. **PLEASE NOTE: Do not post your answers to this gist; email them to workwithus@rrsoft.co instead**
  2.  
  3. ### 1. JavaScript
  4.  
  5. What is the JavaScript build tool of your choice? Explain why.
  6.  
  7. Take a look at the following:
  8.  
  9. ```
  10. function *foo(x) {
  11. while (x < 4) {
  12. x += yield x;
  13. }
  14. return x;
  15. }
  16. var bar = foo(3);
  17. console.log( bar.next(1) );
  18. console.log( bar.next(1) );
  19. console.log( bar.next(1) );
  20. ```
  21. What is the output of this code snippet, and why does it behave in the way it does?
  22.  
  23. ### 2. React
  24.  
  25. Discuss the advantages and disadvantages of using React in your JavaScript application.
  26.  
  27. Developers maintaining an app built with React have discovered performance problems which appear to originate from the following code. How might you adjust this class to improve its performance?
  28.  
  29. ```
  30. class CounterButton extends React.Component {
  31. constructor(props) {
  32. super(props);
  33. this.state = {count: 1};
  34. }
  35.  
  36. render() {
  37. return (
  38. <button
  39. color={this.props.color}
  40. onClick={() => this.setState(state => ({count: state.count + 1}))}>
  41. Count: {this.state.count}
  42. </button>
  43. );
  44. }
  45. }
  46. ```
  47.  
  48. ### 3. CSS
  49.  
  50. Usage of the "!important" CSS declaration is often frowned upon by front-end developers. What does the "!important" CSS declaration do? Why do front-end developers suggest using it with caution? What are some cases in which it makes sense to use it?
  51.  
  52. ### 4. Lies, damn lies, and Git
  53.  
  54. You're working on a cool branch of the foobar project, and your branch contains two commits A and B. The git lineage is:
  55. ```
  56. X -- Y -- Z <-- master
  57. \
  58. A -- B <-- your-cool-branch
  59. ```
  60. You want to contribute the code back to the master foobar repo, but you realize there is a really dumb typo in one of your source code comments in commit A. You'd still like to submit the pull request as two commits A' and B', where A' is the fixed version of A, and B' is the same exact diff as B. How do you rewrite git history to make this happen? Is B' the same hash as B? Why or why not?
  61.  
  62. ### 5. Ruby metaprogramming
  63.  
  64. What's `Module.included`? What is a common (meta-)programming construct in which it is used? Give an example and explain exactly what's going on.
  65.  
  66. ### 6. Rails and Active Record
  67.  
  68. New code was released to multi-tier production environment and now the site is SO slow. But it worked great on the single-server staging environment, which has only half the CPU and half the RAM of the production servers!
  69.  
  70. Here's the code that's behaving poorly:
  71.  
  72. class Post < ActiveRecord::Base
  73. def comments
  74. comment_ids = Comment.where("post_id = ?", self.id).map { |c| c.id }
  75. comment_ids.map { |comment_id| Comment.find_by_id(comment_id) }
  76. end
  77. end
  78.  
  79. What's wrong? And why did it work well (enough) on the staging server?
  80.  
  81. Obviously the person who wrote this isn't a Rails programmer. How would a Rails programmer have written the code?
  82.  
  83. ### 7. Data Modelling
  84.  
  85. Each voter can vote in zero or more referenda. Each referendum has one or more questions, and each question is a yes/no vote. Write the simplest normalized schema to describe this in generic SQL statements or as an entity-relationship diagram. Point out where the indexes would be if you want to quickly know the results of a given referendum question, but you never expect to query a single voter's voting record.
  86.  
  87. ### 8. Availability on AWS
  88.  
  89. Your client plans to host their web application on AWS. When would you advise (a) deployment in a single availability zone, (b) deployment in multiple availability zones in a single region (c) deployment in multiple regions? What operational difficulty or complexity, if any, is added as you go from (a) to (b) to (c)?
Add Comment
Please, Sign In to add comment