Vidyalelo
Ruby Programming · all questions

Object Oriented Programming (OOP) Concepts in Ruby
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

40

Questions

2/2

Page

Pick an option on a question to see the right answer and solution.

Which method is called when an object is garbage collected in Ruby?

Select an option to see the answer and solution.

What does the protected keyword do in Ruby classes?

Select an option to see the answer and solution.

What is the purpose of method overriding in Ruby?

Select an option to see the answer and solution.

Which keyword is used to define a class method in Ruby?

Select an option to see the answer and solution.

What is the purpose of the extend keyword in Ruby?

Select an option to see the answer and solution.

What does the super keyword do in a Ruby class method?

Select an option to see the answer and solution.

What is the purpose of the private keyword in Ruby classes?

Select an option to see the answer and solution.

In Ruby, what is the purpose of method overloading?

Select an option to see the answer and solution.

In Ruby, what is the purpose of the attr_reader method in a class?

Select an option to see the answer and solution.

What is polymorphism in Ruby?

Select an option to see the answer and solution.

What is the difference between a class method and an instance method in Ruby?

Select an option to see the answer and solution.

Which keyword is used to define a private method in a Ruby class?

Select an option to see the answer and solution.

What is the purpose of the initialize method in Ruby classes?

Select an option to see the answer and solution.

What does the `protected` keyword do in Ruby classes?

Select an option to see the answer and solution.

In Ruby, what is the purpose of the `super` keyword when used in a method?

Select an option to see the answer and solution.

What is the purpose of the `include` keyword in Ruby classes?

Select an option to see the answer and solution.

What is the purpose of the `extend` keyword in Ruby classes?

Select an option to see the answer and solution.

In Ruby, which method is used to define getter and setter methods for class attributes?

Select an option to see the answer and solution.

What is the purpose of encapsulation in Ruby classes?

Select an option to see the answer and solution.

What is the purpose of inheritance in Ruby?

Select an option to see the answer and solution.