11. What is the significance of the initialize method in Ruby classes? A. It defines instance methods B. It defines class methods C. It defines class variables D. It is automatically called when a new object is created and allows initialization of 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
12. What is the main advantage of using polymorphism in Ruby? A. It allows for faster code execution B. It allows for easier code debugging C. It allows for more flexible and reusable code D. It allows for better code organization 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
13. What is the purpose of the extend keyword in Ruby? A. Initializes a new instance B. Adds methods from a module as class methods C. Calls a superclass method D. Initializes a new instance 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
14. What does the term "inheritance" refer to in Ruby? A. A mechanism by which a class can create multiple instances of another class B. A mechanism by which a class can hide implementation details from another class C. A mechanism by which a class can inherit properties and behaviors from another class D. A mechanism by which a class can override methods from another 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
15. What is the purpose of the include keyword in Ruby classes? A. To inherit from another class B. To define a new method C. To create a new instance D. To mix in methods from a module into a class 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
16. In Ruby, what is the purpose of the super keyword? A. Calls the same method in the superclass B. Calls the same method in the subclass C. Returns the superclass D. Initializes a superclass object 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
17. What is the main 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
18. In Ruby, what is encapsulation? A. Hiding data within a class B. Inheriting properties and behaviors C. Binding data with methods that operate on that data D. Converting data types 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
19. What is the primary goal of using polymorphism in Ruby? A. To simplify the syntax of a program B. To allow for more flexible and reusable code C. To enhance code modularity D. To simplify the syntax of a program 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
20. Which keyword is used to refer to the current instance of a class in Ruby? A. object B. instance C. self D. this 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