Q. What does the attr_accessor method do in Ruby?

  • (A) Creates getter and setter methods for an instance variable
  • (B) Creates only getter methods for an instance variable
  • (C) Creates only setter methods for an instance variable
  • (D) Creates private methods for an instance variable
πŸ’¬ Discuss
βœ… Correct Answer: (A) Creates getter and setter methods for an instance variable

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
187
Total Visits
πŸ“½οΈ
2 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
81%
Success Rate