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.

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.
advertisement
advertisement

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.

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.
advertisement

Sanfoundry Global Education & Learning Series – Ruby Programming.

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

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.