Practice high-yield Programming & Software Development MCQs on Module In Python — Part 1 with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.
Questions
40
Difficulty Level
Exam-Level
Target Exams
FPSC, PPSC, NTS...
Estimated Time
48 mins
Exam-Level FPSC PPSC NTS NITB PTS
Verified for Commission Syllabus • Oct 14, 2026
40
Verified Practice Questions
Interactive test mode with detailed academic worked solutions
Live Progress|0/40 answered
✓0 correct
✗0 wrong
0% score
🎉 Set complete! All 40 questions answered.
Question 1 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is a Python module?
Correct Answer: Option A — A file containing Python code that can be reused
Detailed Academic Explanation:
A file containing Python code that can be reused is the correct answer to “What is a Python module”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 2 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
How can you use a module in Python?
Correct Answer: Option B — By defining it with the module keyword
Detailed Academic Explanation:
By defining it with the module keyword is the correct answer to “How can you use a module in Python”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 3 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the import statement in Python?
Correct Answer: Option A — It allows you to use functions and objects defined in a module
Detailed Academic Explanation:
It allows you to use functions and objects defined in a module is the correct answer to “What is the purpose of the import statement in Python”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 4 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the as keyword do when used with the import statement?
Correct Answer: Option C — It imports all modules in the current directory
Detailed Academic Explanation:
It imports all modules in the current directory is the correct answer to “What does the as keyword do when used with the import statement”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 5 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following code: import math print(math.pi)
Correct Answer: Option A — The value of π (pi)
Detailed Academic Explanation:
The value of π (pi) is the correct answer to “What will be the output of the following code: import math print(math.pi)”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 6 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the from ... import ... statement in Python?
Correct Answer: Option A — It allows you to import specific objects from a module
Detailed Academic Explanation:
It allows you to import specific objects from a module is the correct answer to “What is the purpose of the from ... import ... statement in Python”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 7 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is a namespace in Python?
Correct Answer: Option A — A container for holding identifiers (names)
Detailed Academic Explanation:
A container for holding identifiers (names) is the correct answer to “What is a namespace in Python”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 8 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
How can you access a function my_function from a module my_module in Python?
Correct Answer: Option D — By using function.my_module()
Detailed Academic Explanation:
By using function.my_module() is the correct answer to “How can you access a function my_function from a module my_module in Python”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 9 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following code: from math import sqrt print(sqrt(16))
Correct Answer: Option C — 16
Detailed Academic Explanation:
16 is the correct answer to “What will be the output of the following code: from math import sqrt print(sqrt(16))”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 10 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
How can you reload a module in Python?
Correct Answer: Option B — By using the reload keyword
Detailed Academic Explanation:
By using the reload keyword is the correct answer to “How can you reload a module in Python”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 11 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the __init__.py file in a Python module?
Correct Answer: Option A — It indicates that the directory should be treated as a Python package
Detailed Academic Explanation:
It indicates that the directory should be treated as a Python package is the correct answer to “What is the purpose of the __init__.py file in a Python module”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 12 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the sys.path list in Python?
Correct Answer: Option A — It contains a list of directories where Python looks for modules
Detailed Academic Explanation:
It contains a list of directories where Python looks for modules is the correct answer to “What is the purpose of the sys.path list in Python”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 13 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does os.link() do?
Correct Answer: Option B — create a hard link
Detailed Academic Explanation:
create a hard link is the correct answer to “What does os.link() do”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 14 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python code? import turtle t=turtle.Pen() t.resizemode(“examveda”) t.resizemode()
Correct Answer: Option B — auto
Detailed Academic Explanation:
auto is the correct answer to “What will be the output of the following Python code? import turtle t=turtle.Pen() t.resizemode(“examveda”) t.resizemode()”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 15 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output if we try to extract only the year from the following Python code? (time.struct_time(tm_year=2017, tm_mon=6, tm_mday=25, tm_hour=18, tm_min=26, tm_sec=6, tm_wday=6, tm_yday=176, tm_isdst=0)) import time t=time.localtime() print(t)
Correct Answer: Option C — t[0]
Detailed Academic Explanation:
t[0] is the correct answer to “What will be the output if we try to extract only the year from the following Python code? (time.struct_time(tm_year=2017, tm_mon=6, tm_mday=25, tm_hour=18, tm_min=26, tm_sec=6, tm_wday=6, tm_yday=176, tm_isdst=0)) import time t=time.localtime() print(t)”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 16 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following can be used to create a directory?
Correct Answer: Option A — os.mkdir()
Detailed Academic Explanation:
os.mkdir() is the correct answer to “Which of the following can be used to create a directory”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 17 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is returned by math.isfinite(float('inf'))?
Correct Answer: Option B — False
Detailed Academic Explanation:
False is the correct answer to “What is returned by math.isfinite(float('inf'))”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 18 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python function, assuming that the random module has already been imported? random.uniform(3,4)
Correct Answer: Option D — Any decimal value between 3 and 4
Detailed Academic Explanation:
Any decimal value between 3 and 4 is the correct answer to “What will be the output of the following Python function, assuming that the random module has already been imported? random.uniform(3,4)”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 19 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
How can you determine the path of the currently executing script in Python?
Correct Answer: Option A — By using the os.path module
Detailed Academic Explanation:
By using the os.path module is the correct answer to “How can you determine the path of the currently executing script in Python”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 20 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python code? import time t=(2010, 9, 20, 8, 45, 12, 6, 0, 0) time.asctime(t)
Correct Answer: Option B — 'Sun Sep 20 08:45:12 2010'
Detailed Academic Explanation:
'Sun Sep 20 08:45:12 2010' is the correct answer to “What will be the output of the following Python code? import time t=(2010, 9, 20, 8, 45, 12, 6, 0, 0) time.asctime(t)”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 21 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Lambda functions cannot be pickled because:
Correct Answer: Option D — All lambda functions have the same name, that is,
Detailed Academic Explanation:
All lambda functions have the same name, that is, is the correct answer to “Lambda functions cannot be pickled because:”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 22 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following will not be returned by random.choice("1 ,")?
Correct Answer: Option D — none of the mentioned
Detailed Academic Explanation:
none of the mentioned is the correct answer to “Which of the following will not be returned by random.choice("1 ,")”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 23 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python code if the system date is 18th June, 2017 (Sunday)? tday=datetime.date.today() print(tday.weekday())
Correct Answer: Option A — 6
Detailed Academic Explanation:
6 is the correct answer to “What will be the output of the following Python code if the system date is 18th June, 2017 (Sunday)? tday=datetime.date.today() print(tday.weekday())”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 24 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python code? import time time.asctime()
Correct Answer: Option C — Current date and time
Detailed Academic Explanation:
Current date and time is the correct answer to “What will be the output of the following Python code? import time time.asctime()”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 25 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following is not an advantage of using modules?
Correct Answer: Option C — Provides a means of reducing the size of the program
Detailed Academic Explanation:
Provides a means of reducing the size of the program is the correct answer to “Which of the following is not an advantage of using modules”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 26 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The function used to alter the thickness of the pen to 'x' units:
Correct Answer: Option A — turtle.width(x)
Detailed Academic Explanation:
turtle.width(x) is the correct answer to “The function used to alter the thickness of the pen to 'x' units:”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 27 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python code? import turtle() t=turtle.Pen() t.goto(50,60) t1=t.clone() t1.ycor()
Correct Answer: Option C — 60.0
Detailed Academic Explanation:
60.0 is the correct answer to “What will be the output of the following Python code? import turtle() t=turtle.Pen() t.goto(50,60) t1=t.clone() t1.ycor()”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 28 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following functions raises an error when an unpicklable object is encountered by Pickler?
Correct Answer: Option B — pickle.PicklingError
Detailed Academic Explanation:
pickle.PicklingError is the correct answer to “Which of the following functions raises an error when an unpicklable object is encountered by Pickler”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 29 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The number of lines drawn in each case, assuming that the turtle module has been imported: Case 1: for i in range(0,10): turtle.forward(100) turtle.left(90) Case 2: for i in range(1,10): turtle.forward(100) turtle.left(90)
Correct Answer: Option A — 10, 9
Detailed Academic Explanation:
10, 9 is the correct answer to “The number of lines drawn in each case, assuming that the turtle module has been imported: Case 1: for i in range(0,10): turtle.forward(100) turtle.left(90) Case 2: for i in range(1,10): turtle.forward(100) turtle.left(90)”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 30 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does os.getlogin() return?
Correct Answer: Option A — name of the current user logged in
Detailed Academic Explanation:
name of the current user logged in is the correct answer to “What does os.getlogin() return”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 31 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following can be used to create a symbolic link?
Correct Answer: Option A — os.symlink()
Detailed Academic Explanation:
os.symlink() is the correct answer to “Which of the following can be used to create a symbolic link”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 32 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python code? import turtle t=turtle.Pen() t.color(0,1,0) t.begin_fill() for i in range(0,4): t.forward(100) t.right(90)
Correct Answer: Option C — Blank canvas
Detailed Academic Explanation:
Blank canvas is the correct answer to “What will be the output of the following Python code? import turtle t=turtle.Pen() t.color(0,1,0) t.begin_fill() for i in range(0,4): t.forward(100) t.right(90)”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 33 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In top-down design every module is broken into same number of submodules.
Correct Answer: Option B — False
Detailed Academic Explanation:
False is the correct answer to “In top-down design every module is broken into same number of submodules.”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 34 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the value returned by math.floor(3.4)?
Correct Answer: Option A — 3
Detailed Academic Explanation:
3 is the correct answer to “What is the value returned by math.floor(3.4)”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 35 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
To obtain a list of all the functions defined under sys module, which of the following functions can be used?
Correct Answer: Option D — print(dir(sys))
Detailed Academic Explanation:
print(dir(sys)) is the correct answer to “To obtain a list of all the functions defined under sys module, which of the following functions can be used”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 36 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python function if the random module has already been imported? random.randint(3.5,7)
Correct Answer: Option A — Error
Detailed Academic Explanation:
Error is the correct answer to “What will be the output of the following Python function if the random module has already been imported? random.randint(3.5,7)”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 37 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Is the output of the function abs() the same as that of the function math.fabs()?
Correct Answer: Option A — sometimes
Detailed Academic Explanation:
sometimes is the correct answer to “Is the output of the function abs() the same as that of the function math.fabs()”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 38 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the value returned by math.fact(6)?
Correct Answer: Option D — error
Detailed Academic Explanation:
error is the correct answer to “What is the value returned by math.fact(6)”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 39 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python code? print(math.isinf(float('-inf')))
Correct Answer: Option C — True
Detailed Academic Explanation:
True is the correct answer to “What will be the output of the following Python code? print(math.isinf(float('-inf')))”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
Question 40 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python code? random.randrange(0,91,5)
Correct Answer: Option A — 10
Detailed Academic Explanation:
10 is the correct answer to “What will be the output of the following Python code? random.randrange(0,91,5)”. This question is standard in competitive examination syllabi for Module In Python.
💡Key Conceptual Anchor:Module In Python
✓Link copied to clipboard
Continue Your Practice
Advance Html — Part 1
Master the next curriculum module with 40 exam-standard MCQs.
💡Examiner's Advisory for Programming & Software Development
In competitive commission exams (FPSC, PPSC, KPPSC, SPSC, CSS, PMS), questions are frequently phrased with distractor options designed to catch rote learners. Whenever you answer an MCQ, read the Detailed Academic Explanation and Conceptual Anchor to understand why the remaining options are incorrect.