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. In ruby, Exception handling is a process which describes a way to handle the __________.

unwanted Event
unexpected event
Both A and B
None of the above

2. 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

3. Which of the method is used to returns the contents of the file line by line?

IO.read
IO.foreach
IO.syswrite
IO.readlines

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

string_array = [a,e,i,o,u]
print string_array[3]

["a","e","i","o","u"]
e
i
o

5. Each element in an array is associated with _______.

Numbers
Index
Integer
None of the above

6. Local variables in ruby begin with?

@
_
*
#

7. Which method is used to write content in the file ?

systemwrite
sysputs
syswrite
systemputs

8. What does the 1..5 indicate?

Exclusive range
Both inclusive and exclusive range
Inclusive range
None of the above

9. What will be output for the following code?

str2 = String.new ""LetsFindCourse""

puts str2 

LETSFINDCOURSE
letsfindcourse
Error
LetsFindCourse

10. Block comment conceals several lines from the interpreter with?

=begin and =end
=start and =end
=here and =end
=begin and =ending

Results