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?

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

ABC
abc
BCD
bcd

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

boolean_var = 15 < 16 && 15 < 15
puts boolean_var

TRUE
FALSE
Type Error
Syntax Error

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

4. What will the following expression evaluate to?

true || false

TRUE
FALSE
Syntax Error
None of the above

5. Which of the following datatypes are valid in Ruby?

Numbers
String
Boolean
All of the above

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

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

7. what will be output for the following code?

str1 = LFC puts "str1: #{str1}"

str1: LFC
str1: #{str1}
str1: {LFC}
str1: #{LFC}

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

a = [ a, b, c ] puts a.pack(a3a3a3)

ABC
abc
BCD
bcd

9. Which of the following is a Reserved Words in Ruby?

do
or
in
All of the above

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

i=1
for i in 6..10
puts i**2
end

36 49 64 81
49 64 81 100
49 64 81
36 49 64 81 100

Results