In Ruby, which method is used to check if an object responds to a certain method?
A. method_defined?
B. respond_to?
C. has_method?
D. check_method
Answer: Option B
A. method_defined?
B. respond_to?
C. has_method?
D. check_method
Answer: Option B
What is the syntax for defining a method in Ruby?
A. def method_name
B. method method_name
C. function method_name
D. define method_name
What does the return keyword do in Ruby methods?
A. Exits the method
B. Continues the method
C. Restarts the method
D. None of the above
In Ruby, how do you define default parameter values for a method?
A. def method(param = value)
B. def method(param: value)
C. def method(param = default)
D. def method(param => value)
Join The Discussion