11 Sep 100 Python MCQ (Multiple Choice Questions) with Answers
Show Answer
2) Who created the Python programming language?
Show Answer
3) Which of the following is the correct syntax to output “Hello World” in Python?
Show Answer
4) How do you insert comments in Python code?
Show Answer
5) Which data type is immutable in Python?
Show Answer
6) What is the result of 3 ** 2 in Python?
Show Answer
7) Which keyword is used to define a function in Python?
Show Answer
8) Which of the following operators performs integer division in Python?
Show Answer
9) What is the output of len([10, 20, 30])?
Show Answer
10) How do you create a variable with the numeric value 5?
Show Answer
11) Which collection is ordered, changeable, and allows duplicate members?
Show Answer
12) Which collection is unordered, unchangeable, and unindexed?
Show Answer
13) What function is used to convert a value into an integer?
Show Answer
14) What will type(3.14) return?
Show Answer
15) How do you start a for loop in Python?
Show Answer
16) Which method is used to remove whitespace from both the beginning and end of a string?
Show Answer
17) What keyword is used to raise an exception in Python?
Show Answer
18) What is the correct syntax for an if statement in Python?
Show Answer
19) Which operator is used to check if two values are equal?
Show Answer
20) What is the output of bool(“”)?
Show Answer
21) Which method adds an item to the end of a list?
Show Answer
22) How do you access the value associated with the key “age” in dictionary d?
Show Answer
23) What statement is used to exit a loop prematurely?
Show Answer
24) Which built-in function returns a range of numbers?
Show Answer
25) What is the logical operator for logical AND in Python?
Show Answer
26) Which symbol is used to pass variable-length positional arguments to a function?
Show Answer
27) Which keyword is used to create a class in Python?
Show Answer
28) What will 2 + 3 * 4 evaluate to?
Show Answer
29) What is the output of “python”[1:4]?
Show Answer
30) How do you create an empty dictionary in Python?
Show Answer
31) What keyword handles exceptions in Python?
Show Answer
32) Which built-in function returns the highest value in a list?
Show Answer
33) What is the output of type([])?
Show Answer
34) What keyword is used to import a module in Python?
Show Answer
35) What is the default return value of a function that doesn’t explicitly return anything?
Show Answer
36) Which method converts a string to all uppercase letters?
Show Answer
37) How do you remove an item at a specific index from a list?
Show Answer
38) What does PIP stand for in Python?
Show Answer
39) Which operator is used for exponentiation?
Show Answer
40) What is the output of bool(0)?
Show Answer
41) Which statement skips the current iteration of a loop and continues with the next?
Show Answer
42) What function returns the absolute value of a number?
Show Answer
43) Which special variable represents the class instance in class methods?
Show Answer
44) What is the output of “hello”.find(“l”)?
Show Answer
45) Which data structure stores keys and values?
Show Answer
46) How do you create an anonymous or inline function in Python?
Show Answer
47) What method removes all items from a dictionary?
Show Answer
48) What is the output of 10 % 3?
Show Answer
49) Which method converts a list of strings into a single string separated by a delimiter?
Show Answer
50) What is the result of str(123)?
Show Answer
51) How do you open a file named “test.txt” for reading in Python?
Show Answer
52) What method splits a string into a list of substrings?
Show Answer
53) Which keyword is used to test if a sequence contains a specific item?
Show Answer
54) What is the output of list(range(3))?
Show Answer
55) Which error occurs when a variable is used before it is defined?
Show Answer
56) What does “is” operator evaluate?
Show Answer
57) What is the output of “a” + “b”?
Show Answer
58) How do you get the last item of a list lst?
Show Answer
59) Which block is always executed whether an exception occurs or not?
Show Answer
60) What keyword creates a generator function?
Show Answer
61) What is the output of min([5, 2, 8, 1])?
Show Answer
62) Which method adds all elements of an iterable to a list?
Show Answer
63) What will set([1, 2, 2, 3]) yield?
Show Answer
64) Which module in Python provides tools for working with regular expressions?
Show Answer
65) What is the correct syntax for a list comprehension that doubles each element in nums?
Show Answer
66) What function returns the length of an object?
Show Answer
67) What is the output of bool(None)?
Show Answer
68) How do you convert a string to lowercase?
Show Answer
69) Which method reverses a list in place?
Show Answer
70) What is the result of “Python”[::-1]?
Show Answer
71) Which operator is used for bitwise AND?
Show Answer
72) What built-in module gives access to math functions like sqrt and sin?
Show Answer
73) What is the primary constructor method for a Python class?
Show Answer
74) What is the result of float(5)?
Show Answer
75) What does the pass statement do?
Show Answer
76) How do you pass keyword-based variable arguments to a function?
Show Answer
77) What exception is raised when dividing by zero?
Show Answer
78) Which built-in function pairs elements from two or more iterables?
Show Answer
79) What will all([True, True, False]) evaluate to?
Show Answer
80) What will any([False, True, False]) evaluate to?
Show Answer
81) What is the output of 3 == 3.0?
Show Answer
82) How do you delete a variable in Python?
Show Answer
83) Which statement opens a file and automatically closes it when finished?
Show Answer
84) What is the output of “Hello, World!”.startswith(“Hello”)?
Show Answer
85) What does isinstance(5, int) return?
Show Answer
86) What is the value of x after x = 10; x += 5?
Show Answer
87) How do you copy a list lst without modifying the original?
Show Answer
88) What method inserts an element at a specific index in a list?
Show Answer
89) What module provides access to command-line arguments?
Show Answer
90) What is the output of “Py” * 3?
Show Answer
91) Which error occurs when a key is not found in a dictionary?
Show Answer
92) What function takes a function and an iterable and applies the function to all items?
Show Answer
93) What function filters elements from an iterable based on a condition function?
Show Answer
94) What is the output of round(3.57, 1)?
Show Answer
95) Which method returns a dictionary’s keys as a view object?
Show Answer
96) What is the output of bool([0])?
Show Answer
97) How do you import only the pi constant from the math module?
Show Answer
98) What built-in method converts a list to a tuple?
Show Answer
99) What does the enumerate() function return?
Show Answer
100) What is the output of sum([1, 2, 3, 4])?
Show Answer
No Comments