Ruby interview questions part 9

Ruby interview questions part 9

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

Total Questions: 20

1. What will be the output of the given code? boolean_1 = (3 < 4 || false) && (false || true) puts boolean_1

Correct Answer is : TRUE

2. What will be the output of the given code? boolean_1 = !(3 < 4 || false) && (false || true) puts boolean_1

Correct Answer is : FALSE

3. What will be the output of the given code? boolean_1 = 2**3 != 3**2 || true puts boolean_1

Correct Answer is : TRUE

4. What will be the output of the given code? boolean_1 = false || -10 > -9 puts boolean_1

Correct Answer is : TRUE

5. What will be the output of the given code? boolean_1 = !(700 / 10 == 70) puts boolean_1

Correct Answer is : FALSE

6. What will be the output of the given code? boolean_1 = !true puts boolean_1 boolean_2 = !true && !true puts boolean_2

Correct Answer is : True False

7. What will be the output of the given code? boolean_2 = !true && (!true || 100 != 5**2) puts boolean_2

Correct Answer is : FALSE

8. Which of the following is the valid string method?

Correct Answer is : The .irreverse method

9. The .length method is used to check number of characters.

Correct Answer is : FALSE

10. What is the output of the following? "Iam learning ruby language".length

Correct Answer is : 26

11. What is the output of the following? ruby.reverse

Correct Answer is : Undefined local variable ruby

12. What will be the output of the following? "Eric".irreverse

Correct Answer is : undefined method

13. What does the .upcase method do?

Correct Answer is : Convert the string to uppercase

14. What will be the output of the following? "Ruby".reverse.upcase

Correct Answer is : YBUR

15. What will be the output of the given code? "I'am learning Ruby Language".length.reverse.upcase

Correct Answer is : Undefined method `reverse’ for 27:Fixnum

16. What will be the output of the given code? "I'am learning Ruby Language".reverse.upcase.length

Correct Answer is : 27

17. The downcase method changes the whole string to smallcase letters.

Correct Answer is : TRUE

18. What will we the output of the given code? "I'am Learning RUBY Language".downcase

Correct Answer is : “i’am learning ruby language”

19. What is the output of given code? string="I'am Learning RUBY Language".downcase string.upcase

Correct Answer is : “I’AM LEARNING RUBY LANGUAGE”

20. What will be the output of the given code? "Come let's learn.reverse Ruby.length language".upcase

Correct Answer is : “COME LET’S LEARN.REVERSE RUBY.LENGTH LANGUAGE”

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon