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