Here Are 50 Multiple-Choice Questions (Mcqs) Related To
PYTHON PROGRAMMING
Along With Their Correct Answers:
1. What is Python primarily known for?
A) Web development
B) Data analysis
C) Game development
D) Hardware programming
**Answer: B**
2. Which keyword is used to define a function in Python?
A) method
B) def
C) function
D) define
**Answer: B**
3. What is the output of the following code?
print(2 + 3 * 5) ```
A) 15
B) 25
, C) 17
D) 13
**Answer: C**
4. Which data structure stores values in key-value pairs?
A) List
B) Tuple
C) Dictionary
D) Set
**Answer: C**
5. In Python, which statement is used to exit a loop prematurely?
A) break
B) stop
C) exit
D) continue
**Answer: A**
6. What does the `len()` function return?
A) Total memory used by an object
B) Number of elements in a list
C) Number of characters in a string
, D) Index of the last element in a list
**Answer: B**
7. Which module is used to work with dates and times in Python?
A) datetime
B) timeutils
C) datetimeutils
D) pytime
**Answer: A**
8. What is the output of the following code?
x = [1, 2, 3]
y=x
y.append(4)
print(x)
A) [1, 2, 3, 4]
B) [1, 2, 3]
C) [4]
D) Error
**Answer: A**
9. What is the purpose of the `__init__` method in a Python class?
PYTHON PROGRAMMING
Along With Their Correct Answers:
1. What is Python primarily known for?
A) Web development
B) Data analysis
C) Game development
D) Hardware programming
**Answer: B**
2. Which keyword is used to define a function in Python?
A) method
B) def
C) function
D) define
**Answer: B**
3. What is the output of the following code?
print(2 + 3 * 5) ```
A) 15
B) 25
, C) 17
D) 13
**Answer: C**
4. Which data structure stores values in key-value pairs?
A) List
B) Tuple
C) Dictionary
D) Set
**Answer: C**
5. In Python, which statement is used to exit a loop prematurely?
A) break
B) stop
C) exit
D) continue
**Answer: A**
6. What does the `len()` function return?
A) Total memory used by an object
B) Number of elements in a list
C) Number of characters in a string
, D) Index of the last element in a list
**Answer: B**
7. Which module is used to work with dates and times in Python?
A) datetime
B) timeutils
C) datetimeutils
D) pytime
**Answer: A**
8. What is the output of the following code?
x = [1, 2, 3]
y=x
y.append(4)
print(x)
A) [1, 2, 3, 4]
B) [1, 2, 3]
C) [4]
D) Error
**Answer: A**
9. What is the purpose of the `__init__` method in a Python class?