Python MCQ Questions with Answers pdf free download

Table of Contents
Are you ready to test your Python skills? Look no further! Our free Python MCQ questions and answers PDF download is the ultimate tool to ace your coding interview. With over 1000+ questions, you’ll be a Python pro in no time. Download now!
Python MCQ Questions With Answers
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.
In this article, we’ll provide you with a list of the top 50 Python MCQ questions with answers for beginners, along with a link to a free PDF download.
Python एक व्यापक रूप से उपयोग की जाने वाली प्रोग्रामिंग भाषा है जो सीखने में आसान और अत्यधिक बहुमुखी है। यह शुरुआती और अनुभवी प्रोग्रामर के लिए समान रूप से लोकप्रिय विकल्प है, और इसका उपयोग वेब विकास, डेटा विज्ञान और कृत्रिम बुद्धि सहित उद्योगों की एक विस्तृत श्रृंखला में किया जाता है। यदि आप अपने Python कौशल में सुधार करना चाहते हैं, तो बहुविकल्पीय प्रश्नों के साथ अभ्यास करना आपके ज्ञान का परीक्षण करने और उन क्षेत्रों की पहचान करने का एक शानदार तरीका हो सकता है जहाँ आपको सुधार करने की आवश्यकता है।
इस लेख में, हम आपको शुरुआती लोगों के लिए top 50 Python MCQ questions with answers की एक सूची प्रदान करेंगे, साथ ही एक मुफ्त पीडीएफ डाउनलोड का लिंक भी प्रदान करेंगे।
Python MCQ Questions and Answers PDF Free Download 2023: Boost Your Python Knowledge Today!
Top 50 Python MCQ Questions and Answers
Which keyword is used to create a function in Python?
a. def
b. function
c. create
d. return
Answer: A. Def
What is the output of the following code? print(2 + 3 * 5 – 1 / 2)
a. 16.5
b. 16.0
c. 17.5
d. 17.0
Answer: c. 17.5
Which of the following is NOT a valid data type in Python? a. int
b. float
c. complex
d. double
Answer: D. Double
What is the output of the following code?
print(“Hello ” + “world!”)
a. Hello
b. world!
c. Hello world!
d. Hello + world!
Answer: c. Hello world!
Which keyword is used to break out of a loop in Python?
a. break
b. exit
c. continue
d. stop
Answer: A. Break
What is the output of the following code? print(len(“Python”))
a. 6
b. 5
c. 4
d. 3
Answer: a. 6
Which of the following is NOT a comparison operator in Python?
a. ==
b. !=
c. <=
d. ><
Answer: D. ><
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]
Which of the following is NOT a logical operator in Python? a. and
b. or
c. not
d. xor
Answer: D. Xor
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
Which of the following is NOT a valid way to declare a variable in Python?
a. x = 5
b. 5 = x
c. x = “hello”
d. x = [1, 2, 3]
Answer: B. 5 = X
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 keyword is used to specify a superclass in Python?
a. super
b. base
c. parent
d. inherit
Answer: A. Super
What is the output of the following code?
x = “hello”
print(x.upper())
a. hello
b. Hello
c. HELLO
d. hElLo
Answer: C. HELLO
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]
What is the output of the following code?
x = 2
y = 3
z = x ** y
print(z)
a. 5
b. 6
c. 8
d. 9
Answer: C. 8
Which keyword is used to specify a module in Python?
a. import
b. require
c. include
d. use
Answer: A. Import
What is the output of the following code? my_list = [1, 2, 3] my_list.remove(2) print(my_list)
a. [1, 2, 3]
b. [1, 3]
c. [2, 3]
d. [1, 2]
Answer: B. [1, 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
Which of the following is NOT a valid way to open a file in Python?
a. open(“file.txt”, “r”)
b. open(“file.txt”, “w”)
c. open(“file.txt”, “x”)
d. open(“file.txt”, “a”)
Answer: C. Open(“File.Txt”, “X”)
What is the output of the following code?
x = 10 while x > 0: print(x) x -= 1
a. 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
Which keyword is used to raise an exception in Python?
a. raise
b. throw
c. except
d. try
Answer: A. Raise
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? def my_function(x, y): return x * y
result = my_function(3, 4)
print(result)
a. 12
b. 7
c. 0
d. There is a syntax error
Answer: A. 12
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
Which of the following is NOT a valid type of loop in Python?
a. for loop
b. while loop
c. until loop
d. do-while loop
Answer: C. Until Loop
What is the output of the following code?
my_string = “Hello, World!”
print(my_string[7])
a. H
b. W
c. ,
d. There is a syntax error
Answer: C. ,
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?
my_list = [1, 2, 3, 4, 5]
result = filter(lambda x: x % 2 == 0, my_list) print(list(result))
a. [1, 3, 5]
b. [2, 4]
c. [1, 2, 3, 4, 5]
d. There is a syntax error
Answer: B. [2, 4]
What is the output of the following code?
x = 3
y = 5
z = x + y
print(z)
a. 8
b. 15
c. 2
d. There is a syntax error
Answer: A. 8
What is the output of the following code?
my_tuple = (“apple”, “banana”, “cherry”)
print(len(my_tuple))
a. 3
b. 5
c. 6
d. There is a syntax error
Answer: A. 3
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 = 5
y = “Hello”
z = str(x) + y
print(z)
a. 5Hello
b. Hello5
c. 10
d. There is a syntax error
Answer: A. 5Hello
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?
x = 5 y = 3 z = x – y
print(z)
a. 2
b. 8
c. 15
d. There is a syntax error
Answer: A. 2
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 = “Hello, World!”
print(x[7:12])
a. Hello
b. World
c. , Wor
d. There is a syntax error
Answer: B. World
What is the output of the following code?
x = [“apple”, “banana”, “cherry”]
x.pop(1)
print(x)
a. [“apple”, “banana”, “cherry”]
b. [“apple”, “cherry”]
c. [“banana”, “cherry”]
d. There is a syntax error
Answer: B. [“Apple”, “Cherry”]
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?
x = “Hello” y = “world”
z = x + ” ” + y
print(z)
a. Hello world
b. HelloWorld
c. Helloworld
d. There is a syntax error
Answer: A. Hello World
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 = 3 y = 5 z = x * y
print(z)
a. 15
b. 8
c. 3
d. There is a syntax error
Answer: A. 15
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}
What is the output of the following code?
def my_func(x): return x + 2
result = my_func(3)
print(result)
a. 3
b. 5
c. 6
d. There is a syntax error
Answer: B. 5
What is the output of the following code?
x = [2, 4, 6, 8]
y = [n * 2 for n in x if n > 4]
print(y)
a. [8, 12, 16]
b. [2, 4, 6, 8]
c. [12, 16]
d. There is a syntax error
Answer: C. [12, 16]
Python MCQ Questions With Answers Python MCQ Questions With Answers Python MCQ Questions With Answers Python MCQ Questions With Answers Python MCQ Questions With Answers Python MCQ Questions With Answers Python MCQ Questions With Answers Python MCQ Questions With Answers Python MCQ Questions With Answers Python MCQ Questions With Answers Python MCQ Questions With Answers Python MCQ Questions With Answers
Python MCQ Questions With Answers Python MCQ Questions With Answers Python MCQ Questions With Answers Python MCQ Questions With Answers Python MCQ Questions With Answers Python MCQ Questions With Answers Python MCQ Questions With Answers Python MCQ Questions With Answers Python MCQ Questions With Answers Python MCQ Questions With Answers Python MCQ Questions With Answers Python MCQ Questions With Answers Python MCQ Questions With Answers