πŸ“Š Python
Q. What is the output of the following program?
Code:
line = "What will have so will"
L = line.split('a')
for i in L:
print(i, end=' ')
  • (A) [β€žWhat?, β€žwill?, β€žhave?, β€žso?, β€žwill?]
  • (B) Wh t will h ve so will
  • (C) What will have so will
  • (D) [β€žWh?, β€žt will h?, β€žve so will?]
πŸ’¬ Discuss
βœ… Correct Answer: (B) Wh t will h ve so will
πŸ“Š Python
Q. What is the type of each element in sys.argv?
  • (A) set
  • (B) list
  • (C) tuple
  • (D) string
πŸ’¬ Discuss
βœ… Correct Answer: (D) string
πŸ“Š Python
Q. What is the length of sys.argv?
  • (A) number of arguments
  • (B) number of arguments + 1
  • (C) number of arguments – 1
  • (D) none of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (B) number of arguments + 1
πŸ“Š Python
Q. What is the output of the following code?
Code:
def foo(k):
k[0] = 1
q = [0]
foo(q)
print(q)
  • (A) [0].
  • (B) [1].
  • (C) [1, 0].
  • (D) [0, 1].
πŸ’¬ Discuss
βœ… Correct Answer: (B) [1].
πŸ“Š Python
Q. What is the output of the following code?
Code:
def foo(fname, val):
print(fname(val))
foo(max, [1, 2, 3])
foo(min, [1, 2, 3])
  • (A) 3 1
  • (B) 1 3
  • (C) error
  • (D) none of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (A) 3 1
πŸ“Š Python
Q. What is the output of the following?
Code:
elements = [0, 1, 2]
def incr(x):
return x+1
print(list(map(elements, incr)))
  • (A) [1, 2, 3].
  • (B) [0, 1, 2].
  • (C) error
  • (D) none of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (C) error
πŸ“Š Python
Q. What is the output of the following?
Code:
elements = [0, 1, 2]
def incr(x):
return x+1
print(list(map(incr, elements)))
  • (A) [1, 2, 3].
  • (B) [0, 1, 2].
  • (C) error
  • (D) none of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (A) [1, 2, 3].
πŸ“Š Python
Q. What is the output of the following?
Code:
def to_upper(k):
return k.upper()
x = ['ab', 'cd']
print(list(map(to_upper, x)))
  • (A) [β€žAB?, β€žCD?].
  • (B) [β€žab?, β€žcd?].
  • (C) none of the mentioned
  • (D) error
πŸ’¬ Discuss
βœ… Correct Answer: (A) [β€žAB?, β€žCD?].
πŸ“Š Python
Q. What is the output of the following?
Code:
x = ['ab', 'cd']
print(len(list(map(list, x))))
  • (A) 2
  • (B) 4
  • (C) error
  • (D) none of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (A) 2
πŸ“Š Python
Q. Program code making use of a given module is called a ______ of the module.
  • (A) Client
  • (B) Docstring
  • (C) Interface
  • (D) Modularity
πŸ’¬ Discuss
βœ… Correct Answer: (A) Client