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 range operator ... is used for ?

Creates a range from start point to end point inclusive.
Creates a range from start point to end point exclusive.
Creates a range from start point inclusive to end point exclusive.
Creates a range from start point exclusive to end point inclusive.

2. What is true about while loop?

Executes code while conditional is true
In while loop increment is not required
Executes code while conditional is false
None of the above

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

i = 4
while i > 0 do
  print i
  i -= 1
end

321
3210
4321
43210

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. Why notation is used in Ruby?

Formfeed
Escape
Carriage return
Bell

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

boolean_var = 3**2 != 2**3 || true
puts boolean_var

TRUE
FALSE
1
0

7. Which of the following features does the 2.0 version of ruby supports?

New literals
Security fixes
Method keyword arguments
All of the above

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

n = [ 65, 66, 67 ] puts n.pack(ccc)

ABC
abc
BCD
bcd

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

a=[1,2,3,4,5]
b=[1,2,4,6,8]
if a[3]==b[2]
    print Equal
end

TRUE
FALSE
Equal
error

10. Which of the following Ruby Pseudo Variables is used to return current line number in the source file?

_FILE_
_CURRENT_
_LINE_
None of the above

Results