Python Programming - MCQ Practice Questions
Core Python MCQs — syntax, data types, OOP, libraries for placements & IT exams.
119 questions | 100% Free
What will be the output of: print(bool(0), bool(''), bool([]))
Which operator in Python performs integer division?
What is the output of: for i in range(3): print(i, end=' ')
Consider: s = 'Python'; print(s[2:5]). What will be the output?
What will be the output of: x = 10; y = 20; x, y = y, x; print(x, y)
Consider: s = 'Python'. What is s[-1]?
Which of the following will correctly check if a key exists in a dictionary?
Consider the code: def func(a, b=5): return a + b. What is func(3)?
What will be printed: for i in range(1, 4): print(i, end=' ')?
Consider: lst = [1, 2, 3, 2, 1]. What will lst.count(2) return?
What is the output of: print(5 == '5')?
Consider the code: x = 5; y = x; x = 10. What is the value of y?
What will be the output of: print(isinstance(5, int))?
Consider: result = [x*2 for x in range(3) if x > 0]. What is result?
What will be the result of: ' hello '.strip()?
Consider: d = {1: 'a', 2: 'b', 3: 'c'}. What is d.get(4, 'default')?
Consider: lst = [1, [2, 3], 4]. What is lst[1][0]?
What will be the output of: print('abc' * 3)?
Consider the code: x = [1, 2, 3]; y = x; y.append(4). What is x?
What will be printed: print(3 2 2)?