iGET

Python Programming - MCQ Practice Questions

Core Python MCQs — syntax, data types, OOP, libraries for placements & IT exams.

119 questions | 100% Free

Q.21Medium

What will be the output of: print(bool(0), bool(''), bool([]))

Q.22Medium

Which operator in Python performs integer division?

Q.23Medium

What is the output of: for i in range(3): print(i, end=' ')

Q.24Medium

Consider: s = 'Python'; print(s[2:5]). What will be the output?

Q.25Medium

What will be the output of: x = 10; y = 20; x, y = y, x; print(x, y)

Q.26Medium

Consider: s = 'Python'. What is s[-1]?

Q.27Medium

Which of the following will correctly check if a key exists in a dictionary?

Q.28Medium

Consider the code: def func(a, b=5): return a + b. What is func(3)?

Q.29Medium

What will be printed: for i in range(1, 4): print(i, end=' ')?

Q.30Medium

Consider: lst = [1, 2, 3, 2, 1]. What will lst.count(2) return?

Q.31Medium

What is the output of: print(5 == '5')?

Q.32Medium

Consider the code: x = 5; y = x; x = 10. What is the value of y?

Q.33Medium

What will be the output of: print(isinstance(5, int))?

Q.34Medium

Consider: result = [x*2 for x in range(3) if x > 0]. What is result?

Q.35Medium

What will be the result of: ' hello '.strip()?

Q.36Medium

Consider: d = {1: 'a', 2: 'b', 3: 'c'}. What is d.get(4, 'default')?

Q.37Medium

Consider: lst = [1, [2, 3], 4]. What is lst[1][0]?

Q.38Medium

What will be the output of: print('abc' * 3)?

Q.39Medium

Consider the code: x = [1, 2, 3]; y = x; y.append(4). What is x?

Q.40Medium

What will be printed: print(3 2 2)?