πŸ“Š Python Programming
Q. What is the output of the following program :
i = 0
while i < 3:
print i
print i+1
  • (A) 0 2 1 3 2 4
  • (B) 0 1 2 3 4 5
  • (C) 0 1 1 2 2 3
  • (D) 1 0 2 4 3 5
πŸ’¬ Discuss
βœ… Correct Answer: (C) 0 1 1 2 2 3
πŸ“Š Python Programming
Q. Which module in Python supports regular expressions?
  • (A) re
  • (B) regex
  • (C) pyregex
  • (D) None of the above
πŸ’¬ Discuss
βœ… Correct Answer: (A) re
πŸ“Š Python Programming
Q. What is the output of the following program : print 0.1 + 0.2 == 0.3
  • (A) True
  • (B) False
  • (C) Machine dependent
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (B) False

Explanation: Neither of 0.1, 0.2 and 0.3 can be represented accurately in binary. The
round off errors from 0.1 and 0.2 accumulate and hence there is a difference of 5.5511e-17
between (0.1 + 0.2) and 0.3.

πŸ“Š Python Programming
Q. What data type is the object below? L = [1, 23, „helloβ€Ÿ, 1]
  • (A) List
  • (B) Dictionary
  • (C) Tuple
  • (D) Array
πŸ’¬ Discuss
βœ… Correct Answer: (A) List
πŸ“Š Python Programming
Q. What is the output of the following program :
def myfunc(a):
a = a + 2
a = a * 2
return a
print myfunc(2)
  • (A) 8
  • (B) 16
  • (C) Indentation Error
  • (D) Runtime Error
πŸ’¬ Discuss
βœ… Correct Answer: (C) Indentation Error
πŸ“Š Python Programming
Q. What is the output of the following program : print '{0:.2}'.format(1.0 / 3)
  • (A) 0.333333
  • (B) 0.33
  • (C) 0.333333:-2
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (B) 0.33

Jump to