JOBSEEKERS
Login
Sign Up
Jobseeker
Employer
Staffing Firm
Direct Client
Ruby interview questions part 6
Ruby interview questions part 6
Back
Take as many assements as you can to improve your validate your skill rating
Total Questions: 20
1. What is the output of the given code? boolean_1 = 77<78 puts(boolean_1)
A. Nil
B. TRUE
C. FALSE
D. Error
Show Correct Answer
Correct Answer is :
TRUE
2. Objects of which class does the integer from the range -2^30 to 2^(30-1) belong to?
A. Bignum
B. Octal
C. Fixnum
D. Binary
Show Correct Answer
Correct Answer is :
Fixnum
3. What does the notataion \b stands for?
A. Escape
B. Space
C. Backspace
D. Newline
Show Correct Answer
Correct Answer is :
Backspace
4. What is the sequence of ruby strings?
A. 16-bit bytes
B. 8-bit bytes
C. 10-bit bytes
D. None of the mentioned
Show Correct Answer
Correct Answer is :
8-bit bytes
5. What is the output of the given code? my_string=Ruby puts(my_string)
A. Ruby
B. Nil
C. Error
D. None of the mentioned
Show Correct Answer
Correct Answer is :
Error
6. Which of the following is not a valid datatype?
A. Float
B. Integer
C. Binary
D. Timedate
Show Correct Answer
Correct Answer is :
Timedate
7. What is the range of octal notation (\nnn)?
A. 0-8
B. 0-7
C. 0-A
D. None of the mentioned
Show Correct Answer
Correct Answer is :
0-7
8. What is the output of the given code? for num in 1...5 puts num end
A. 1 2 3 4 5
B. 1 2 3 4
C. 2 3 4 5
D. None of the mentioned
Show Correct Answer
Correct Answer is :
1 2 3 4
9. What does the 1…10 indicate?
A. Inclusive range
B. Exclusive range
C. Both inclusive and exclusive range
D. None of the mentioned
Show Correct Answer
Correct Answer is :
Exclusive range
10. What is the output of the given code? for num in 1..3 puts num for i in 1..2 puts num*i end end
A. 1 2 3 4 5
B. 1 1 2 2 2 4 3 3 6
C. 2 3 4 5
D. None of the mentioned
Show Correct Answer
Correct Answer is :
1 1 2 2 2 4 3 3 6
11. What is the output of the given code? m= 0 loop do m += 1 print m break if m == 10 end
A. 12345678910
B. 1 2 3 4
C. 2 3 4 5
D. None of the mentioned
Show Correct Answer
Correct Answer is :
12345678910
12. What is the output of the given code? for num in 1..5 puts num*num end
A. 12345678910
B. 1 2 3 4
C. 1 4 9 16 25
D. None of the mentioned
Show Correct Answer
Correct Answer is :
1 4 9 16 25
13. What is the output of the given code? for num in 1..3 puts num*num m= 0 loop do m += 1 puts m break if m == 3 end end
A. 12345678910
B. 1 1 2 3 4 1 2 3 9 1 2 3
C. 1 4 9 16 25
D. None of the mentioned
Show Correct Answer
Correct Answer is :
1 4 9 16 25
14. What is the output of the given code? loop do m += 1 puts m break if m == 3 end
A. Garbage values
B. 1 1 2 3 4 1 2 3 9 1 2 3
C. 1 4 9 16 25
D. None of the mentioned
Show Correct Answer
Correct Answer is :
Garbage values
15. What is the output of the given code? i=1 for i in 5..10 puts i^2 end
A. 7 4 5 10 11 8
B. 25 36 49 64 81 100
C. 1 4 9 16 25
D. None of the mentioned
Show Correct Answer
Correct Answer is :
25 36 49 64 81 100
16. What does the 1..10 indicate?
A. Inclusive range
B. Exclusive range
C. Both inclusive and exclusive range
D. None of the mentioned
Show Correct Answer
Correct Answer is :
Inclusive range
17. What is the output of the given code? i=5 j=10 for i in 5..10 && j in 5..10 puts i**j end
A. Syntax error
B. 25 36 49 64 81 100
C. 1 4 9 16 25
D. None of the mentioned
Show Correct Answer
Correct Answer is :
Syntax error
18. The .upcase and .capitalize method are used for capitalizing the whole string.
A. TRUE
B. FALSE
C.
D.
Show Correct Answer
Correct Answer is :
FALSE
19. What is the use of .capitalize method?
A. It capitalizes the entire string
B. It capitalize on the first letter of the string
C. It capitalize the strings which are in small case
D. All of the mentioned
Show Correct Answer
Correct Answer is :
It capitalize on the first letter of the string
20. What is the role of ! at the end of the capitalize method?
A. It is the syntax for using capitalize method
B. It modifies the value stored in the variable
C. It indicates the termination of string
D. None of the mentioned
Show Correct Answer
Correct Answer is :
It modifies the value stored in the variable
Similar Interview Questions
Search for latest jobs
Find Jobs