Q. What is the output of '5.times { |i| puts i }'?

  • (A) 0 1 2 3 4
  • (B) 1 2 3 4 5
  • (C) 5 4 3 2 1
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (A) 0 1 2 3 4
Explanation: 'times' iterates from 0 up to one less than the number.
Explanation by: Rati Dubey
'times' iterates from 0 up to one less than the number.

πŸ’¬ Discussion


πŸ“Š Question Analytics

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