1. What is the output of the given code?
a = 5
b=10
while a <10 && b<20
puts a*b
a+=2
b+=2
end
Correct Answer is : 50 84 126
2. What is the output of the given code?
a= 5
b=10
while a <10 && b<20
puts a-b
a+=2
b+=2
end
Correct Answer is : -5 -5 -5
3. What is the output of the given code?
a = 5
b=10
while a <10 || b<20
puts a*b
a+=2
b+=2
end
Correct Answer is : 50 84 126 176 234
4. What is the output of the given code?
a = 5
b=10
while (a <10 || b<20)&&true
puts a*b
a+=2
b+=2
end
Correct Answer is : 50 84 126 176 234
5. Ruby is an object oriented general purpose programming language.
6. Which of the following is supported by Ruby?
Correct Answer is : All of the Mentioned
7. Which of the following features does the 2.0 version of ruby supports?
Correct Answer is : All of the mentioned
8. Which of the following languages syntax matches with the Ruby’s syntax?
9. What is the extension used for saving the ruby file?
Correct Answer is : .rb extension
10. Which of the following are valid floating point literal?
11. Ruby can be embedded into Hypertext Markup Language(HTML).
12. It is must for Ruby to use a compiler.
Correct Answer is : FALSE
13. Ruby can be used for developing internet and intranet applications.
14. Why do we use comments?
Correct Answer is : All of the mentioned
15. Which of the following type of comments are valid in ruby?
Correct Answer is : All of the mentioned
16. How to comment multiple lines in ruby?
Correct Answer is : Using multiline comments
17. How to comment a single line?
Correct Answer is : Using #
18. This the right way to comment a single line.
“Ruby”.length # I’m a single line comment!
19. What is the output of the given code?
“Ruby”.length #to find the length of given string
20. The following is the correct way to use multiline comment.
= begin
# comment
= end
Correct Answer is : FALSE