Skip to main content

Module In Python — Part 2 MCQs with Explanations

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
Question 1 of 40
★ FPSC ★ PPSC

What will be the output of the following Python code? import sys eval(sys.stdin.readline()) Computer

Question 2 of 40
★ FPSC ★ PPSC

What does print(os.geteuid()) print?

Question 3 of 40
★ FPSC ★ PPSC

What will be the output of the following Python code? import random random.choice([10.4, 56.99, 76])

Question 4 of 40
★ FPSC ★ PPSC

How can you prevent a module from executing code when imported?

Question 5 of 40
★ FPSC ★ PPSC

What the does random.seed(3) return?

Question 6 of 40
★ FPSC ★ PPSC

What will be the output of the following code: import datetime print(datetime.date.today())

Question 7 of 40
★ FPSC ★ PPSC

Which of the statements about modules is false?

Question 8 of 40
★ 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")

Question 9 of 40
★ FPSC ★ PPSC

What is returned by math.modf(1.0)?

Question 10 of 40
★ FPSC ★ PPSC

What will be the output of the following Python code? import sys eval(sys.stdin.readline()) "India"

Question 11 of 40
★ FPSC ★ PPSC

The output of the function len(sys.argv) is . . . . . . . .

Question 12 of 40
★ FPSC ★ PPSC

How can you check if a module is available and can be imported in Python?

Question 13 of 40
★ FPSC ★ PPSC

What is the output of print(math.trunc('3.1'))?

Question 14 of 40
★ FPSC ★ PPSC

. . . . . . . . is a string literal denoted by triple quotes for providing the specifications of certain program elements.

Question 15 of 40
★ FPSC ★ PPSC

What is the output of the following code: from random import randint print(randint(1, 10))

Question 16 of 40
★ 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)

Question 17 of 40
★ FPSC ★ PPSC

Which of the following is equivalent to random.randint(3, 6)?

Question 18 of 40
★ FPSC ★ PPSC

What is the interval of the value generated by the function random.random(), assuming that the random module has already been imported?

Question 19 of 40
★ FPSC ★ PPSC

The following Python code will result in an error. import turtle t=turtle.Pen() t.speed(-45) t.circle(30)

Question 20 of 40
★ FPSC ★ PPSC

What will be the output of the following code: import os print(os.getcwd())

Question 21 of 40
★ FPSC ★ PPSC

To include the use of functions which are present in the random library, we must use the option:

Question 22 of 40
★ FPSC ★ PPSC

Which of the following is false about "from-import" form of import?

Question 23 of 40
★ FPSC ★ PPSC

What will be the output of the following Python code? import datetime d=datetime.date(2017,06,18) print(d)

Question 24 of 40
★ FPSC ★ PPSC

Which of the following functions can accept more than one positional argument?

Question 25 of 40
★ FPSC ★ PPSC

The output of the functions len("abc") and sys.getsizeof("abc") will be the same.

Question 26 of 40
★ FPSC ★ PPSC

The pickle module defines . . . . . . . . exceptions and exports . . . . . . . . classes.

Question 27 of 40
★ FPSC ★ PPSC

The module . . . . . . . . is a comparatively faster implementation of the pickle module.

Question 28 of 40
★ FPSC ★ PPSC

What is returned by int(math.pow(3, 2))?

Question 29 of 40
★ FPSC ★ PPSC

What will be the output of the following Python code? random.randrange(1,100,10)

Question 30 of 40
★ FPSC ★ PPSC

What is returned by math.isfinite(float('nan'))?

Question 31 of 40
★ FPSC ★ PPSC

The command used to set only the x coordinate of the turtle at 45 units is:

Question 32 of 40
★ FPSC ★ PPSC

Which of the following functions helps us to randomize the items of a list?

Question 33 of 40
★ FPSC ★ PPSC

Which of the following is false about "import modulename" form of import?

Question 34 of 40
★ FPSC ★ PPSC

Which of the following Python codes will result in an error? object = ‘a’

Question 35 of 40
★ FPSC ★ PPSC

What does the function math.frexp(x) return?

Question 36 of 40
★ FPSC ★ PPSC

What is the range of values that random.random() can return?

Question 37 of 40
★ FPSC ★ PPSC

The output of the following Python code is either 1 or 2. import random random.randint(1,2)

Question 38 of 40
★ FPSC ★ PPSC

Which of the following functions returns a value in degrees, counterclockwise from the horizontal right?

Question 39 of 40
★ FPSC ★ PPSC

Program code making use of a given module is called a . . . . . . . . of the module.

Question 40 of 40
★ FPSC ★ PPSC

Pick the correct statement regarding pickle and marshal modules.

✓ Link copied to clipboard
Continue Your Practice

Advance Html — Part 1

Master the next curriculum module with 40 exam-standard MCQs.

Next Practice Set →

💡 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.

More Modules in Programming & Software Development

View All →
📚

Study Guides

Topic summaries and syllabus breakdown

Explore Guides →
🎯

Complete Library

Search through 78,000+ verified MCQs

Browse Library →
📱

Mobile App

Offline mock tests and instant bookmarks

Get Mobile App →