# Ruby and Rails Interview Questions ## Ruby * What is a class? * What is an object? * What is a module? Can you tell me the difference between classes and modules? * Can you tell me the three levels of method access control for classes and modules? What do they imply about the method? * There are three ways to invoke a method in ruby. Can you give me at least two? * Explain this ruby idiom: a ||= b * What does self mean? * What is the difference between `lambda`, `block` and `proc`? * How do you sort an Array of objects by a particular attribute? What is a better way to do sorting with `ActiveRecord`? * What are some of your favorite gems? What are their alternatives? * In Ruby, which is generally the better option: a recursive function or an iterative one? * What are `#method_missing` and `#send`? Why are they useful? * What makes Ruby different from other programming languages? * What do you mean by Meta Programming? * Explain how everything is an object in Ruby. * How would you explain the Ruby OOP model? * Define block, proc and lambda and give difference between them. * What is difference between `String` and `Symbol`? * What is difference between `includes` and `extends`? * What is difference between `==`, `===`, `eql?` and `equal?`? ## Rails * What is new in Rails 4? * What are the advantages and disadvantages of using Ruby on Rails in Web Development? * Explain MVC in terms of Rails. * Explain the different pieces of Rails or What are different components of Ruby on Rails?. * Walk through the flow of a request through Rails. * Give list of frameworks which is similar to Rails. * What are the different server options for running a Rails/Rack app? * Explain CSRF and how Rails combats it. * Explain mass-assignment vulnerability. * What is Rack? * What is middleware? How does it compare to controller filters/actions? * Explain various forms of caching available in Rails. * How is something like `30.seconds.ago` implemented? * Give difference between last 3 versions of Rails. * What are the major improvements in Rails 5.0? * What do you mean by ORM? * What is Self-Referential Association aka Self Join? * List down types of associations in Rails. * What is functionality of `Helpers`? * Explain eagerloading. * What is ActiveRecord? * Explain Active Record Callbacks. * Explain Filters. * Define resource, resources, collection and namespace in terms of routes. * What things we can define within `Model`? * What is Asset Pipeline? * How parsing has been done from ERB file to HTML? * What is difference between `Render` and `Redirect`? * What is difference between `Gems` and `Plugins`? * What is difference between `save` and `save!` * What is difference between `find` and `find_by_xxx` method? * What is difference between `form_for` and `form_tag`? * What is difference between `Application Server` and `Web Server`? * List down servers supported by Rails. ## Testing * What is difference between `TDD` and `BDD`? * What are the testing tools available for rails and which one you have used ? ## General/Common * What do you mean by `Agile Development`? * What is difference between `Gemfile` and `Gemfile.lock`? * What are your favourite `Gems`? ------------ ## Contributions are most welcome * Please make sure that questions are unique * You can submit your answer too. * Question must be related with Ruby/Rails (Preparing a diffrent gist for Data Structure and Algorithms) ------------ ## Resources * [@darcyclarke](https://github.com/darcyclarke)'s [Frontend Interview Questions](https://github.com/h5bp/Front-end-Developer-Interview-Questions) (inspiration for this repo) * My [Advanced JavaScript](https://github.com/advanced-js/syllabus) class materials * [Open Letter: Rails Interview Prep](http://afeld.me/nerdery/561078) from my blog * [Video](http://afeld.me/nerdery/522101) of the Junior Developer Panel that I hosted * [Ruby Koans](http://rubykoans.com/) * [Project Euler](https://projecteuler.net/) * [Flatiron School Prework](http://prework.flatironschool.com/) and [background](http://blog.flatironschool.com/flatiron-school-prework/) * [Job Interview](https://github.com/ruby-jokes/job_interview) by @ruby-jokes * [Developer Evangelist Interview Questions](https://github.com/MurtzaM/Developer-Evangelist-Interview-Questions) * [Resources](http://hackerhours.org/resources.html) from Hacker Hours ------------