11. What is the output of the given code?
for num in 1...5
puts num
end
for num in 1...5
puts num
end12. What does the 1...10 indicate?
13. What is the output of the given code?
for num in 1..3
puts num
for i in 1..2
puts num*i
end
end
for num in 1..3
puts num
for i in 1..2
puts num*i
end
end14. What is the output of the given code?
m= 0
loop do
m += 1
print m
break if m == 10
end
m= 0
loop do
m += 1
print m
break if m == 10
end15. What is the output of the given code?
for num in 1..5
puts num*num
end
for num in 1..5
puts num*num
end16. What is the output of the given code?
for num in 1..3
puts num*num
m= 0
loop do
m += 1
puts m
break if m == 3
end
end
for num in 1..3
puts num*num
m= 0
loop do
m += 1
puts m
break if m == 3
end
end17. What is the output of the given code?
loop do
m += 1
puts m
break if m == 3
end
loop do
m += 1
puts m
break if m == 3
end18. What is the output of the given code?
i=1
for i in 5..10
puts i^2
end
i=1
for i in 5..10
puts i^2
end19. What does the 1..10 indicate?
20. What is the output of the given code?
i=5
j=10
for i in 5..10 && j in 5..10
puts i**j
end
i=5
j=10
for i in 5..10 && j in 5..10
puts i**j
endRead More Section(Control Structures in Ruby)
Each Section contains maximum 100 MCQs question on Control Structures in Ruby. To get more questions visit other sections.
