PlacementPrep
Practice › Technical › CSE/IT › Python
Technical · CSE / IT

Python MCQs for placement tests

20 technical questions of moderate difficulty, as asked in campus placement and company tests. Each has a short explanation.

Q1CSE/IT · PythonModerate

What is the output of this Python code?

a = [1, 2, 3]
b = a
b.append(4)
print(a)
Q2CSE/IT · PythonModerate

What is the output of this Python code?

a = [1, 2, 3]
b = a[:]
b.append(4)
print(a)
Q3CSE/IT · PythonModerate

What is the output of this Python code?

print(7 // 2)
Q4CSE/IT · PythonModerate

What is the output of this Python code?

print(7 / 2)
Q5CSE/IT · PythonModerate

What is the output of this Python code?

print("hello"[::-1])
Q6CSE/IT · PythonModerate

What is the output of this Python code?

print([x * x for x in range(4)])
Q7CSE/IT · PythonModerate

What is the output of this Python code?

print(2 ** 3)
Q8CSE/IT · PythonModerate

Which of these data types is immutable in Python?

Q9CSE/IT · PythonModerate

What is the output of this Python code?

print({1, 1, 2, 3, 3})
Q10CSE/IT · PythonModerate

What is the output of this Python code?

def f(x, lst=[]):
    lst.append(x)
    return lst
print(f(1), f(1))
Q11CSE/IT · PythonModerate

What is the output of this Python code?

print("a" + "b")
Q12CSE/IT · PythonModerate

What is the output of this Python code?

d = {"a": 1, "b": 2, "c": 3}
print(len(d))
Q13CSE/IT · PythonModerate

What is the output of this Python code?

a = [1, 2, 3, 4]
print(a[1:3])
Q14CSE/IT · PythonModerate

Which keyword is used to define a function in Python?

Q15CSE/IT · PythonModerate

What is the output of this Python code?

a = None
b = None
print(a is b)
Q16CSE/IT · PythonModerate

What is the output of this Python code?

for i in range(3):
    print(i, end=" ")
Q17CSE/IT · PythonModerate

What does the 'pass' statement do in Python?

Q18CSE/IT · PythonModerate

What is the output of this Python code?

print(type(3 + 2.0))
Q19CSE/IT · PythonModerate

Which method adds all elements of another list to the end of a list?

Q20CSE/IT · PythonModerate

What is the output of this Python code?

print([1, 2, 2, 3].count(2))

Want guided preparation? Placement Papers Prep courses by Dr. Kiran Derle, with video lessons and full-length mocks.

See placement courses ↗