1. What is encapsulation in object-oriented programming (OOP)? A. Binding data and methods together B. Inheriting from multiple classes C. Exposing internal implementation details D. Restricting access to public methods 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
2. What does inheritance allow in OOP? A. A class to override instance methods B. A class to access private methods C. A class to be instantiated D. A class to inherit properties and behaviors from another 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
3. What is polymorphism in OOP? A. The ability to hide implementation details B. The ability to restrict access to certain methods C. The ability for objects of different classes to be treated as objects of a common superclass D. The ability to create multiple instances 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
4. What is the purpose of the super keyword in Ruby OOP? A. Returns the superclass B. Calls the same method in the superclass C. Initializes a superclass object D. Returns the superclass 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
5. What is the main principle behind object-oriented programming? A. Polymorphism B. Encapsulation C. Objects D. Inheritance 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
6. Which concept in OOP promotes reusability and reduces redundancy in code? A. Encapsulation B. Polymorphism C. Abstraction D. Inheritance 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
7. What is the purpose of abstraction in OOP? A. To hide the complex implementation details and only show the necessary features B. To expose all the implementation details C. To restrict access to public methods D. To define class methods 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
8. What does the term "class" refer to in OOP? A. A variable in an object B. A method in an object C. An instance of an object D. A blueprint for creating objects 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
9. What is the significance of the initialize method in Ruby classes? A. It defines class variables B. It defines class methods C. It is automatically called when a new object is created and allows initialization of instance variables D. It defines instance methods 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
10. What does polymorphism allow in OOP? A. Objects of the same class to have different methods B. Objects of different classes to be treated as objects of a common superclass C. Objects of the same class to be treated as objects of different classes D. Objects of the same class to have different methods 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