Ruby MCQ Questions

Ruby MCQ Questions | Freshers & Experienced

  • Satyam Jaiswal
  • 22nd May, 2021

We are introducing here the best Ruby MCQ Questions, which are very popular & asked various times. This Quiz contains the best 25+ Ruby MCQ with Answers, which cover the important topics of Ruby Programming Language. for which, you can perform best in  Ruby Programming Language Exams, Interviews, and Placement activities.

Ruby MCQ Questions and Answers

1) What is the extension used for saving the ruby file?

  • A. .rub
  • B..ruby
  • C..rb
  • D..rrb

2) What is Ruby?

  • A. stylesheet language
  • B.markup language
  • C.procedural language
  • D.scripting language

3) Is Ruby an object oriented general purpose programming language?

  • A. Yes
  • B.No
  • C.May be
  • D.Can't say

4) Ruby is designed by _________.

  • A. James Gosling
  • B.Yukihiro Matsumoto
  • C.Guido van Rossum
  • D.Martin Odersky

5) Ruby was created in which year?

  • A. 1991
  • B.1993
  • C.1994
  • D.1997

6) Which of the languages syntax matches with the Ruby’s syntax?

  • A. Java
  • B.Perl
  • C.Python
  • D.C++

7) The notation \b stands for

  • A. blank
  • B.bold
  • C.backspace
  • D.black

8) ________ datatypes are valid in Ruby.

  • A. Integer
  • B.String
  • C.Boolean
  • D.All of the above

9) Which of the following statement is not a feature of ruby?

  • A. Ruby can not be connected to Database
  • B.Ruby is interpreted programming language
  • C.Ruby can be embedded into HTML.
  • D.None of the above

10) Ruby can be embedded into Hypertext Markup Language.

  • A. Yes
  • B.No
  • C.May be
  • D.Can't say

11) Which of the following is not a valid datatype in Ruby?

  • A. Integer
  • B.String
  • C.Timedate
  • D.Float

12) Is Ruby a case-sensitive language?

  • A. Yes
  • B.No
  • C.May be
  • D.Can't say

13) Which of the following is the valid string method?

  • A. .upcase method
  • B..downcase method
  • C..length method
  • D..irreverse method

14) Methods should be written inside double quotes.

  • A. Yes
  • B.No
  • C.May be
  • D.Can't say

15) What is a controller?

  • A. When the order matters, use an array.
  • B.It’s a test that simulates a browser accessing our application.
  • C.An array uses indices and a hash uses “keys”
  • D.A controller is a container for a group of web pages.

16) _______ character is used to give comment in ruby.

  • A. $
  • B.@
  • C.#
  • D.%

17) What error does the if condition gives if not terminated with end statement?

  • A. Syntax error
  • B.Expecting keyword end
  • C.Unexpected end
  • D.All of the above

18) If statement inside if statement is called Nested if statements.

  • A. True
  • B.False

19) Which of the following is valid conditional statement?

  • A. elif
  • B.else
  • C.else if
  • D.if else

20) Block comment conceals several lines from the interpreter with ______.

  • A. =start and =end
  • B.=end
  • C.=begin and =end
  • D.=here and =end

21) Which of these is not a valid library function?

  • A. Print
  • B.Gets
  • C.Get
  • D.Puts

22) Why do we use comments?

  • A. It is an efficient way of programming
  • B.It makes easy for the third person to understand
  • C.Both A and B
  • D.None of the above

23) What is the size of an integer data type in ruby?

  • A. -2^30 to 2^29
  • B.-2^30 to 2^30
  • C.-2^29 to 2^29
  • D.-2^30 to 2^28

24) Ruby can deal with both numbers and floating point values.

  • A. Yes
  • B.No
  • C.May be
  • D.Can't say

25) What is the sequence of ruby strings?

  • A. 16-bit bytes
  • B.4-bit bytes
  • C.32-bit bytes
  • D.8-bit bytes

26) What is the range of octal notation?

  • A. 0-9
  • B.0-A
  • C.0-7
  • D.None of the above

27) How to includes all stylesheet files?

  • A. <%= link_to ... %>
  • B.<%= javascript_include_tag :defaults %>
  • C.<%= stylesheet_link_tag :all %>
  • D.None of the above

28) Ruby can deal with both numbers and floating point values.

  • A. True
  • B.False

29) Is Ruby a strongly typed language?

  • A. Yes
  • B.No
  • C.May be
  • D.Can't say

30) Which of the following are valid floating point literal in ruby?

  • A. 0.1
  • B.0.5
  • C.0.2
  • D.None of the above

Leave A Comment :

Valid name is required.

Valid name is required.

Valid email id is required.

Related MCQ/Quiz

01st
Feb
Powerpoint MCQ
01st
Jun
MVC MCQ
01st
Jun
GIT MCQ