Classes And Objects In Ruby - Study Mode

[#11] What is the method used to define instance methods in Ruby?
Correct Answer

(A) def method_name

[#12] What is the keyword used to refer to the current instance of a class in Ruby?
Correct Answer

(A) self

[#13] Which method is used to define class variables in Ruby?
Correct Answer

(A) @@variable

[#14] What does the private keyword do in a Ruby class?
Correct Answer

(A) It makes methods private, accessible only within the class

[#15] What does the protected keyword do in a Ruby class?
Correct Answer

(A) It makes methods protected, accessible only within the class and its subclasses