πŸ“Š Ruby
Q. What does the 'attr_accessor' method do in Ruby?
  • (A) Defines getter methods only
  • (B) Defines setter methods only
  • (C) Defines both getter and setter methods
  • (D) Defines class methods
πŸ’¬ Discuss
βœ… Correct Answer: (C) Defines both getter and setter methods

Explanation: 'attr_accessor' creates both getter and setter methods for instance variables.

Explanation by: Rati Dubey
'attr_accessor' creates both getter and setter methods for instance variables.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
76
Total Visits
πŸ“½οΈ
11 mo ago
Published
πŸŽ–οΈ
Rati Dubey
Publisher
πŸ“ˆ
89%
Success Rate