Q. We use semicolon or parentheses after every print or puts statement.

  • (A) True
  • (B) i'AM lEARNING ruby lANGUAGE
  • (C) ---
  • (D) ---
πŸ’¬ Discuss
βœ… Correct Answer: (B) i'AM lEARNING ruby lANGUAGE

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

  • (A) iam learning ruby language
  • (B) 13 calculate length
  • (C) "i'am learning ruby language"
  • (D) None of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (C) "i'am learning ruby language"

Q. What is the output of the given code?
"Ruby Language".length
=begin
calculate length
=end

  • (A) 13
  • (B) #{expr}
  • (C) 12
  • (D) None of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (A) 13

Q. The .upcase and .capitalize method are used for capitalizing the whole string.

  • (A) True
  • (B) Same as 'x'
  • (C) ---
  • (D) ---
πŸ’¬ Discuss
βœ… Correct Answer: (B) Same as 'x'

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

  • (A) True
  • (B) Boolean
  • (C) ---
  • (D) ---
πŸ’¬ Discuss
βœ… Correct Answer: (A) True

Q. Which of the following are valid floating point literal?

  • (A) .5
  • (B) 2
  • (C) 0.5
  • (D) None of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (C) 0.5

Q. 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
πŸ’¬ Discuss
βœ… Correct Answer: (B) It modifies the value stored in the variable

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

  • (A) 27
  • (B) egaugnal ybuR gninreal ma'I
  • (C) ERAUGNAL YBUR GNINREAL MA'I
  • (D) Undefined method 'reverse' for 27:Fixnum
πŸ’¬ Discuss
βœ… Correct Answer: (D) Undefined method 'reverse' for 27:Fixnum

Q. What is the range of octal notation (\nnn)?

  • (A) 0-8
  • (B) 0-7
  • (C) 0-A
  • (D) None of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (B) 0-7

Q. Which of the following type of comments are valid in ruby?

  • (A) Single line comments
  • (B) Multi line comments
  • (C) Double line comments
  • (D) All of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of the mentioned