B.S. (DS) Python T4
B.S. (DS) Python T4
A. ==
B. =
C. :=
D. =>
✅ Correct Answer: B
MODULE-2
14. Which module is used to work with date and time in Python?
A. datetime
B. calendar
C. os
D. time
✅ Correct Answer: A
15. Which of the following is a correct way to import only the sqrt function from the math module?
A. import math.sqrt
B. from math import sqrt
C. include math.sqrt
D. use math.sqrt()
✅ Correct Answer: B
20. Which of the following modules is used for basic graphics in Python?
A. turtle
B. graphics
C. os
D. draw
✅ Correct Answer: A
Let me know if you want these as a formatted PDF or as a printable version, or if you'd like a set of more
advanced MCQs.
2/2
You said:
more mcq
A network error occurred. Please check your connection and try again. If this issue persists please contact us
through our help center at help.openai.com.
ChatGPT said:
Sure! Here's another set of MCQs based on your Python Programming Syllabus (MODULE-1 and
MODULE-2):
✅ MODULE-1
UNIT-1: INTRODUCTION
2/2
You said:
Great! Here's Part 2 of the Python Programming MCQs, continuing from the syllabus you provided. You
already have 20 questions. Below are Questions 21 to 50, completing the set of 50 MCQs from Module 1 & 2
of your syllabus.
📘 MCQs 21 to 50
31. What is the correct syntax for list comprehension to create a list of squares from 1 to 5?
A. [x^2 for x in range(1,6)]
B. [x**2 for x in range(1,6)]
C. (x**2 for x in range(1,6))
D. {x**2 for x in range(1,6)}
✅ Correct Answer: B
python
CopyEdit
def add(a, b=2):
return a + b
print(add(3))
```**
A. 2
B. 3
C. 5
D. Error
✅ **Correct Answer: C**
---
---
---
**36. What is the scope of a variable defined inside a function but outside any loop or
conditional block?**
A. Local
B. Global
C. Static
D. Class
✅ **Correct Answer: A**
---
---
---
---
**40. Which method is used to read the entire content of a file at once?**
A. `readfile()`
B. `read()`
C. `readline()`
D. `readlines()`
✅ **Correct Answer: B**
---
---
---
---
---
---
**46. Which keyword is used to raise a custom exception in Python?**
A. `throw`
B. `except`
C. `raise`
D. `error`
✅ **Correct Answer: C**
---
---
---
---
**50. Which of the following modules is useful for image processing in Python?**
A. `PIL`
B. `turtle`
C. `math`
D. `numpy`
✅ **Correct Answer: A**