11. What is the method used to define instance methods in Ruby? A. def method_name B. def self.method_name C. def class.method_name D. def method_name.self 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
12. What is the keyword used to refer to the current instance of a class in Ruby? A. self B. this C. current 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
13. Which method is used to define class 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
14. What does the private keyword do in a Ruby class? A. It makes methods private, accessible only within the class B. It makes methods public, accessible from outside the class C. It makes methods protected, accessible only within the class and its subclasses D. It defines class variables 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
15. What does the protected keyword do in a Ruby class? A. It makes methods protected, accessible only within the class and its subclasses B. It makes methods private, accessible only within the class C. It makes methods public, accessible from outside the class D. It defines class variables 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
16. How do you access instance variables in Ruby? A. Using accessor methods B. Using instance methods C. Using class methods D. Using global variables 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
17. What is the method used to define instance variables in Ruby? A. @variable_name B. def variable_name C. self.variable_name D. instance.variable_name 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
18. Which keyword is used to inherit a class in Ruby? A. inherit B. superclass C. extends D. < 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
19. What does the super keyword do in Ruby classes? 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
20. What is the syntax for defining a class method 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