Q.1
What will be the output of the following Python code? for i in range(10): if i == break else: print(i) else: print("Here")
  • a) 0 1 2 3 4 Here
  • b) 0 1 2 3 4 5 Here
  • c) 0 1 2 3 4
  • d) 1 2 3 4 5
Q.2
What will be the output of the following Python code? for i in range(5): if i == break else: print(i) else: print("Here")
  • a) 0 1 2 3 4 Here
  • b) 0 1 2 3 4 5 Here
  • c) 0 1 2 3 4
  • d) 1 2 3 4 5
Q.3
What will be the output of the following Python code? x = (i for i in range(3)) for i in x: print(i)
  • a) 0 1 2
  • b) error
  • c) 0 1 2 0 1 2
  • d) none of the mentioned
Q.4
What will be the output of the following Python code? x = (i for i in range(3)) for i in x: print(i) for i in x: print(i)
  • a) 0 1 2
  • b) error
  • c) 0 1 2 0 1 2
  • d) none of the mentioned
Q.5
What will be the output of the following Python code? string = "my name is x" for i in string: print (i, end=", ")
  • a) m, y, , n, a, m, e, , i, s, , x,
  • b) m, y, , n, a, m, e, , i, s, , x
  • c) my, name, is, x,
  • d) error
Q.6
What will be the output of the following Python code? string = "my name is x" for i in string.split(): print (i, end=", ")
  • a) m, y, , n, a, m, e, , i, s, , x,
  • b) m, y, , n, a, m, e, , i, s, , x
  • c) my, name, is, x,
  • d) error
Q.7
What will be the output of the following Python code snippet? a = [for a[-in a: print(a[-1])
  • a) 0 1 2 3
  • b) 0 1 2 2
  • c) 3 3 3 3
  • d) error
Q.8
What will be the output of the following Python code snippet? a = [for a[in a: print(a[0])
  • a) 0 1 2 3
  • b) 0 1 2 2
  • c) 3 3 3 3
  • d) error
Q.9
What will be the output of the following Python code snippet? a = [i = -2 for i not in a: print(i) i += 1
  • a) -2 -1
  • b) 0
  • c) error
  • d) none of the mentioned
Q.10
What will be the output of the following Python code snippet? string = "my name is x" for i in ' '.join(string.split()): print (i, end=", ")
  • a) m, y, , n, a, m, e, , i, s, , x,
  • b) m, y, , n, a, m, e, , i, s, , x
  • c) my, name, is, x,
  • d) error
0 h : 0 m : 1 s