Q. What will be the output of the given ruby code?

Code:
array = [100, 200, 300, 400, 500]
print array[4]
  • (A) [100, 200, 300, 400, 500]
  • (B) 300
  • (C) 400
  • (D) 500
πŸ’¬ Discuss
βœ… Correct Answer: (D) 500
Explanation: Array's index start from 0 so array[4] will give 500.
Explanation by: Yami Thakur
Array's index start from 0 so array[4] will give 500.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
300
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Yami Thakur
Publisher
πŸ“ˆ
92%
Success Rate