πŸ“Š Python
Q. What is the output of the following piece of code?
Code:
#mod1
def change(a):
b=[x*2 for x in a]
print(b)
#mod2
def change(a):
b=[x*x for x in a]
print(b)
from mod1 import change
from mod2 import change
#main
s=[1,2,3]
change(s)
  • (A) [2,4,6].
  • (B) [1,4,9].
  • (C) [2,4,6].
  • (D) There is a name clash
πŸ’¬ Discuss
βœ… Correct Answer: (D) There is a name clash
πŸ“Š Python
Q. What is the output of the following program?
Code:
tday=datetime.date.today() print(tday.month())
  • (A) August
  • (B) Aug
  • (C) 08
  • (D) 8
πŸ’¬ Discuss
βœ… Correct Answer: (D) 8
πŸ“Š Python
Q. Which of the following formatting options can be used in order to add β€žn? blank spaces after a given string β€žS??
  • (A) print(β€œ-ns”%S)
  • (B) print(β€œ-ns”%S)
  • (C) print(β€œ%ns”%S)
  • (D) print(β€œ%-ns”%S)
πŸ’¬ Discuss
βœ… Correct Answer: (D) print(β€œ%-ns”%S)
πŸ“Š Python
Q. What is the output of the following program?
Code:
f = None
for i in range (5):
with open("data.txt", "w") as f:
if i > 2:
break
print(f.closed)
  • (A) True
  • (B) False
  • (C) None
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (A) True
πŸ“Š Python
Q. To read the entire remaining contents of the file as a string from a file object infile, we use
  • (A) infile.read(2)
  • (B) infile.read()
  • (C) infile.readline()
  • (D) infile.readlines()
πŸ’¬ Discuss
βœ… Correct Answer: (B) infile.read()
πŸ“Š Python
Q. Suppose t = (1, 2, 4, 3), which of the following is incorrect?
  • (A) print(t[3])
  • (B) t[3] = 45
  • (C) print(max(t))
  • (D) print(len(t))
πŸ’¬ Discuss
βœ… Correct Answer: (B) t[3] = 45
πŸ“Š Python
Q. Who developed Python Programming Language?
  • (A) Wick van Rossum
  • (B) Rasmus Lerdorf
  • (C) Guido van Rossum
  • (D) Niene Stom
πŸ’¬ Discuss
βœ… Correct Answer: (C) Guido van Rossum
πŸ“Š Python
Q. Which type of Programming does Python support?
  • (A) object-oriented programming
  • (B) structured programming
  • (C) functional programming
  • (D) all of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (D) all of the mentioned
πŸ“Š Python
Q. Is Python case sensitive when dealing with identifiers?
  • (A) no
  • (B) yes
  • (C) machine dependent
  • (D) none
πŸ’¬ Discuss
βœ… Correct Answer: (A) no
πŸ“Š Python
Q. Which of the following is the correct extension of the Python file?
  • (A) .python
  • (B) .pl
  • (C) .py
  • (D) .p
πŸ’¬ Discuss
βœ… Correct Answer: (C) .py