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(10 // 3)?
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: try: int('abc'); except: print('error'). What will be printed?
What is the output of: print(*[1, 2, 3])?
Consider: f = lambda x: x**2. What is f(5)?
What will be the result of: set([1, 2, 2, 3, 3, 3])?
Consider: *a, b = [1, 2, 3]. What is a?
What is the output of: print(eval('2+3*4'))?