Interviewer And Interviewee Guide

Fresh Ruby Developer Interview Questions & Answers:

1. Tell me how can you declare a block in Ruby?

In Ruby, the code in the block is always enclosed within braces ({}). You can invoke a block by using “yield statement”.

2. Do you know about Dig, Float and Max?

☛ Float class is used whenever the function changes constantly.
☛ Dig is used whenever you want to represent a float in decimal digits.
☛ Max is used whenever there is a huge need of Float.

3. Explain me what is the purpose of RJs in Rails?

RJs is a template that produces JavaScript which is run in an eval block by the browser in response to an AJAX request. It is sometimes used to define the JavaScript, Prototype and helpers provided by Rails.

4. Tell me what is Mixin in Rails?

Mixin in Ruby offers an alternative to multiple inheritances, using mixin modules can be imported inside other class.

5. What is interpolation in Ruby?

Ruby Interpolation is the process of inserting a string into a literal. By placing a Hash (#) within {} open and close brackets, one can interpolate a string into the literal.

6. Tell us the types of variables available in Ruby Class?

Types of variables available in Ruby Class are,

☛ Local Variables
☛ Global Variables
☛ Class Variables
☛ Instance Variables

7. Tell me what is Rails Migration?

Rails Migration enables Ruby to make changes to the database schema, making it possible to use a version control system to leave things synchronized with the actual code.

8. Do you know when self.up and self.down method is used?

When migrating to a new version, self.up method is used while self.down method is used to roll back my changes if needed.

9. Tell me what is Rails Active Record in Ruby on Rails?

Rails active record is the Object/Relational Mapping (ORM) layer supplied with Rails. It follows the standard ORM model as

☛ Table map to classes
☛ Rows map to objects
☛ Columns map to object attributes

10. Explain me the log that has to be seen to report errors in Ruby Rails?

Rails will report errors from Apache in the log/Apache.log and errors from the Ruby code in log/development.log.

Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.