Ruby MCQ Questions
This section focuses on "Basics" in Ruby. These Multiple Choice Questions (MCQ) should be practiced to improve the Ruby skills required for various interviews (campus interviews, walk-in interviews, company interviews), placements, entrance exams and other competitive examinations.
1. Ruby is ?
A. procedural language
B. scripting language
C. Markup language
D. Stylesheet language
View Answer
Ans : B
Explanation: Ruby is a scripting language
2. Ruby is designed by?
A. Yukihiro Matsumoto
B. Guido van Rossum
C. Tim Berners-Lee
D. Brendan Eich
View Answer
Ans : A
Explanation: Ruby is a scripting language designed by Yukihiro Matsumoto, also known as Matz.
3. Ruby was created in?
A. 1992
B. 1993
C. 1994
D. 1995
View Answer
Ans : B
Explanation: Ruby was created in 1993 by Yukihiro Matsumoto of Japan.
4. Which of the following statement is not a feature of ruby?
A. Ruby is interpreted programming language.
B. Ruby can be used to write Common Gateway Interface (CGI) scripts.
C. Ruby can be embedded into Hypertext Markup Language (HTML).
D. Ruby can not be connected to Database.
View Answer
Ans : D
Explanation: Ruby can not be connected to Database is not a feature of ruby.
5. When Whitespace characters such as spaces and tabs can not ignored in Ruby code?
A. While using strings
B. While using integer
C. while using float value
D. All of the above
View Answer
Ans : A
Explanation: Whitespace characters such as spaces and tabs are generally ignored in Ruby code, except when they appear in strings.
6. Reserved word can not be used as?
A. constant
B. variable names
C. Both A and B
D. None of the above
View Answer
Ans : C
Explanation: reserved words may not be used as constant or variable names.
7. Which character is used to give comment in ruby?
A. !
B. @
C. #
D. $
View Answer
Ans : C
Explanation: The hash character (#) is used to give comment in ruby.
8. Which of the following is supported by Ruby?
A. Dynamic Type System
B. Multiple Programming Paradigms
C. Automatic Memory Management
D. All of the above
View Answer
Ans : D
Explanation: Ruby supports all the features because it is a object oriented programming language.
9. Which of the following languages syntax matches with the Ruby's syntax?
A. C
B. Perl
C. PHP
D. Java
View Answer
Ans : B
Explanation: Most of the syntax of perl language matches with that of Ruby's.
10. Which of the following are valid floating point literal?
A. 0.5
B. 5
C. 0.5
D. 5
View Answer
Ans : A
Explanation: floating point literals are valid only when they have digits on both the sides of decimal point.
Discussion