Take as many assements as you can to improve your validate your skill rating
Total Questions: 20
1. What is the output of the given code?
string_array = ["a","e","i","o","u"]
print string_array
Correct Answer is : [“a”,”e”,”i”,”o”,”u”].
2. What is the output of the given code?
string_array = ["a","e","i","o","u"]
print string_array[3]
Correct Answer is : o
3. What is the output of the given code?
string_array = ["a","e","i","o","u"]
boolean_array = ["True","False"]
puts string_array[3]
puts boolean_array
Correct Answer is : o
4. What is the output of the given code?
string_array = ["a","e","i","o","u"]
boolean_array = ["True","False"]
puts string_array[3]
puts boolean_array[1]
Correct Answer is : o
5. What is the output of the given code?
a=[1,2,3,4,5]
b=[1,2,4,6,8]
if a[3]==b[2]
print "Equal"
end
Correct Answer is : Equal
6. What is the output of the given code?
a=[1,2,3,4,5]
b=[1,2,3,4,5]
if a==b
print "Equal"
else
print "Not equal"
end
Correct Answer is : Equal
7. What is the output of the given code?
a=["hey", "ruby", "language"]
b=["hey", "ruby", "language"]
if a==b
print "Equal"
else
print "Not equal"
end
Correct Answer is : Equal
8. What is the output of the given code?
a=["hey", "ruby", "language"]
b=["hey", "language", "ruby"]
if a==b
print "Equal"
else
print "Not equal"
end
Correct Answer is : Not equal
9. What is the output of the given code?
a=["hey", "ruby", "language"]
b=[1, 2, 3]
puts b[1]
puts a[2]
Correct Answer is : 2
10. Which of the following is a valid assignment operator?
Correct Answer is : All of the mentioned
11. What does the **= assignment operator do?
Correct Answer is : It is used as exponent like 2**3=8
12. What is the output of the given code?
counter = 2
while counter < 68
puts counter
counter**=2
end
Correct Answer is : 42404
13. What is the output of the given code?
counter = 1
while counter < 11
puts counter
counter+=1
end
Correct Answer is : 1..10
14. Ruby does not support ++ operator, it only supports += operator.
Correct Answer is : TRUE
15. What is the output of the given code?
counter = 100
while counter > 0
puts counter
counter/=5
end
Correct Answer is : 100 20 4
16. What is the output of the given code?
counter = 100
while counter > 0
puts counter
counter-=25
end
Correct Answer is : 100 75 50 25
17. What is the output of the given code?
counter = -50
while counter <0
puts counter
counter+=10
end
Correct Answer is : -50 -40 -30 -20 -10
18. The given two expression means the same.
counter=counter+1 and counter++
Correct Answer is : TRUE
19. What is the output of the given code?
a = 22.5
while a >11.5
puts a
a-=3.5
end
Correct Answer is : 22.5 11.5
20. 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