Methods In Ruby - Study Mode

[#21] What is the purpose of the yield keyword in Ruby?
Correct Answer

(D) To pass control and arguments to a block

[#22] In Ruby, what does the attr_reader method do?
Correct Answer

(B) Defines a getter method

[#23] What is the purpose of the alias_method keyword in Ruby?
Correct Answer

(A) To create an alias for a method

[#24] In Ruby, which keyword is used to define a class method?
Correct Answer

(A) def self.method_name

[#25] Which of the following is used to define a class method in Ruby?
Correct Answer

(A) def self.method_name