Classes And Objects In Ruby - Study Mode
[#21] What is the method used to define a class method in Ruby?
Correct Answer
(A) def self.method_name
[#22] What is the method used to create a new instance of a class in Ruby?
Correct Answer
(A) new
[#23] What is the purpose of the initialize method in Ruby classes?
Correct Answer
(A) To initialize instance variables with default values
[#24] What is the method used to access instance variables in Ruby?
Correct Answer
(B) Using instance methods
[#25] Which keyword is used to define a class in Ruby?
Correct Answer
(B) class