iGET

Python Programming - MCQ Practice Questions

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

189 questions | 100% Free

Q.1Medium

What is the time complexity of accessing an element by index in a Python list?

Q.2Medium

What will be the output of the following code? ```python d = {'a': 1, 'b': 2, 'c': 3} print(list(d.keys())) print(list(d.values())) ```

Q.3Medium

Which of the following Python data structures does NOT allow duplicate elements?

Q.4Medium

What will be the output of the following code? ```python stack = [] stack.append(10) stack.append(20) stack.append(30) stack.pop() print(stack) ```

Q.5Medium

What is the key difference between a Python list and a tuple?

Q.6Medium

What will be the output of the following code? ```python from collections import deque dq = deque([1, 2, 3]) dq.appendleft(0) dq.append(4) print(list(dq)) ```

Q.7Medium

Which of the following is the correct way to merge two dictionaries d1 and d2 in Python 3.9 and above, where d2's values take priority for common keys?

Q.8Medium

What will be the output of the following code? ```python my_set = {3, 1, 4, 1, 5, 9, 2, 6, 5} print(len(my_set)) ```

Q.9Medium

What will be the output of the following code? ```python from collections import Counter words = ['apple', 'banana', 'apple', 'cherry', 'banana', 'apple'] c = Counter(words) print(c.most_common(2)) ```

Q.10Medium

What will be the output of the following code? ```python my_list = [1, 2, 3, 4, 5] print(my_list[1:4]) print(my_list[::-1]) ```