MCQs > IT & Programming > Ruby > colors= ['Red', 'Blue', 'Yellow', 'Green', 'Violet', 'Black'] Which of the given options will print the following output? Red Blue Yellow Green Violet Black

Ruby MCQs

Consider an array "colors" which has the following contents:
colors= ["Red", "Blue", "Yellow", "Green", "Violet", "Black"]
Which of the given options will print the following output?
Red
Blue
Yellow
Green
Violet
Black

Answer

Correct Answer:

colors= ["Red", "Blue", "Yellow", "Green", "Violet", "Black"]

for color in 0...colors.length


print colors[color], "\n"

end  

Explanation:

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

Ruby Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

Ruby Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it