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. Reserved word can not be used as?

constant
variable names
Both A and B
None of the above

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

counter = 1
while counter < 5
  puts counter
  counter = counter + 1
end

Prints the number from 1 to 4
Prints the number from 1 to 5
Prints the number from 2 to 5
Prints the number from 2 to 4

3. Ruby is ?

procedural language
scripting language
Markup language
Stylesheet language

4. Class variables in ruby begin with?

@
#
double @
##

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

begin
ensure
retry
pass

6. What is the output of the given code?

a=[[a,b]]
b=[[e,a]]
print a + b

[["a", "b"], ["e", "a"]].
[["2a", "b"], ["e"]].
TRUE
FALSE

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

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

321
3210
4321
43210

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

for i in 1...3  
  for j in 1..3
  puts j
  end
end

1 2 1 2
0 1 2 0 1 2
1 2 3 1 2 3
1 2 3 1 2

9. Array indexing in ruby starts at_________.

-1
1
0
Random number

10. When Whitespace characters such as spaces and tabs can not ignored in Ruby code?

While using strings
While using integer
while using float value
All of the above

Results