Home / Programming MCQs / Ruby MCQs / Question

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

Explanation:

Array's index start from 0 so array[4] will give 500.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.