Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

What does the 1..10 indicate?(a) Inclusive range(b) Exclusive range(c) Both inclusive and exclusive range(d) None of the mentionedI have been asked this question in an interview.I'd like to ask this question from For Loop in portion Mathematic Operations and Loops of Ruby

Answer»

Correct OPTION is (a) INCLUSIVE range

Easiest explanation: 1..10 MEANS start from ONE and go till 9 and even include 10.

2.

What does the 1…10 indicate?(a) Inclusive range(b) Exclusive range(c) Both inclusive and exclusive range(d) None of the mentionedThe question was posed to me by my school principal while I was bunking the class.The doubt is from For Loop topic in portion Mathematic Operations and Loops of Ruby

Answer»

Right answer is (b) Exclusive range

Explanation: 1…10 MEANS start from one and GO TILL 9 and don’t include 10.

3.

Ruby does not support ++ operator, it only supports += operator.(a) True(b) FalseThe question was asked by my school principal while I was bunking the class.My question comes from Assignment Operators topic in chapter Mathematic Operations and Loops of Ruby

Answer»

The CORRECT answer is (a) True

Easiest EXPLANATION: Ruby does not support ++ or — operator. It only supports += or -= operator.

4.

The complement of while loop is until loop.(a) True(b) FalseThe question was posed to me at a job interview.The question is from Until Loop in section Mathematic Operations and Loops of Ruby

Answer» CORRECT CHOICE is (a) True

The EXPLANATION is: The until LOOP is sort of LIKE backward while.
5.

What does the **= assignment operator do?(a) Multiplies the value twice(b) It is used as exponent like 2**3=8(c) It is the multiplication operator.(d) None of the mentionedThe question was asked by my school teacher while I was bunking the class.My doubt is from Assignment Operators in chapter Mathematic Operations and Loops of Ruby

Answer»

The correct answer is (b) It is used as EXPONENT like 2**3=8

For explanation I WOULD say: a**=2 means a to the power of TWO.

6.

Which of the following is a valid assignment operator?(a) +=(b) -=(c) *=(d) All of the mentionedI have been asked this question in a national level competition.Question is taken from Assignment Operators in section Mathematic Operations and Loops of Ruby

Answer»

The CORRECT OPTION is (d) All of the mentioned

Explanation: ASSIGNMENT OPERATORS are +=, -=, *=, /=, **=.

7.

The boolean operator && only result in true when both the values are true?(a) True(b) FalseI have been asked this question by my school teacher while I was bunking the class.This intriguing question comes from Operators in chapter Mathematic Operations and Loops of Ruby

Answer»

The correct answer is (a) TRUE

The EXPLANATION is: The && OPERATOR only results in true when both the values are true rest all cases it evaluates to false.

8.

Boolean opeartors are also known as logical operators.(a) True(b) FalseI got this question by my college professor while I was bunking the class.I need to ask this question from Operators in chapter Mathematic Operations and Loops of Ruby

Answer»

Right answer is (a) True

The BEST explanation: BOOLEAN operators result in boolean values like true or FALSE.

9.

Which of the following is a valid boolean operator?(a) and(&&)(b) or(||)(c) not(!)(d) All of the mentionedI have been asked this question during an internship interview.Enquiry is from Operators in portion Mathematic Operations and Loops of Ruby

Answer» CORRECT ANSWER is (d) All of the mentioned

For explanation I WOULD say: We have THREE BOOLEAN operators which are and, or, not.
10.

Which of the following are used for comparison?(a) Equal to(b) Not equal to(c) Less than or greater than(d) All of the mentionedThe question was asked during an interview.This question is from Comparisons topic in portion Mathematic Operations and Loops of Ruby

Answer»

The correct choice is (d) All of the MENTIONED

For explanation: All of the mentioned above are USED for COMPARISONS.

11.

Assignment operator is also known as relational operator.(a) True(b) FalseI got this question in an interview.My question comes from Comparisons topic in division Mathematic Operations and Loops of Ruby

Answer»

Right OPTION is (a) True

For explanation: ASSIGNMENT OPERATOR is USED for assigning a VALUE.

12.

The ‘=’ is used for assigning value to variable?(a) True(b) FalseI had been asked this question in an interview for internship.Query is from Comparisons in chapter Mathematic Operations and Loops of Ruby

Answer»

Correct OPTION is (a) True

For explanation I WOULD SAY: The ‘=’ is known as ASSIGNMENT operator.

13.

The == ‘is equal to’ is known as relational operator.(a) True(b) FalseI got this question in an interview for job.This is a very interesting question from Comparisons topic in division Mathematic Operations and Loops of Ruby

Answer»

The CORRECT OPTION is (a) True

Explanation: The == is used to COMPARE two THINGS are equal or not and hence it is known as comparator/relational operator.