Ruby MCQs with answers Page - 4

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. Which notation is used for Octal notation?

  • (A) s
  • (B) xnn
  • (C)
  • (D) n

A

Admin • 828.03K Points
Coach

Q. Which of the following datatypes are valid in Ruby?

  • (A) Numbers
  • (B) String C
  • (C) Boolean
  • (D) All of the above

A

Admin • 828.03K Points
Coach

Q. Why can not we use quotation marks ("or") with boolean?

  • (A) It indicates that we are talking about a string
  • (B) It indicates that we are assining a value
  • (C) It indicates that that we are replacing boolean data type with string data type
  • (D) None of the above

A

Admin • 828.03K Points
Coach

Q. What is the sequence of ruby strings?

  • (A) 16-bit bytes
  • (B) 8-bit bytes
  • (C) 4-bit bytes
  • (D) None of the above

A

Admin • 828.03K Points
Coach

Q. What is the output of the given code?

Code:
my_string=Ruby
puts(my_string)
  • (A) Ruby
  • (B) Nil
  • (C) Error
  • (D) my_string

A

Admin • 828.03K Points
Coach

Q. Which type of number(0b1011 ) is ?

  • (A) Octal
  • (B) Hexadecimal
  • (C) Binary
  • (D) Decimal

A

Admin • 828.03K Points
Coach

Q. Objects of which class does the integer from the range -2^30 to 2^(30-1) belong to?

  • (A) Octal
  • (B) Bignum
  • (C) Fixnum
  • (D) Binary

A

Admin • 828.03K Points
Coach

Q. Objects of which class does the integer from the range -2^60 to 2^(60-1) belong to?

  • (A) Octal
  • (B) Bignum
  • (C) Fixnum
  • (D) Binary

A

Admin • 828.03K Points
Coach

Q. Which of the following is not type of operator in ruby?

  • (A) Arithmetic Operators
  • (B) Comparison Operators
  • (C) Similar operator
  • (D) Parallel Assignment

A

Admin • 828.03K Points
Coach

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

  • (A) *
  • (B) **
  • (C) ^
  • (D) %

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