Ruby MCQs with answers Page - 3

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 • 831.35K Points
Coach

Q. Default value of global variable is?

  • (A) -1
  • (B) Nil
  • (C) 1
  • (D) Infinite

A

Admin • 831.35K Points
Coach

Q. Instance variables in ruby begin with?

  • (A) @
  • (B) #
  • (C) $
  • (D) &

A

Admin • 831.35K Points
Coach

Q. Class variables in ruby begin with?

  • (A) @
  • (B) #
  • (C) double @
  • (D) ##

A

Admin • 831.35K Points
Coach

Q. Default value of class variables is?

  • (A) nil
  • (B) infinite
  • (C) -1
  • (D) error

A

Admin • 831.35K Points
Coach

Q. Local variables in ruby begin with?

  • (A) @
  • (B) _
  • (C) *
  • (D) #

A

Admin • 831.35K Points
Coach

Q. Constants in ruby begin with ?

  • (A) Lowercase
  • (B) @
  • (C) !
  • (D) Uppercase

A

Admin • 831.35K Points
Coach

Q. Which of the following Ruby Pseudo-Variables is used for The receiver object of the current method?

  • (A) self
  • (B) current
  • (C) nil
  • (D) _FILE_

A

Admin • 831.35K Points
Coach

Q. Which of the following Ruby Pseudo Variables is used to return the name of the current source file?

  • (A) _FILE_
  • (B) _CURRENT_
  • (C) _LINE_
  • (D) None of the above

A

Admin • 831.35K Points
Coach

Q. Which of the following Ruby Pseudo Variables is used to return current line number in the source file?

  • (A) _FILE_
  • (B) _CURRENT_
  • (C) _LINE_
  • (D) None of the above

A

Admin • 831.35K Points
Coach

Q. Why notation is used in Ruby?

  • (A) Formfeed
  • (B) Escape
  • (C) Carriage return
  • (D) Bell

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