Ruby Programming Questions and Answers – The Case Conditional Statement

This set of Ruby Programming Multiple Choice Questions & Answers (MCQs) focuses on “The Case Conditional Statement”. 1. What is the output of the given code? age = 5 case age when 0 .. 2 puts "baby" when 3 .. 6 puts "little child" when 7 .. 12 puts "child" when 13 .. 18 puts … Read more

advertisement

Ruby Programming Questions and Answers – The Unless Conditional Statement

This set of Ruby Programming Interview Questions and Answers for freshers focuses on “The Unless Conditional Statement”. 1. Syntax for unless conditional statement is unless conditional [then] code else code end a) True b) False 2. What is the output of the given code? x=3 unless x>2 puts "x is less than 2" else puts … Read more

advertisement

Ruby Programming Questions and Answers – The Elsif Conditional Statement

This set of Ruby Programming Questions and Answers for Freshers focuses on “The Elsif Conditional Statement”. 1. Which of the following is valid conditional statement in Ruby? a) elseif b) elsif c) else if d) elseiff 2. The elsif conditional statement is written with an expression. a) True b) False 3. The elsif statement can … Read more

advertisement

Ruby Programming Questions and Answers – The Else Conditional Statement

This set of Ruby Programming Multiple Choice Questions & Answers (MCQs) focuses on “The Else Conditional Statement”. 1. What is the use of else statement? a) When the if condition is false then the next else condition will get executed b) When the if condition is false then the elsif condition will get executed c) … Read more

advertisement

Ruby Programming Questions and Answers – The If Conditional Statement

This set of Ruby Programming Multiple Choice Questions & Answers (MCQs) focuses on “The If Conditional Statement”. 1. The following syntax is correct for if conditional statement. if condition code end a) True b) False 2. If expression. The expression can be of which type? a) True b) Any number c) Any string d) All … Read more

advertisement

Ruby Programming Questions and Answers – Comments in Ruby

This set of Ruby Programming Multiple Choice Questions & Answers (MCQs) focuses on “Comments in Ruby”. 1. Why do we use comments? a) For later use to understand the working of the program b) It is an efficient way of programming c) It makes easy for the third person to understand d) All of the … Read more

advertisement

Ruby Programming Questions and Answers – Formatting String Methods

This set of Ruby Programming Interview Questions and Answers focuses on “Formatting String Methods”. 1. The .upcase and .capitalize method are used for capitalizing the whole string. a) True b) False 2. What is the use of .capitalize method? a) It capitalizes the entire string b) It capitalize on the first letter of the string … Read more

advertisement

Ruby Programming Questions and Answers – String Methods

This set of Ruby Programming Multiple Choice Questions & Answers (MCQs) focuses on “String Methods”. 1. Which of the following is the valid string method? a) The .length method b) The .upcase method c) The .downcase method d) The .irreverse method 2. The .length method is used to check number of characters. a) True b) … Read more

advertisement

Ruby Questions and Answers – Library Functions

This set of Ruby Programming Multiple Choice Questions & Answers (MCQs) focuses on “Library Functions”. 1. Which of the following is not a valid library function? a) Puts b) Print c) Gets d) Get 2. Why is the library function ‘puts’used for? a) Prints whatever is given and print it to the screen b) Prints … Read more

advertisement

Ruby Questions and Answers – Data Types and Variables

This set of Ruby Programming Multiple Choice Questions & Answers (MCQs) focuses on “Data Types and Variables”. 1. Which of the following datatypes are valid in Ruby? a) Numbers b) Boolean c) String d) All of the mentioned 2. What will any variable evaluate to if it is of Boolean data type? a) True b) … Read more

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.