Control Structures In Ruby - Study Mode
[#76] What is the output of the given code? m= 8
loop do
m += 2
puts m
break if m == 16
end
Correct Answer
(A) 10 12 14 16
[#77] What is the output of the given code? m=0
loop do
print "ruby"
m+=1
break if m==5
end
Correct Answer
(B) rubyrubyrubyrubyruby
[#78] What is the output of the given code? m=0
loop do
puts m*10
m+=1
break if m==5
end
Correct Answer
(A) 0 10 20 30 40
[#79] What is the output of the given code? m=0
loop do
puts 101
m+=1
break if m==5
end
Correct Answer
(A) 101 101 101 101 101
[#80] What is the output of the given code? m=5
loop do
m-=1
break if m==0
end
Correct Answer
(D) Nil