1. What is the keyword used to define a class in Ruby? A. class B. def class C. class def D. define_class 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 create a new instance of a class in Ruby? A. new B. create C. instantiate D. instance 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. How do you define a constructor in Ruby? A. def initialize B. def constructor C. def init D. def 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
4. Which of the following is used to access instance variables in Ruby? A. @variable B. $variable C. @@variable D. variable 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 does the attr_accessor method do in Ruby? A. Creates getter and setter methods for an instance variable B. Creates only getter methods for an instance variable C. Creates only setter methods for an instance variable D. Creates private methods for an instance variable 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 initialize method in Ruby? A. To initialize class variables B. To define instance methods C. To create object instances D. To initialize object properties 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 method used to inherit from a superclass in Ruby? A. < B. -< C. extends D. inherit 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 super keyword do in Ruby? A. Calls the method of the superclass with the same name B. Calls the method of the subclass with the same name C. Exits the method D. Returns a value 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 the method used to check if an object is an instance of a particular class in Ruby? A. instance_of? B. is_instance? C. is_a? D. object_of? 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 is the method used to define class methods in Ruby? A. def self.method_name B. def class.method_name C. def method_name.self D. def method_name.static 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