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. Which of the following is not a type of loop in ruby?

For Loop
Foreach Loop
Until Loop
While Loop

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

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

for num in 1...4

   puts num*num

end

0 1 4 9
1 4 9 16
0 1 2 3
1 2 3

4. Guess the operator : If Condition is true ? Then value X : Otherwise value Y?

Range Operators
Ternary Operator
Parallel Operator
Arithmetic operator

5. Reserved word can not be used as?

constant
variable names
Both A and B
None of the above

6. What will be output for the folowing code?

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

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

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

num=4>>2
puts num

-2
0
2
1

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

9. Which will be output for the followinf code?

puts "Hello, Ruby!";

Hello, Ruby
Hello Ruby!
Hello, Ruby!
Hello Ruby

10. What is the extension used for saving the ruby file?

.rb extension
.ruby extension
.rrb extension
.rbb extension

Results