Ruby Questions and Answers Part-1

1. Ruby is an object oriented general purpose programming language.
a) True
b) False

Answer: a
Explanation: Ruby allow users to manipulate data structures called objects to build and execute programs.

2. Which of the following is supported by Ruby?
a) Multiple Programming Paradigms
b) Dynamic Type System
c) Automatic Memory Management
d) All of the Mentioned

Answer: d
Explanation: Ruby supports all the features because it is a object oriented programming language.

3. Which of the following features does the 2.0 version of ruby supports?
a) Method keyword arguments
b) New literals
c) Security fixes
d) All of the mentioned

Answer: d
Explanation: Ruby2.0 has several new added features and it is much stable than its older versions.

4. Which of the following languages syntax matches with the Ruby’s syntax?
a) Perl
b) PHP
c) Java
d) Jquery

Answer: a
Explanation: Most of the syntax of perl language matches with that of Ruby’s.

5. What is the extension used for saving the ruby file?
a) .ruby extension
b) .rb extension
c) .rrb extension
d) none of the mentioned

Answer: b
Explanation: Ruby files must be saved with the extension .rb.

6. Which of the following are valid floating point literal?
a) .5
b) 2
c) 0.5
d) None of the mentioned

Answer: c
Explanation: floating point literals are valid only when they have digits on both the sides of decimal point.

7. Ruby can be embedded into Hypertext Markup Language(HTML).
a) True
b) False

Answer: a
Explanation: Ruby can easily be encapsulated into HTML.

8. It is must for Ruby to use a compiler.
a) True
b) False

Answer: b
Explanation: No compiler is required for ruby as it is an interpreted language.

9. Ruby can be used for developing internet and intranet applications.
a) True
b) False

Answer: a
Explanation: Ruby is a server side scripting language used to create CGI(common gateway interface) scripts and hence can be used for developing internet and intranet applications.

10. Which of the following datatypes are valid in Ruby?
a) Numbers
b) Boolean
c) String
d) All of the mentioned

Answer: d
Explanation: Ruby supports all the three (numbers,strings,boolean) data types.