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. What will be the output of the given code?

counter = true
while counter !=false
  puts counter
end

TRUE
FALSE
Syntax Error
Infinite Loop

2. Ruby is ?

procedural language
scripting language
Markup language
Stylesheet language

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

digits = Array(0..9)
num = digits.at(6)
puts #{num}

5
6
7
8

4. Default value of class variables is?

nil
infinite
-1
error

5. Which statement is used to execute the rescue block again from the beginning after capturing the exception?

retry
raise
ensure
else

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

break
next
redo
retry

7. What is the syntax to open file in ruby?

File.open("filename", "mode")
File.open("filename")
File.open()
All of the above

8. What does end represent?

keyword represents the ending of loop
keyword represents the start of loop
keyword represents the start and ending of loop
keyword represents the infinite loop

9. Which of the following Ruby Pseudo-Variables is used for The receiver object of the current method?

self
current
nil
_FILE_

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

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

[100, 200, 300, 400, 500]
300
400
500

Results