Q. What will be the output of the following
Python code?
1. >>>example = "snow world"
2. >>>example[3] = 's'
3. >>>print example

  • (A) snow
  • (B) snow world
  • (C) error
  • (D) snos world
πŸ’¬ Discuss
βœ… Correct Answer: (C) error

Explanation: strings cannot be modified.

Q. >>>print("A", end = ' ')

  • (A) dcba
  • (B) a, b, c, d
  • (C) d c b a
  • (D) d, c, b, a will be displayed on four lines
πŸ’¬ Discuss
βœ… Correct Answer: (C) d c b a

Explanation: execute in the shell.

Q. what will be the output of the following
Python code snippet?
def example(a):
a = a + '2'
a = a*2
return a
>>>example("hello")

  • (A) indentation error
  • (B) cannot perform mathematical operation on strings
  • (C) hello2
  • (D) hello2hello2
πŸ’¬ Discuss
βœ… Correct Answer: (A) indentation error

Explanation: python codes have to be indented properly.

Q. What data type is the object below? L = [1, 23, 'hello', 1]

  • (A) list
  • (B) dictionary
  • (C) array
  • (D) tuple
πŸ’¬ Discuss
βœ… Correct Answer: (A) list

Explanation: list data type can store any

Jump to