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?

for num in 1...5
  puts num
end

1 2 3 4
1 2 3 4 5
0 1 2 3 4
0 1 2 3 4 5

2. What will be output for the folowing code?

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

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

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

4. what will be output for the following code?

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

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

5. What does the 1..5 indicate?

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

6. Ruby was created in?

1992
1993
1994
1995

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

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

TRUE
FALSE
Type Error
Syntax Error

8. What will be output for the following code?

  begin
         
    raise 'Exception Created!'
   
    puts 'After Exception' 
   
  rescue    
    puts 'Finally Saved!'
    
ensure
   puts 'ensure block execute'
end    

ensure block execute
After exception! Finally Saved! ensure block execute
Ecxception Created! Finally Saved! ensure block execute
Finally Saved! ensure block execute

9. Ruby was written in?

C
C++
Java
Objective C

10. eql? Operator is used for?

Used to test equality within a when clause of a case statement.
if the receiver and argument have both the same type and equal values.
if the receiver and argument have the same object id.
All of the above

Results