Ruby Programming Quiz


Play this quiz that will help you to excel in Ruby certification exams, placements etc. This Ruby programming quiz consist of 10 questions that you need to solve in 10 minutes. We’ve specially designed this quiz so that you can quickly acquaint to the pattern of questions you can be asked in placement drives, certification exams etc. This Ruby programming test enables you to assess your knowledge of Ruby programming.

Take the Free Practice Test



Ruby MCQs

Practice Ruby MCQ Questions, which will help you to understand Ruby Programming related concepts and also helps you to prepare for placements, interviews, competitive exams etc.

Ruby Quiz

Try Free Ruby Quiz, to start a quiz you need to login first, after login you will get start quiz button and then by clicking on that you can start quiz. You will get 10 Minutes to answer all questions.

Ruby Quiz

1. Which statement is used to Restarts this iteration of the most internal loop, without checking loop condition?

break
next
redo
retry

2. What is the output of the given code?

array = [100, 200, 300, 400, 500]
print array[5]

500
Syntax Error
Nil
Name Error

3. What is the output of the given code?

array1 = [[1,2,3,4,5],[0,0,0,0]]
print !array1

Error
[[1, 2, 3, 4, 5], [0, 0, 0, 0]].
TRUE
FALSE

4. What will be the output of the given code?

arr = [[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]]
print arr

[[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]].
[0, 0, 0, 0][0, 0, 0, 0].
[0, 0, 0, 0].
error

5. Which of the following is not a type of loop in ruby?

For Loop
Foreach Loop
Until Loop
While Loop

6. What will be the output of the given code?

for i in 1..5 && j in 5..10
puts i+j
end

6 8 10 12 14 16
Syntax Error
6 8 10 12 14
Type Error

7. String may consists of?

Number
letter
Special character
All of the above

8. Which of the following command is used to tell the size of array?

arraynames.size
arraynames.length
arraynames.len
Both A and B

9. What will be the output of the given code?

 boolean_var = !(100 / 10 === 10)
puts boolean_var

TRUE
FALSE
Type Error
Syntax Error

10. What will be output for the following code?

str = ""Hello Ruby!""
putc str

Hello Ruby!
H
R
Hello

Results