Inheritance And Polymorphism In Ruby - Study Mode
[#1] What is the purpose of the attr_accessor method in Ruby classes?
Correct Answer
(C) To define both reader and writer methods for class attributes
[#2] What is the difference between attr_reader, attr_writer, and attr_accessor in Ruby?
Correct Answer
(D) attr_reader defines only reader methods, attr_writer defines only writer methods, and attr_accessor defines both
[#3] What is the main advantage of using OOP principles in programming?
Correct Answer
(A) Modularity and reusability
[#4] What is the purpose of the include keyword in Ruby classes?
Correct Answer
(D) To mix in methods from a module into a class
[#5] What does the term "object" refer to in OOP?
Correct Answer
(C) An instance of a class