Without Book Interview Questions and Answers | Online Test | Moct Test
Download Android App in your Android Device from Google Play Store
- Search for "Withoutbook Practice Exam Test" in Mobile/Tablet Play Store
Institute Training Search by Name or Email

Exams Attended

Make Homepage

Bookmark this page

Subscribe Email Address

Ruby On Rails Interview Questions and Answers

Ques 11. How and when would you declare a Global Variable?

Ans. Global variables are declared with the ‘$’ symbol and can be declared and used anywhere within your program. You should use them sparingly to never.

Is it helpful? Add Comment View Comments
Ques 12. How would you create getter and setter methods in Ruby?
Ans. Setter and getter methods in Ruby are generated with the attr_accessor method. attr_accessor is used to generate instance variables for data that’s not stored in your database column.
Is it helpful? Add Comment View Comments
Ques 13. Describe the difference between class and instance variables?
Ans.
  • Class variables are created with the prefix ‘@@’ and are shared by all objects in a class.

  • Instance variables are created with the prefix ‘@’ and belong to a single object within a class.

Is it helpful? Add Comment View Comments
Ques 14. Example some of the looping structures available in Ruby?
Ans. For loop, While loop, Until Loop.
Is it helpful? Add Comment View Comments
Ques 15. Explain the difference between a has_one and belongs_to association in Ruby on Rails.
Ans.
has_one: Indicates a direct 1:1 relationship between objects where each instance of a model contains one instance of another model.
A product has_one provider, a customer has_one order.


Is it helpful? Add Comment View Comments

Most helpful rated by users:

©2016 WithoutBook