88 / 100

## Introduction:

Python is a widely-used programming language that is easy to learn and highly versatile. It is a popular choice for beginners and experienced programmers alike, and is used in a wide range of industries, including web development, data science, and artificial intelligence. If you’re looking to improve your Python skills, practicing with multiple-choice questions can be a great way to test your knowledge and identify areas where you need to improve.

Online Mock test

Python एक व्यापक रूप से उपयोग की जाने वाली प्रोग्रामिंग भाषा है जो सीखने में आसान और अत्यधिक बहुमुखी है। यह शुरुआती और अनुभवी प्रोग्रामर के लिए समान रूप से लोकप्रिय विकल्प है, और इसका उपयोग वेब विकास, डेटा विज्ञान और कृत्रिम बुद्धि सहित उद्योगों की एक विस्तृत श्रृंखला में किया जाता है। यदि आप अपने Python कौशल में सुधार करना चाहते हैं, तो बहुविकल्पीय प्रश्नों के साथ अभ्यास करना आपके ज्ञान का परीक्षण करने और उन क्षेत्रों की पहचान करने का एक शानदार तरीका हो सकता है जहाँ आपको सुधार करने की आवश्यकता है।

इस लेख में, हम आपको शुरुआती लोगों के लिए top 50 Python MCQ questions with answers की एक सूची प्रदान करेंगे, साथ ही एक मुफ्त पीडीएफ डाउनलोड का लिंक भी प्रदान करेंगे।

## Top 50 Python MCQ Questions and Answers

### What is the output of the following code? my_list = [1, 2, 3] my_list.append(4) print(my_list)a. [1, 2, 3, 4] b. [1, 2, 3] c. [4, 3, 2, 1] d. [1, 4, 2, 3]

Answer: a. [1, 2, 3, 4]

### What is the output of the following code? x = 5 if x > 10: print(“x is greater than 10”) elif x < 10: print(“x is less than 10”) else: print(“x is equal to 10”)a. x is greater than 10 b. x is less than 10 c. x is equal to 10 d. There is a syntax error

Answer: B. X Is Less Than 10

### What is the output of the following code?x = 10 y = 5 if x > y: print(“x is greater than y”)a. x is greater than y b. y is greater than x c. x is equal to y d. There is a syntax error

Answer: A. X Is Greater Than Y

### Which of the following is NOT a valid way to create a tuple in Python?a. my_tuple = (1, 2, 3) b. my_tuple = 1, 2, 3 c. my_tuple = [1, 2, 3] d. my_tuple = tuple([1, 2, 3])

Answer: C. My_tuple = [1, 2, 3]

### Which of the following is NOT a valid way to create a dictionary in Python?a. my_dict = {1: ‘one’, 2: ‘two’, 3: ‘three’} b. my_dict = dict(one=1, two=2, three=3) c. my_dict = {(1, ‘one’), (2, ‘two’), (3, ‘three’)} d. my_dict = dict([(1, ‘one’), (2, ‘two’), (3, ‘three’)])

Answer: C. My_dict = {(1, ‘One’), (2, ‘Two’), (3, ‘Three’)}

### What is the output of the following code? for i in range(5): print(i)a. 0 1 2 3 4 b. 1 2 3 4 5 c. 0 1 2 3 4 5 d. There is a syntax error

Answer: A. 0 1 2 3 4

### What is the output of the following code? x = 10 while x > 0: print(x) x -= 1a. 1 2 3 4 5 6 7 8 9 10 b. 10 9 8 7 6 5 4 3 2 1 c. 10 d. There is a syntax error

Answer: B. 10 9 8 7 6 5 4 3 2 1

### What is the output of the following code? x = [1, 2, 3] y = x.copy() y.append(4) print(x) print(y)a. [1, 2, 3] [1, 2, 3, 4] b. [1, 2, 3] [4, 3, 2, 1] c. [4, 3, 2, 1] [1, 2, 3] d. [1, 2, 3, 4] [1, 2, 3]

Answer: A. [1, 2, 3] [1, 2, 3, 4]

### What is the output of the following code?x = 3 if x == 2: print(“x is equal to 2”) elif x == 3: print(“x is equal to 3”) else: print(“x is not equal to 2 or 3”)a. x is equal to 2 b. x is equal to 3 c. x is not equal to 2 or 3 d. There is a syntax error

Answer: B. X Is Equal To 3

### What is the output of the following code?x = [1, 2, 3] y = [4, 5, 6] z = x + y print(z)a. [1, 2, 3] [4, 5, 6] b. [1, 4, 2, 5, 3, 6] c. [4, 5, 6] [1, 2, 3] d. [1, 2, 3, 4, 5, 6]

Answer: D. [1, 2, 3, 4, 5, 6]

### What is the output of the following code? x = 5 y = 3 if x > y: print(“x is greater than y”)a. x is greater than y b. y is greater than x c. x is equal to y d. There is a syntax error

Answer: A. X Is Greater Than Y

### Which of the following is NOT a valid way to define a function in Python? a. def my_function(x, y): return x + y b. def my_function(x = 1, y = 2): return x * y c. def my_function(): return “Hello, World!” d. function my_function(x, y): return x – y

Answer: D. Function My_function(X, Y): Return X – Y

### What is the output of the following code? x = 3 y = 5 if x > y: print(“x is greater than y”) elif y > x: print(“y is greater than x”) else: print(“x and y are equal”)a. x is greater than y b. y is greater than x c. x and y are equal d. There is a syntax error

Answer: B. Y Is Greater Than X

### What is the output of the following code?x = [1, 2, 3] x.append(4) print(x)a. [1, 2, 3] b. [1, 2, 3, 4] c. [4, 3, 2, 1] d. There is a syntax error

Answer: B. [1, 2, 3, 4]

### What is the output of the following code?x = [1, 2, 3] y = x y.append(4) print(x) print(y)a. [1, 2, 3] [1, 2, 3, 4] b. [1, 2, 3] [4, 3, 2, 1] c. [4, 3, 2, 1] [1, 2, 3] d. [1, 2, 3, 4] [1, 2, 3, 4]

Answer: D. [1, 2, 3, 4] [1, 2, 3, 4]

### What is the output of the following code? my_list = [3, 6, 9, 12] result = map(lambda x: x * 2, my_list) print(list(result))a. [3, 6, 9, 12] b. [6, 12, 18, 24] c. [2, 4, 6, 8] d. There is a syntax error

Answer: B. [6, 12, 18, 24]

### What is the output of the following code? x = 3 y = 5 if x > y: print(“x is greater than y”) else: print(“x is not greater than y”)a. x is greater than y b. x is not greater than y c. y is greater than x d. There is a syntax error

Answer: B. X Is Not Greater Than Y

### What is the output of the following code? my_dict = {“name”: “John”, “age”: 30} my_dict[“age”] = 40 print(my_dict)a. {“name”: “John”, “age”: 30} b. {“name”: “John”, “age”: 40} c. {“age”: 40, “name”: “John”} d. There is a syntax error

Answer: C. {“Age”: 40, “Name”: “John”}

### What is the output of the following code? x = [“apple”, “banana”, “cherry”] y = x.copy() y.append(“orange”) print(x) print(y)a. [“apple”, “banana”, “cherry”] [“apple”, “banana”, “cherry”, “orange”] b. [“apple”, “banana”, “cherry”, “orange”] [“apple”, “banana”, “cherry”, “orange”] c. [“orange”, “apple”, “banana”, “cherry”] [“apple”, “banana”, “cherry”] d. There is a syntax error

Answer: A. [“Apple”, “Banana”, “Cherry”] [“Apple”, “Banana”, “Cherry”, “Orange”]

### What is the output of the following code? my_set = {1, 2, 3, 4} my_set.add(5) print(my_set)a. {1, 2, 3, 4} b. {1, 2, 3, 4, 5} c. {5, 4, 3, 2, 1} d. There is a syntax error

Answer: B. {1, 2, 3, 4, 5}