Vidyalelo
Ruby Programming · Q12

Methods in Ruby

Programming · Ruby Programming · question 12

Q12

What is the purpose of the `attr_accessor` method in Ruby?

A.
Defines both reader and writer methods for instance variables
Answer
B.
Defines a reader method for instance variables
C.
Defines a writer method for instance variables
D.
None of the above

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board