Subjectwise MCQ
Statewise Prepration
Govt. Examwise MCQ
128 Python MCQ Questions in english हिन्दी
High-level, all-purpose Python is a very well-liked programming language. The most recent version of the Python programming language, Python 3, is utilised for cutting-edge software development projects like web development and machine learning applications. Python is a very good programming language for beginners, as well as for seasoned programmers with experience in other programming languages like C++ and Java.
Select the correct Python tuple?
What are the two main types of functions in Python?
What will be the output of the following Python code? x = 'abcd' for i in range(len(x)): print(i)
What will the following snippet of code produce?
def is_even(number):
message = f"{number} is an even number" if number % 2 == 0 else f"{number} is an odd number"
return message
print(is_even(54))
What will the following snippet of code produce?
numbers = (4, 7, 19, 2, 89, 45, 72, 22)
sorted_numbers = sorted(numbers)
odd_numbers = [x for x in sorted_numbers if x % 2 != 0]
print(odd_numbers)
What will the following snippet of code produce?
numbers = (4, 7, 19, 2, 89, 45, 72, 22)
sorted_numbers = sorted(numbers)
even = lambda a: a % 2 == 0
even_numbers = filter(even, sorted_numbers)
print(type(even_numbers))
What kind of data will the variable sorted numbers in the code below contain?
numbers = (4, 7, 19, 2, 89, 45, 72, 22)
sorted_numbers = sorted(numbers)
print(sorted_numbers)
What will the following snippet of code produce?
example = ["Sunday", "Monday", "Tuesday", "Wednesday"];
del example[2]
print(example)
What will the following snippet of code produce?
a = [1, 2]
print(a * 3)
What will the output of the following code snippet be?
example = ["Sunday", "Monday", "Tuesday", "Wednesday"];
print(example[-3:-1])
What will the following code snippet produce?
def check(a):
print("Even" if a % 2 == 0 else "Odd")
check(12)
What will the following snippet of code produce?
def thrive(n):
if n % 15 == 0:
print("thrive", end = “ ”)
elif n % 3 != 0 and n % 5 != 0:
print("neither", end = “ ”)
elif n % 3 == 0:
print("three", end = “ ”)
elif n % 5 == 0:
print("five", end = “ ”)
thrive(35)
thrive(56)
thrive(15)
thrive(39)
Which of the following would be the correct syntax to use to determine whether a specific element is present in a list?
Which of the following kinds of loops Python does not support?
What will the following snippet of code produce?
a = 3
b = 1
print(a, b)
a, b = b, a
print(a, b)
Which of the following sentences is used in Python's Exception Handling?
What will the following snippet of code produce?
def func():
global value
value = "Local"
value = "Global"
func()
print(value)
What will the following snippet of code produce?
def solve(a):
a = [1, 3, 5]
a = [2, 4, 6]
print(a)
solve(a)
print(a)
What will the following snippet of code produce?
def solve(a, b):
return b if a == 0 else solve(b % a, a)
print(solve(20, 50))
Which of the following concepts is not a part of Python?
What will the following snippet of code produce?
count = 0
while(True):
if count % 3 == 0:
print(count, end = " ")
if(count > 15):
break;
count += 1
What will the following code snippet produce?
a = [1, 2, 3, 4, 5]
sum = 0
for ele in a:
sum += ele
print(sum)
What will the following snippet of code produce?
print(type(5 / 2))
print(type(5 // 2))
What will the following snippet of code produce?
a = [1, 2, 3]
a = tuple(a)
a[0] = 2
print(a)
What will the following snippet of code produce?
print(2**3 + (5 + 6)**(1 + 1))
How is a code block indicated in Python?
What datatype will the var in the code snippet below be?
var = 10
print(type(var))
var = "Hello"
print(type(var))
What's a Python identifier's maximum length?