Methods In Ruby - Study Mode
[#26] What is the purpose of the `attr_accessor` method in Ruby?
Correct Answer
(A) Defines both reader and writer methods for instance variables
[#27] In Ruby, which method is called automatically when an object is created?
Correct Answer
(A) initialize
[#28] What does the def keyword signify in Ruby?
Correct Answer
(A) Declares a method
[#29] In Ruby, which keyword is used to call a method?
Correct Answer
(D) invoke
[#30] What is the purpose of the initialize method in Ruby classes?
Correct Answer
(A) To initialize class variables