1. 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 & Solution Discuss in Board Save for Later Answer & Solution Answer: Option B No explanation is given for this question Let's Discuss on Board
2. 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 Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board
3. Which keyword is used to define a private method in Ruby? A. def private B. def method.private C. private def D. private Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board
4. 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 Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A No explanation is given for this question Let's Discuss on Board
5. What is the primary purpose of a constructor in a Ruby class? A. To define getter and setter methods B. To create new instances of the class C. To define class methods D. To initialize instance variables Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board
6. In Ruby, which keyword is used to refer to the current instance of a class? A. this B. instance C. self D. object Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board
7. What is encapsulation in Ruby? A. The inheritance of properties and behaviors B. The bundling of data with the methods that operate on that data C. The conversion of data types D. The inheritance of properties and behaviors Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option B No explanation is given for this question Let's Discuss on Board
8. What is the purpose of polymorphism in Ruby? A. It allows creating multiple instances of a class B. It allows restricting access to certain methods C. It allows objects of different classes to be treated as objects of a common superclass D. It allows hiding the implementation details of a class Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board
9. What does the attr_accessor method do in Ruby classes? A. Defines only a reader method for class attributes B. Defines only a writer method for class attributes C. Defines constructor methods for class attributes D. Defines both reader and writer methods for class attributes Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board
10. What is the main purpose of using inheritance in Ruby? A. To promote code reusability and reduce redundancy B. To improve code performance C. To simplify the syntax of a program D. To enhance code modularity Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A No explanation is given for this question Let's Discuss on Board