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 6. What is a class?

Ans. You should easily be able to explain not only what a class is, but how and when you would create a new one as well as what functionality it would provide in the larger context of your program.

Is it helpful? Add Comment View Comments
Ques 7. What is the difference between a class and a module?
Ans. The straightforward answer: A module cannot be subclassed or instantiated, and modules can implement mixins.
Is it helpful? Add Comment View Comments
Ques 8. What is an object?
Ans. Textbook answer here is that an object is an instance of a class and has state, behavior, and identity. In a plain text example, you can say that a truck and a car are both objects of the class Vehicle, or that apple and pear are both objects of the class Fruit.
Is it helpful? Add Comment View Comments
Ques 9. How would you declare and use a constructor in Ruby?
Ans. Constructors are declared via the initialize method and get called when you call on a new object to be created.
Using the code snippet below, calling Order.new acts as a constructor for an object of the class Order.

class Order
  def initialize(customer, meal, beverage)
    @customer = customer
    @meal = meal
    @beverage = beverage
  end
end
Is it helpful? Add Comment View Comments
Ques 10. How does a symbol differ from a string?
Ans. Symbols are immutable and reusable, retaining the same object_id.
Is it helpful? Add Comment View Comments

Most helpful rated by users:

©2016 WithoutBook