Practice high-yield Programming & Software Development MCQs on Module In Python — Part 2 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 will be the output of the following Python code? import sys eval(sys.stdin.readline()) Computer
Correct Answer: Option A — Error
Detailed Academic Explanation:
Error is the correct answer to “What will be the output of the following Python code? import sys eval(sys.stdin.readline()) Computer”. 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
What does print(os.geteuid()) print?
Correct Answer: Option B — the user id of the current process
Detailed Academic Explanation:
the user id of the current process is the correct answer to “What does print(os.geteuid()) print”. 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 will be the output of the following Python code? import random random.choice([10.4, 56.99, 76])
Correct Answer: Option B — Either 10.4, 56.99 or 76
Detailed Academic Explanation:
Either 10.4, 56.99 or 76 is the correct answer to “What will be the output of the following Python code? import random random.choice([10.4, 56.99, 76])”. 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
How can you prevent a module from executing code when imported?
Correct Answer: Option A — By using the if __name__ == "__main__": construct
Detailed Academic Explanation:
By using the if __name__ == "__main__": construct is the correct answer to “How can you prevent a module from executing code when imported”. 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 the does random.seed(3) return?
Correct Answer: Option B — None
Detailed Academic Explanation:
None is the correct answer to “What the does random.seed(3) return”. 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 will be the output of the following code: import datetime print(datetime.date.today())
Correct Answer: Option A — The current date
Detailed Academic Explanation:
The current date is the correct answer to “What will be the output of the following code: import datetime print(datetime.date.today())”. 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
Which of the statements about modules is false?
Correct Answer: Option C — In the "from-import" form of import, all identifiers regardless of whether they are private or public are imported
Detailed Academic Explanation:
In the "from-import" form of import, all identifiers regardless of whether they are private or public are imported is the correct answer to “Which of the statements about modules is false”. 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
What will be the output of the following Python code, if the sys module has already been imported? sys.stdout.write("hello world")
Correct Answer: Option C — hello world11
Detailed Academic Explanation:
hello world11 is the correct answer to “What will be the output of the following Python code, if the sys module has already been imported? sys.stdout.write("hello world")”. 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 is returned by math.modf(1.0)?
Correct Answer: Option A — (0.0, 1.0)
Detailed Academic Explanation:
(0.0, 1.0) is the correct answer to “What is returned by math.modf(1.0)”. 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
What will be the output of the following Python code? import sys eval(sys.stdin.readline()) "India"
Correct Answer: Option D — 'India'
Detailed Academic Explanation:
'India' is the correct answer to “What will be the output of the following Python code? import sys eval(sys.stdin.readline()) "India"”. 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
The output of the function len(sys.argv) is . . . . . . . .
Correct Answer: Option B — 1
Detailed Academic Explanation:
1 is the correct answer to “The output of the function len(sys.argv) is . . . . . . . .”. 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
How can you check if a module is available and can be imported in Python?
Correct Answer: Option A — By using a try...except block with an import statement
Detailed Academic Explanation:
By using a try...except block with an import statement is the correct answer to “How can you check if a module is available and can be imported 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 is the output of print(math.trunc('3.1'))?
Correct Answer: Option C — error
Detailed Academic Explanation:
error is the correct answer to “What is the output of print(math.trunc('3.1'))”. 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
. . . . . . . . is a string literal denoted by triple quotes for providing the specifications of certain program elements.
Correct Answer: Option D — Docstring
Detailed Academic Explanation:
Docstring is the correct answer to “. . . . . . . . is a string literal denoted by triple quotes for providing the specifications of certain program elements.”. 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 is the output of the following code: from random import randint print(randint(1, 10))
Correct Answer: Option A — A random integer between 1 and 10
Detailed Academic Explanation:
A random integer between 1 and 10 is the correct answer to “What is the output of the following code: from random import randint print(randint(1, 10))”. 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
What will be the output of the following Python code if the system date is: 6/19/2017 tday=datetime.date.today() tdelta=datetime.timedelta(days=10) print(tday+tdelta)
Correct Answer: Option C — 2017-06-29
Detailed Academic Explanation:
2017-06-29 is the correct answer to “What will be the output of the following Python code if the system date is: 6/19/2017 tday=datetime.date.today() tdelta=datetime.timedelta(days=10) print(tday+tdelta)”. 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
Which of the following is equivalent to random.randint(3, 6)?
Correct Answer: Option D — 3 + random.randrange(4)
Detailed Academic Explanation:
3 + random.randrange(4) is the correct answer to “Which of the following is equivalent to random.randint(3, 6)”. 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 is the interval of the value generated by the function random.random(), assuming that the random module has already been imported?
Correct Answer: Option D — [0,1)
Detailed Academic Explanation:
[0,1) is the correct answer to “What is the interval of the value generated by the function random.random(), assuming that the random module has already been imported”. 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
The following Python code will result in an error. import turtle t=turtle.Pen() t.speed(-45) t.circle(30)
Correct Answer: Option B — False
Detailed Academic Explanation:
False is the correct answer to “The following Python code will result in an error. import turtle t=turtle.Pen() t.speed(-45) t.circle(30)”. 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 code: import os print(os.getcwd())
Correct Answer: Option A — The current working directory
Detailed Academic Explanation:
The current working directory is the correct answer to “What will be the output of the following code: import os print(os.getcwd())”. 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
To include the use of functions which are present in the random library, we must use the option:
Correct Answer: Option A — import random
Detailed Academic Explanation:
import random is the correct answer to “To include the use of functions which are present in the random library, we must use the option:”. 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 is false about "from-import" form of import?
Correct Answer: Option B — This form of import prevents name clash
Detailed Academic Explanation:
This form of import prevents name clash is the correct answer to “Which of the following is false about "from-import" form of import”. 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? import datetime d=datetime.date(2017,06,18) print(d)
Correct Answer: Option A — Error
Detailed Academic Explanation:
Error is the correct answer to “What will be the output of the following Python code? import datetime d=datetime.date(2017,06,18) print(d)”. 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
Which of the following functions can accept more than one positional argument?
Correct Answer: Option A — pickle.dumps
Detailed Academic Explanation:
pickle.dumps is the correct answer to “Which of the following functions can accept more than one positional argument”. 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
The output of the functions len("abc") and sys.getsizeof("abc") will be the same.
Correct Answer: Option B — False
Detailed Academic Explanation:
False is the correct answer to “The output of the functions len("abc") and sys.getsizeof("abc") will be the same.”. This question is standard in competitive examination syllabi for Module In Python.
3, 2 is the correct answer to “The pickle module defines . . . . . . . . exceptions and exports . . . . . . . . classes.”. 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
The module . . . . . . . . is a comparatively faster implementation of the pickle module.
Correct Answer: Option A — cPickle
Detailed Academic Explanation:
cPickle is the correct answer to “The module . . . . . . . . is a comparatively faster implementation of the pickle module.”. 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
What is returned by int(math.pow(3, 2))?
Correct Answer: Option B — 9
Detailed Academic Explanation:
9 is the correct answer to “What is returned by int(math.pow(3, 2))”. 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
What will be the output of the following Python code? random.randrange(1,100,10)
Correct Answer: Option C — 91
Detailed Academic Explanation:
91 is the correct answer to “What will be the output of the following Python code? random.randrange(1,100,10)”. 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 is returned by math.isfinite(float('nan'))?
Correct Answer: Option B — False
Detailed Academic Explanation:
False is the correct answer to “What is returned by math.isfinite(float('nan'))”. 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
The command used to set only the x coordinate of the turtle at 45 units is:
Correct Answer: Option B — setx(45)
Detailed Academic Explanation:
setx(45) is the correct answer to “The command used to set only the x coordinate of the turtle at 45 units is:”. 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
Which of the following functions helps us to randomize the items of a list?
Correct Answer: Option C — shuffle
Detailed Academic Explanation:
shuffle is the correct answer to “Which of the following functions helps us to randomize the items of a list”. 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
Which of the following is false about "import modulename" form of import?
Correct Answer: Option A — The namespace of imported module becomes part of importing module
Detailed Academic Explanation:
The namespace of imported module becomes part of importing module is the correct answer to “Which of the following is false about "import modulename" form of import”. 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
Which of the following Python codes will result in an error? object = ‘a’
Correct Answer: Option C — >>> pickle.dumps(object, 3, True)
Detailed Academic Explanation:
>>> pickle.dumps(object, 3, True) is the correct answer to “Which of the following Python codes will result in an error? object = ‘a’”. 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
What does the function math.frexp(x) return?
Correct Answer: Option A — a tuple containing the mantissa and the exponent of x
Detailed Academic Explanation:
a tuple containing the mantissa and the exponent of x is the correct answer to “What does the function math.frexp(x) return”. 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 is the range of values that random.random() can return?
Correct Answer: Option D — [0.0, 1.0)
Detailed Academic Explanation:
[0.0, 1.0) is the correct answer to “What is the range of values that random.random() can return”. 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
The output of the following Python code is either 1 or 2. import random random.randint(1,2)
Correct Answer: Option A — True
Detailed Academic Explanation:
True is the correct answer to “The output of the following Python code is either 1 or 2. import random random.randint(1,2)”. 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
Which of the following functions returns a value in degrees, counterclockwise from the horizontal right?
Correct Answer: Option A — heading()
Detailed Academic Explanation:
heading() is the correct answer to “Which of the following functions returns a value in degrees, counterclockwise from the horizontal right”. 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
Program code making use of a given module is called a . . . . . . . . of the module.
Correct Answer: Option A — Client
Detailed Academic Explanation:
Client is the correct answer to “Program code making use of a given module is called a . . . . . . . . of the module.”. 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
Pick the correct statement regarding pickle and marshal modules.
Correct Answer: Option B — The pickle module keeps track of the objects that have already been sterilized whereas the marshal module does not do this
Detailed Academic Explanation:
The pickle module keeps track of the objects that have already been sterilized whereas the marshal module does not do this is the correct answer to “Pick the correct statement regarding pickle and marshal modules.”. 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.