CommerceBasic Syntax In Ruby MCQs
Practice Basic Syntax In Ruby MCQs for competitive exams.
Basic Syntax In Ruby MCQs
Practice questions from this topic.
What will be the output of the following? "Eric".irreverse
- A. Eric
- B. cirE
- C. undefined method
- D. None of the mentioned
Correct Answer: C
For getting an input from the user which method is used?
- A. get
- B. gets.chomp
- C. get-s
- D. chomp
Correct Answer: B
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
Correct Answer: A
Why is gets not preferred instead of gets.chomp?
- A. Gets add an extra new line while chomp removes it
- B. Gets remove an extra new line
- C. Chomp erases the value stored in the variable
- D. All of the mentioned
Correct Answer: A
What does the .upcase method do?
- A. Convert the string to uppercase
- B. Convert only lowercase string to uppercase and vice-versa
- C. Convert the string to lowercase
- D. None o the mentioned
Correct Answer: A
Which of the following languages syntax matches with the Ruby's syntax?
- A. Perl
- B. PHP
- C. Java
- D. Jquery
Correct Answer: A
What is the sequence of ruby strings?
- A. 16-bit bytes
- B. 8-bit bytes
- C. 10-bit bytes
- D. None of the mentioned
Correct Answer: B
What is the extension used for saving the ruby file?
- A. .ruby extension
- B. .rb extension
- C. .rrb extension
- D. None of the mentioned
Correct Answer: B
The following is the correct way to use multiline comment. = begin # comment = end
- A. True
- B. False
Correct Answer: B
What does the notataion b stands for?
- A. Escape
- B. Space
- C. Backspace
- D. Newline
Correct Answer: C
What will any variable evaluate to if it is of Boolean data type?
- A. True
- B. Nil
- C. False
- D. Either True or False
Correct Answer: D
What does %{Learn ruby language} represents?
- A. "Learn Ruby language"
- B. "%{Learn Ruby language}"
- C. " Learn Ruby language "
- D. None of the mentioned
Correct Answer: A