πŸ“Š Ruby
Q. Why notation is used in Ruby?
  • (A) Formfeed
  • (B) Escape
  • (C) Carriage return
  • (D) Bell
πŸ’¬ Discuss
βœ… Correct Answer: (C) Carriage return
πŸ“Š Ruby
Q. Which notation is used for Octal notation?
  • (A) \s
  • (B) \xnn
  • (C) \n
  • (D) \nn
πŸ’¬ Discuss
βœ… Correct Answer: (D) \nn
πŸ“Š Ruby
Q. Which of the following datatypes are valid in Ruby?
  • (A) Numbers
  • (B) String C
  • (C) Boolean
  • (D) All of the above
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of the above
πŸ“Š Ruby
Q. 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 above
πŸ’¬ Discuss
βœ… Correct Answer: (A) It indicates that we are talking about a string
πŸ“Š Ruby
Q. What is the sequence of ruby strings?
  • (A) 16-bit bytes
  • (B) 8-bit bytes
  • (C) 4-bit bytes
  • (D) None of the above
πŸ’¬ Discuss
βœ… Correct Answer: (B) 8-bit bytes
πŸ“Š Ruby
Q. What is the output of the given code?
Code:
my_string=Ruby
puts(my_string)
  • (A) Ruby
  • (B) Nil
  • (C) Error
  • (D) my_string
πŸ’¬ Discuss
βœ… Correct Answer: (C) Error

Explanation: Ruby should be written in double quotes inorder to indicate a string.

πŸ“Š Ruby
Q. single-quoted strings don`t allow ?
  • (A) substitution
  • (B) backslash notation
  • (C) single-quoted strings allow substitution and backslash notation.
  • (D) single-quoted strings don`t allow substitution and allow backslash notation.
πŸ’¬ Discuss
βœ… Correct Answer: (D) single-quoted strings don`t allow substitution and allow backslash notation.

Explanation: single-quoted strings don`t allow substitution and allow backslash notation only for \ and '.

πŸ“Š Ruby
Q. Which type of number(0b1011 ) is ?
  • (A) Octal
  • (B) Hexadecimal
  • (C) Binary
  • (D) Decimal
πŸ’¬ Discuss
βœ… Correct Answer: (C) Binary
πŸ“Š Ruby
Q. Objects of which class does the integer from the range -2^30 to 2^(30-1) belong to?
  • (A) Octal
  • (B) Bignum
  • (C) Fixnum
  • (D) Binary
πŸ’¬ Discuss
βœ… Correct Answer: (C) Fixnum

Explanation: Integer within this range are objects of the class fixnum.

πŸ“Š Ruby
Q. Objects of which class does the integer from the range -2^60 to 2^(60-1) belong to?
  • (A) Octal
  • (B) Bignum
  • (C) Fixnum
  • (D) Binary
πŸ’¬ Discuss
βœ… Correct Answer: (B) Bignum