Question 1 of 25
Hints left: 3
Q1
What is the output of the given code? for num in 1..5 puts num*num end
Q2
Which of the following methods is used to merge two hashes together in Ruby?
Q3
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
Q4
What is the output of "hello".upcase in Ruby?
Q5
What is the output of the given code? i=1 for i in 5..10 puts i^2 end
Q6
What is the output of the given code? for num in 1...5 puts num end
Q7
What is the output of the given code? m= 0 loop do m += 1 print m break if m == 10 end
Q8
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
Q9
What is the output of "hello".length in Ruby?
Q10
Which method is used to access the value associated with a specific key in a hash in Ruby?
Q11
Which method in Ruby is used to remove and return the last element of an array?
Q12
What is the output of the given code? loop do m += 1 puts m break if m == 3 end
Q13
What is the output of ["apple", "banana", "cherry"].join(", ") in Ruby?
Q14
In Ruby, how do you convert a string to an array of characters?
Q15
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
Q16
What is the output of "hello".reverse in Ruby?
Q17
What does the join method do when used with an array in Ruby?
Q18
What does the << operator do when used with a string in Ruby?
Q19
What does the keys method return when called on a hash in Ruby?
Q20
What does the 1..10 indicate?
Q21
Which method is used to check if an array includes a specific element in Ruby?
Q22
What does the 1...10 indicate?
Q23
How do you check if a key exists in a hash in Ruby?
Q24
What will array.size return in Ruby, if array = [1, 2, 3, 4, 5]?
Q25
Which method in Ruby is used to add an element to the end of an array?