If you’re interviewing for a position in which you’ll use the web-application framework Ruby on Rails, you should prepare by considering the types of questions they might ask you. Here are 10 common questions as well as their sample answers below:
1. What is Ruby on Rails?
The hiring manager might ask you what Ruby on Rails is to ensure you know what the framework is that you’ll be working with on a daily basis. When you answer, it’s important to go beyond a generic definition in order for them to know you understand the extension inside and out.
Example: “Ruby on Rails is an open-source, web-application framework. Built within the Ruby programming language, it helps people create various applications.”
2. What do subdirectory app/controllers and app/helpers do?
If the hiring manager asks you this, they’re wanting to know whether or not you understand the Rails directory structure. When you answer, make sure to not confuse app/controllers from app/helpers.
Example: “Whereas the app/controllers help Rails find controller classes and essentially handles a web request from the user, the helper holds any helper classes that assist the controller, model and view classes.”
3. What command can you use to create a controller for the subject?
When the interviewer asks you this, they’re testing your knowledge of the controller and your ability to understand what command is used for what purpose. Make sure that the command you answer with is clear and concise.
Example: “In order to create a controller for subject, use the following command: C:\ruby\library> ruby script/generate controller subject.”
4. Name five things Rails Migration can do.
Hiring managers want to know that you’re aware of the various Rails Migration functions. It could be beneficial for you to acknowledge that there are more than just five functions in order to show your in-depth knowledge of Rails Migration. If prompted, continue listing more of its functions.
Example: “Rails Migration can do numerous things including renaming a table, adding a column, changing column, dropping a table, removing column and more.”
5. What is the Rails Controller?
When interviewers ask you this, they’re wanting to know whether or not you know some basic features of Ruby on Rails. The more descriptive you are in your Rails Controller definition, the better.
Example: “Rails Controller is the center of your application as it helps the overall user, views and model interaction. It’s also known for handling URL well, regulating helper modules and regulating sessions.”
6. How can you protect Rails against Cross-Site Request Forgery?
This question is asked to ensure that you’re capable of keeping hackers at bay. When you answer this, make sure you provide them with the accurate steps to do so.
Example: “To protect from any Cross-Site Request Forgery hacker attacks, you need to add ‘protect_from_forgery’ to your ApplicationController.'”
7. What does garbage collection do in Ruby on Rails?
As a programmer, it’s important to know how to use garbage collection in Ruby on Rails. An interviewer might ask you this to ensure you’re aware of how to free up memory. Make sure you display your in-depth knowledge of garbage collection by listing more than one of its functions in Ruby on Rails.
Example: “Garbage collection performs a variety of functions including allowing for pointer values removal and removing the inaccessible objects from the memory, among other things. In essence, garbage collection helps free up memory for other processes.”
8. Name three of the limits of Ruby on Rails?
An interviewer might ask you this to test your knowledge of Ruby on Rails limitations. Though Ruby on Rails has various advantages, provide them with a decent number of its setbacks when you answer this question.
Example: “Ruby on Rails has various features that it doesn’t support which makes it unusable for some programmers. This includes linking to more than one database at a time, connecting to more than one database server at a time and foreign key in databases.”
9. What are some advantages of using Ruby on Rails?
In contrast to the question above, hiring managers are wanting to know that you’re able to recognize Ruby on Rails’ advantages despite some of its drawbacks. Provide them with a few different advantages when you answer.
Example: “Ruby on Rails has various advantages. For one, it makes a programmer’s work more productive. It’s also open-source and completely free. In addition, it provides programmers with the opportunity to write code that acts on actual code rather than data.”
10. Name the four types of variables available in Ruby Class
Interviewers might ask you this when trying to gauge how well you know the features of Ruby on Rails. Though this question is pretty straightforward, be sure you don’t forget the particular names of these variable types.
Example: “The four types of variables available in Ruby Class include local variables, global variables, class variables and instance variables.”
SOURCE : https://www.indeed.com/career-advice/interviewing/ruby-on-rails-interview-questions