Ruby interview questions part 5

Ruby interview questions part 5

Take as many assements as you can to improve your validate your skill rating

Total Questions: 20

1. Why do we use =begin and =end?

Correct Answer is : All of the mentioned

2. What is the output of the given code? "Ruby Language".length =begin calculate length =end

Correct Answer is : 13

3. What is the output of the given code? "Ruby Language".length = begin calculate length = end

Correct Answer is : Error

4. Space between 2+5 or 2 + 5 is valid but =begin and = begin is not valid.

Correct Answer is : TRUE

5. The == ‘is equal to’ is known as relational operator.

Correct Answer is : TRUE

6. The ‘=’ is used for assigning value to variable?

Correct Answer is : TRUE

7. What will the following code evaluate to? a=9!=10

Correct Answer is : TRUE

8. What is the output of the given code? test_1 = 17 > 16 puts(test_1) test_2 = 21 <= 30 puts(test_2) test_3 = 9 >= 9 puts(test_3) test_4 = -11 > 4 puts(test_4)

Correct Answer is : True True True False

9. What is the output of the given code? a="string" b="strings" if(a==b) print ("a and b are same") else print "Not same" end

Correct Answer is : Not same

10. Assignment operator is also known as relational operator.

Correct Answer is : TRUE

11. What is the output of the given code? a=10 b=9 if(a>b) print ("a greater than b") else print "Not greater" end

Correct Answer is : a greater than b

12. Which of the following are used for comparison?

Correct Answer is : All of the mentioned

13. What is the output of the given code? if(a==10 && b=9) print "true" else print "false" end

Correct Answer is : Error

14. What is the output of the given code? counter=1 if counter<=5 puts (counter) counter=counter+1

Correct Answer is : Syntax error

15. Which of the following datatypes are valid in Ruby?

Correct Answer is : All of the mentioned

16. What will any variable evaluate to if it is of Boolean data type?

Correct Answer is : Either True or False

17. Why can not we use quotation marks (‘ or “) with boolean?

Correct Answer is : It indicates that we are talking about a string

18. Ruby is a case-sensitive language.

Correct Answer is : TRUE

19. What is the size of an integer data type in ruby?

Correct Answer is : -230 to 2(30-1)

20. Ruby can deal with both numbers and floating point values.

Correct Answer is : TRUE

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon