91. What is the output of the given code?
counter = 1
while counter < 11
puts counter
counter = counter + 1
end
counter = 1
while counter < 11
puts counter
counter = counter + 1
end
92. What is the output of the given code?
counter = true
while counter !=false
puts counter
end
counter = true
while counter !=false
puts counter
end
93. What is the output of the given code?
i = 0
while i < 5
puts i
i=(i+1)**2
end
i = 0
while i < 5
puts i
i=(i+1)**2
end
94. What is the output of the given code?
a=5
b=15
while a&&b
puts a+b
end
a=5
b=15
while a&&b
puts a+b
end
95. What is the output of the given code?
a=5
b=15
while b>a
puts a*(b-a)
while a>b
a+=1
b-=1
end
end
a=5
b=15
while b>a
puts a*(b-a)
while a>b
a+=1
b-=1
end
end
96. What is the output of the given code?
i = 3
while i > 0 do
print i
i -= 1
end
i = 3
while i > 0 do
print i
i -= 1
end
97. What is the output of the given code?
i = 50
while i > 25 do
print 50/i
i -= 1
end
i = 50
while i > 25 do
print 50/i
i -= 1
end
98. What is the output of the given code?
a = 5
b=10
while a<b do
puts a*b
a+=2
b-=2
end
a = 5
b=10
while a<b do
puts a*b
a+=2
b-=2
end
99. What is the output of the given code?
i = 50
j=55
while i > 25 && j>35 do
puts 50*j/i
i -= 1
j-=2
end
i = 50
j=55
while i > 25 && j>35 do
puts 50*j/i
i -= 1
j-=2
end
100. What is the output of the given code?
i = 50
j=55
while i > 25 && i*j<100 do
puts (50*j)/i
i -= 1
j-=2
end
i = 50
j=55
while i > 25 && i*j<100 do
puts (50*j)/i
i -= 1
j-=2
end
Read 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.