Welcome to your Python MCQs
1) Which of the following is the correct extension for Python files?
3) Which function is used to output data in Python?
4) Which data type is immutable in Python?
5) What is the correct syntax for defining a function in Python?
6) Which operator is used to check for equality in Python?
7) How do you start a comment in Python?
8) Which of the following is a valid variable name in Python?
9) What is the output of print(type([]))?
10) Which keyword is used for exception handling in Python?
11) What is the output of 3 ** 2?
12) What is the correct way to create a dictionary in Python?
13) Which keyword is used to create a class in Python?
14) What is the output of bool(0) in Python?
15) Which of the following functions checks if all elements in an iterable are true?
16) Which module in Python supports regular expressions?
17) What is the output of "Hello"[1:4]?
18) Which statement is used to stop a loop in Python?
19) What is the output of len("Hello World")?
20) Which of the following methods is used to find the index of an element in a list?
21) Which operator is used for floor division in Python?
22) Which keyword is used to check if an element is present in a list?
23) How do you create a set in Python?
24) What is the default value of a function parameter if not specified in Python?
25) Which of the following is a mutable data type in Python?
26) Which of the following is not a keyword in Python?
27) What does pip stand for in Python?
28) How do you remove an element from a list by index in Python?
29) Which of the following will raise an error in Python?
30) What is the result of 3 * "Hello"?
31) Which method can be used to convert a string to lowercase in Python?
32) What is the output of len([1, 2, [3, 4]])?
33) What is the purpose of the is keyword in Python?
34) Which of the following will return False?
35) What is the output of 10 // 3?
36) Which of the following is a valid tuple?
37) What is the result of 10 % 3?
38) What is the correct way to create a class in Python?
39) Which of the following is a correct way to import a module in Python?
40) How do you open a file in Python for reading?
41) Which method can be used to remove whitespace from both ends of a string?
42) What is the output of min([2, 3, 1, 4])?
43) Which of the following is a Python boolean?
44) Which method is used to find the length of a list?
45) What is the output of 5 < 3 in Python?
46) How can you create an infinite loop in Python?
47) Which of the following is used to create a comment in Python?
48) How can you convert a string into an integer in Python?
49) What is the output of print("Hello " * 3)?
50) Which of the following is used to generate random numbers in Python?