What is inheritance in Ruby?
A. A mechanism by which a class can hide implementation details from another class
B. A mechanism by which a class can inherit properties and behaviors from another class
C. A mechanism by which a class can create multiple instances of another class
D. A mechanism by which a class can hide implementation details from another class
Answer: Option B
A. A mechanism by which a class can hide implementation details from another class
B. A mechanism by which a class can inherit properties and behaviors from another class
C. A mechanism by which a class can create multiple instances of another class
D. A mechanism by which a class can hide implementation details from another class
What does the super keyword do in Ruby?
A. Initializes a superclass object
B. Returns the superclass
C. Calls the same method in the superclass
D. Calls the same method in the subclass
Which keyword is used to define a private method in Ruby?
A. def private
B. def method.private
C. private def
D. private
What does polymorphism allow in Ruby?
A. Objects of different classes to be treated as objects of a common superclass
B. Objects of different classes to have the same methods
C. Objects of the same class to have different methods
D. Objects of the same class to be treated as objects of different classes
Join The Discussion