Ruby MCQs with answers Page - 5

Here, you will find a collection of MCQ questions on Ruby. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 828.03K Points
Coach

Q. eql? Operator is used for?

  • (A) Used to test equality within a when clause of a case statement.
  • (B) if the receiver and argument have both the same type and equal values.
  • (C) if the receiver and argument have the same object id.
  • (D) All of the above

A

Admin • 828.03K Points
Coach

Q. equal? Operator is used for?

  • (A) Used to test equality within a when clause of a case statement.
  • (B) if the receiver and argument have both the same type and equal values.
  • (C) if the receiver and argument have the same object id.
  • (D) All of the above

A

Admin • 828.03K Points
Coach

Q. Which of the following is not a type of Bitwise Operators?

  • (A) <<
  • (B) ^
  • (C) ~
  • (D) None of the above

A

Admin • 828.03K Points
Coach

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

  • (A) Range Operators
  • (B) Ternary Operator
  • (C) Parallel Operator
  • (D) Arithmetic operator

A

Admin • 828.03K Points
Coach

Q. In range operator ... is used for ?

  • (A) Creates a range from start point to end point inclusive.
  • (B) Creates a range from start point to end point exclusive.
  • (C) Creates a range from start point inclusive to end point exclusive.
  • (D) Creates a range from start point exclusive to end point inclusive.

A

Admin • 828.03K Points
Coach

Q. .......... used for Creates a range from start point to end point exclusive.

  • (A) define
  • (B) define?
  • (C) defined?
  • (D) defined

A

Admin • 828.03K Points
Coach

Q. Among the following which operator has highest Precedence?

  • (A) ::
  • (B) .
  • (C) []
  • (D) **

A

Admin • 828.03K Points
Coach

Q. Among the following which operator has lowest Precedence?

  • (A) .
  • (B) ...
  • (C) >>
  • (D) ^

A

Admin • 828.03K Points
Coach

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

Code:
boolean_var = 15 < 16 && 15 < 15
puts boolean_var
  • (A) TRUE
  • (B) FALSE
  • (C) Type Error
  • (D) Syntax Error

A

Admin • 828.03K Points
Coach

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

Code:
num=4<<2
puts num
  • (A) 4
  • (B) 8
  • (C) 16
  • (D) 32

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ