Q. How do you add an element to the end of an array in Ruby?

  • (A) array.add(element)
  • (B) array.append(element)
  • (C) array.push(element)
  • (D) array.insert(element)
πŸ’¬ Discuss
βœ… Correct Answer: (C) array.push(element)
Explanation: 'push' method adds an element to the end of an array.
Explanation by: Rati Dubey
'push' method adds an element to the end of an array.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
98
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Rati Dubey
Publisher
πŸ“ˆ
84%
Success Rate