Control Structures In Ruby - Study Mode

[#71] The complement of while loop is until loop.
Correct Answer

(A) True

[#72] What is the output of the given code? counter = 1
until counter > 10
puts counter
counter+=1
end
Correct Answer

(A) 1 2 3 4 5 6 7 8 9 10

[#73] What is the output of the given code? counter = 0
until counter >= 10
puts counter
counter+=1
end
Correct Answer

(C) 0 1 2 3 4 5 6 7 8 9

[#74] What is the output of the given code? i = 3
while i > 0 do
puts i
i -= 1
end

j = 3
until j == 0 do
puts j
j -= 1
end
Correct Answer

(C) 0 1 2 3 4 5 6 7 8 9

[#75] What is the output of the given code? a="hungry"
until !a
puts "hungry"
a=!a
end
Correct Answer

(A) hungry