Question 1 of 25
Hints left: 3
Q1
What is the output of the given code? a = 5 b=10 while a <10 && b<20 puts a*b a+=2 b+=2 end
Q2
In Ruby, what does the unless keyword do?
Q3
What does the break keyword do in a loop in Ruby?
Q4
What is the output of the given code? test_1 = 17 > 16 puts(test_1) test_2 = 21 <= 30 puts(test_2) test_3 = 9 >= 9 puts(test_3) test_4 = -11 > 4 puts(test_4)
Q5
What is the purpose of the case statement in Ruby?
Q6
What will the following expression evaluate to? !true && !false
Q7
What is the output of the given code? a= 5 b=10 while a <10 && b<20 puts a-b a+=2 b+=2 end
Q8
Which loop in Ruby allows you to iterate over a collection of elements?
Q9
What is the output of the given code? if(a==10 && b=9) print "true" else print "false" end
Q10
What is the output of the given code? a="string" b="strings" if(a==b) print ("a and b are same") else print "Not same" end
Q11
What will be the output of the given code? boolean_1 = !true puts boolean_1 boolean_2 = !true && !true puts boolean_2
Q12
What is the output of the given code? counter=1 if counter<=5 puts (counter) counter=counter+1
Q13
What will be the output of the given code? boolean_1 = (3 < 4 || false) && (false || true) puts boolean_1
Q14
What is the keyword used to define a conditional statement in Ruby?
Q15
What is the purpose of the redo keyword in Ruby?
Q16
What does the **= assignment operator do?
Q17
What is the output of the given code? counter = 2 while counter < 68 puts counter counter**=2 end
Q18
Which of the following is NOT a comparison operator in Ruby?
Q19
What will the following code evaluate to? a=9!=10
Q20
What is the output of the given code? counter = 100 while counter > 0 puts counter counter-=25 end
Q21
What will be the output of the given code? boolean_1 = false || -10 > -9 puts boolean_1
Q22
What is the result of the expression 5 > 3 ? "Yes" : "No" in Ruby?
Q23
What will the following expression evaluate to? true && false
Q24
What is the output of the following code snippet? x = 10 unless x > 15 puts "Hello" end
Q25
Which of the following loops in Ruby is executed at least once?