Tuesday, August 01, 2017

Rails Interview Questions

Ruby

1. What is the difference between a lambda, a block and a proc?
2. What are #method_missing and #send? Why are they useful?
3. Getter and setter methods
4. method overloading (Ruby does not have this feature)
5. Include vs Extend
6. Symbol vs String
7. What does yield do?
8. Difference between && and AND operators
9. Multiple inheritance
10. public, private, protected
11. How can you call the base class method from a subclass? (super)



Rails

1. How do you sort an Array of objects by a particular attribute? What is a better way to do sorting with ActiveRecord?
2. Explain CSRF and how Rails combats it.
3. Explain mass-assignment vulnerability.
4. Explain various forms of caching available in Rails.
5. How is something like 30.seconds.ago implemented?
6. HashWithIndifferentAccess
7. N+1 Query problem
8. has_one, belongs_to, has_many, has_many_through, polymorphic
9. database transactions
10. load, auto_load, require_relative
11. load vs require
12. How can you call the base class method from inside of its overridden method?
13. sql injection (sanitize user input)
14. Include vs Prepend
15. How to implement single table inheritance?
16. Eager loading (includes the association)
17. render vs redirect