JOBSEEKERS
Login
Sign Up
Jobseeker
Employer
Staffing Firm
Direct Client
Ruby interview questions part 5
Ruby interview questions part 5
Back
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?
A. To mark the start and end of multiline comment
B. To comment multiple lines
C. To avoid the use of # again and again
D. All of the mentioned
Show Correct Answer
Correct Answer is :
All of the mentioned
2. What is the output of the given code? "Ruby Language".length =begin calculate length =end
A. 13
B. 13 calculate length
C. 12
D. None of the mentioned
Show Correct Answer
Correct Answer is :
13
3. What is the output of the given code? "Ruby Language".length = begin calculate length = end
A. 13
B. 12
C. Error
D. None of the mentioned
Show Correct Answer
Correct Answer is :
Error
4. Space between 2+5 or 2 + 5 is valid but =begin and = begin is not valid.
A. TRUE
B. FALSE
C.
D.
Show Correct Answer
Correct Answer is :
TRUE
5. The == ‘is equal to’ is known as relational operator.
A. TRUE
B. FALSE
C.
D.
Show Correct Answer
Correct Answer is :
TRUE
6. The ‘=’ is used for assigning value to variable?
A. TRUE
B. FALSE
C.
D.
Show Correct Answer
Correct Answer is :
TRUE
7. What will the following code evaluate to? a=9!=10
A. TRUE
B. FALSE
C. Syntax error
D. None of the mentioned
Show Correct Answer
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)
A. True false true false
B. True True True False
C. False False True True
D. None of the mentioned
Show Correct Answer
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
A. a and b are same
B. Not same
C. a==b
D. None of the mentioned
Show Correct Answer
Correct Answer is :
Not same
10. Assignment operator is also known as relational operator.
A. TRUE
B. FALSE
C.
D.
Show Correct Answer
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
A. a greater than b
B. Not greater
C. Syntax error
D. None of the mentioned
Show Correct Answer
Correct Answer is :
a greater than b
12. 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 mentioned
Show Correct Answer
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
A. TRUE
B. FALSE
C. Error
D. None of the mentioned
Show Correct Answer
Correct Answer is :
Error
14. What is the output of the given code? counter=1 if counter<=5 puts (counter) counter=counter+1
A. Syntax error
B. 45293
C. 1
D. None of the mentioned
Show Correct Answer
Correct Answer is :
Syntax error
15. Which of the following datatypes are valid in Ruby?
A. Numbers
B. Boolean
C. String
D. All of the mentioned
Show Correct Answer
Correct Answer is :
All of the mentioned
16. What will any variable evaluate to if it is of Boolean data type?
A. TRUE
B. Nil
C. FALSE
D. Either True or False
Show Correct Answer
Correct Answer is :
Either True or False
17. Why can not we use quotation marks (‘ or “) with boolean?
A. It indicates that we are talking about a string
B. It indicates that we are assining a value
C. It indicates that that we are replacing boolean data type with string data type
D. None of the mentioned
Show Correct Answer
Correct Answer is :
It indicates that we are talking about a string
18. Ruby is a case-sensitive language.
A. TRUE
B. FALSE
C.
D.
Show Correct Answer
Correct Answer is :
TRUE
19. What is the size of an integer data type in ruby?
A. -230 to 230
B. -230 to 2(30-1)
C. -229 to 230
D. -260 to 261
Show Correct Answer
Correct Answer is :
-230 to 2(30-1)
20. Ruby can deal with both numbers and floating point values.
A. TRUE
B. FALSE
C.
D.
Show Correct Answer
Correct Answer is :
TRUE
Similar Interview Questions
Search for latest jobs
Find Jobs