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. Why can not we use quotation marks ("or") with boolean?

It indicates that we are talking about a string
It indicates that we are assining a value
It indicates that that we are replacing boolean data type with string data type
None of the above

2. What will be output for the following code?

begin
         
    raise 'Exception Created!'
   
    puts 'After Exception'
   
  rescue    
    puts 'Finally Saved!'
    
retry
end    

Finally Saved!
After Exception
Exception Created!
Infinite Loop

3. In ruby, User can access the string elements by using the__________?

{}
[]
()
All of the above

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

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

TRUE
FALSE
Type Error
Syntax Error

5. Which operator is used to find exponent in ruby?

*
**
^
%

6. Which of the following statement is not a feature of ruby?

Ruby is interpreted programming language.
Ruby can be used to write Common Gateway Interface (CGI) scripts.
Ruby can be embedded into Hypertext Markup Language (HTML).
Ruby can not be connected to Database.

7. Which of the following is correct syntax to create an array in ruby?

names = Array.new
names = Array.new(20)
Both A and B
None of the above

8. What will be output for the following code?

str = "LetsFindCourse Ruby MCQs" puts str[2]

t
e
MCQs
Ruby

9. What will the following expression evaluate to?

!true && !false

TRUE
FALSE
Syntax Error
None of the above

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

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

Error
["a","e","i","o","u"]
aeiou
Infinite Loop

Results