Classes And Objects In Ruby - Study Mode
[#1] Which keyword is used to refer to the current instance of a class in Ruby?
Correct Answer
(A) self
[#2] What is the method used to define a class variable in Ruby?
Correct Answer
(A) @@variable_name
[#3] What is the method used to access class variables in Ruby?
Correct Answer
(C) Using class methods
[#4] What is the purpose of the attr_accessor method in Ruby classes?
Correct Answer
(A) To create getter and setter methods for instance variables
[#5] What is the syntax for defining an instance method in Ruby?
Correct Answer
(A) def method_name