15th
Feb
Ruby MCQ

Ruby MCQ

  • Admin
  • 15th Feb, 2021
  • 638 Followers

Ruby MCQ Questions

1) This the right way to comment a single line. “Ruby”.length # I’m a single line comment!

  • A. True
  • B. False

2) Ruby can be embedded into Hypertext Markup Language:

  • A. Yes
  • B. No

3) On which platform ruby runs:

  • A. Unix
  • B. Mac OS
  • C. Windows
  • D. All of the above

4) Which of the following are valid floating point literal?

  • A. 5
  • B. 2
  • C. 0.5
  • D. 0.6

5) Why is the library function ‘puts’used for?

  • A. Prints whatever is given and insert a new(blank) line
  • B. Gets input from the user
  • C. Prints whatever is given and print it to the screen
  • D. none
Download Free : Ruby MCQ PDF

6) Reserved word can not be used as?

  • A. variable names
  • B. strings
  • C. constant
  • D. Both A and C

7) Which of the following features does the 2.0 version of ruby supports?

  • A. Security fixes
  • B. Method keyword arguments
  • C. New literals
  • D. All of the above

8) 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 Hypertext Markup Language (HTML)
  • D. Ruby can be used to write Common Gateway Interface (CGI) scripts

9) Ruby 2.7.1 version release date?

  • A. 31-04-1999
  • B. 31-05-2015
  • C. 31-03-2020
  • D. 31-06-2010

10) Ruby was created in?

  • A. 1992
  • B. 1993
  • C. 1994
  • D. 1995

11) Why do we use comments?

  • A. It is an efficient way of programming
  • B. It makes easy for the third person to understand
  • C. For later use to understand the working of the program
  • D. All of these

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

  • A. Java
  • B. Jquery
  • C. Perl
  • D. PHP

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

  • A. .rrb extension
  • B. .rb extension
  • C. .ruby extension
  • D. All of the above

14) Ruby was written in?

  • A. C++
  • B. Objective C
  • C. C
  • D. Java

15) What is the output of the given code? “Ruby” length #to find the length of given string

  • A. To find the length of given string
  • B. Ruby
  • C. 4 to find the length of given string
  • D. 4

16) What is a controller?

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

17) Ruby is an object oriented general purpose programming language:

  • A. True
  • B. False

18) What is the sequence of ruby strings?

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

19) Why do we use =begin and =end?

  • A. To avoid the use of # again and again
  • B. To mark the start and end of multiline comment
  • C. To comment multiple lines
  • D. All of the above

20) Block comment conceals several lines from the interpreter with?

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

21) Which character is used to give comment in ruby?

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

22) How includes all stylesheet files?

  • A. <%= link_to ... %>
  • B. <%= stylesheet_link_tag :all %>
  • C. <%= javascript_include_tag :defaults %>
  • D. <%= csrf_meta_tag %>

23) What does the notation \b stands for?

  • A. space
  • B. newline
  • C. escape
  • D. backspace

24) Which of these supported by Ruby?

  • A. Automatic Memory Management
  • B. Multiple Programming Paradigms
  • C. Dynamic Type System
  • D. All of the Mentioned

25) Ruby is designed by?

  • A. Guido van Rossum
  • B. Tim Berners-Lee
  • C. Yukihiro Matsumoto
  • D. Brendan Eich

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

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

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

  • A. integer
  • B. timedate
  • C. float
  • D. binary

28) Ruby is?

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

29) How do you make sure your forms don’t get hacked?

  • A. <%= stylesheet_link_tag :all %>
  • B. tweets_path
  • C. <%= csrf_meta_tag %>
  • D. <%= link_to ... %>

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

  • A. Fixnum
  • B. Binary
  • C. Bignum
  • D. Octal

Leave A Comment :

Valid name is required.

Valid name is required.

Valid email id is required.

Related MCQ/Quiz

01st
Dec
Laravel MCQ
01st
Dec
React JS MCQ
01st
Jan
AngularJs MCQ
01st
Jul
Node js MCQ
01st
Jul
Angular 2 MCQ
01st
Jul
JSON MCQ