1. What is a class in Ruby? A. A blueprint for objects B. A variable holding multiple values C. A single data structure D. A method to define behavior 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. Which keyword is used to define a class in Ruby? A. class B. def C. new D. 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
3. What does the initialize method do in a Ruby class? A. Initializes class variables B. Defines instance methods C. Defines class methods D. Initializes new 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
4. In Ruby, what is an object? A. An instance of a class B. A variable C. A method D. A module 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. Which method is used to create a new instance of a class in Ruby? A. new B. create C. instance D. initialize 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
6. What is the purpose of the attr_accessor method in Ruby classes? A. To define both reader and writer methods for class attributes B. To define only a reader method for class attributes C. To define only a writer method for class attributes D. To define a constructor method 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
7. Which keyword is used to refer to the current instance of a class in Ruby? A. self B. this C. instance D. 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
8. What is the purpose of inheritance in Ruby classes? A. To allow a class to inherit properties and behaviors from another class B. To allow multiple classes to inherit from each other C. To restrict access to certain methods D. To define private 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
9. What is encapsulation in Ruby classes? A. The bundling of data with the methods that operate on that data B. The hiding of data within a class C. The inheritance of properties and behaviors D. The conversion of data types 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
10. Which method is called automatically when an object is created in Ruby? A. initialize B. new C. create D. constructor 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