Classes And Objects In Ruby - Study Mode
[#6] Which method is used to define getter and setter methods for instance variables in Ruby?
Correct Answer
(A) attr_accessor
[#7] What is the purpose of the attr_reader method in Ruby classes?
Correct Answer
(A) To create only getter methods for instance variables
[#8] Which keyword is used to call a method on an object in Ruby?
Correct Answer
(D) none of the above
[#9] What is the syntax for defining a class in Ruby?
Correct Answer
(B) class
[#10] How do you access class variables in Ruby?
Correct Answer
(C) Using class methods