Ruby Questions and Answers – Basics

»

This set of Ruby Programming Multiple Choice Questions & Answers (MCQs) focuses on “Basics”.

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

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

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
View Answer

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
View Answer

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
View Answer

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

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
View Answer

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
View Answer

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
View Answer

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

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

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
View Answer

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.

Sanfoundry Global Education & Learning Series – Ruby Programming.

advertisement

To practice all areas of Ruby Programming, here is complete set of 1000+ Multiple Choice Questions and Answers.

advertisement
advertisement
advertisement
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @ LinkedIn