Drag a concept onto its matching description — or click a concept then click the description.
Mathematical functions
Generate pseudo-random numbers
Manipulate dates and times
Work with JSON data
Interact with operating system
Match each Python module to its purpose.
Drag a concept onto its matching description — or click a concept then click the description.
Mathematical functions
Generate pseudo-random numbers
Manipulate dates and times
Work with JSON data
Interact with operating system
Answer choices
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
os: Provides a portable way of using operating system dependent functionality.
Common Python standard library modules: os (operating system interface), sys (interpreter access), json (JSON handling), datetime (date and time), re (regular expressions), math (mathematical functions).
Answer analysis
For each option: why learners choose it and why it is or isn't the right answer here.
os: Provides a portable way of using operating system dependent functionality.
Why this is correct
The os module is Python's primary interface to underlying operating system services, exposing functions like os.getcwd(), os.listdir(), os.environ, and os.path.join. Its design goal is to provide a portable abstraction so that code can access operating system dependent features—such as file paths, process management, and environment variables—consistently across Windows, macOS, and Linux. The module name itself signals 'operating system', and it is the correct match for this description.
os: Provides access to some variables used or maintained by the interpreter.
Why it's wrong here
This description actually defines the sys module, not os, because sys exposes interpreter-specific objects such as sys.argv (command-line arguments), sys.path (module search path), sys.version, and sys.exit(). The os module, by contrast, deals with the operating system environment rather than the Python interpreter's internal state. While os.environ does give access to environment variables, that is an OS feature, not something 'maintained by the interpreter'.
sys: Provides access to some variables used or maintained by the interpreter.
Why this is correct
The sys module provides access to variables and functions that the Python interpreter itself uses or maintains, including sys.argv, sys.path, sys.modules, sys.platform, and sys.getrecursionlimit(). For example, sys.argv holds the command-line arguments passed to a script, and sys.path lists the directories searched for imports. These are interpreter-level details rather than operating system abstractions, which is exactly what the module name 'sys' (short for 'system' in the interpreter sense) suggests.
sys: Provides functions for working with dates and times.
Why it's wrong here
This description belongs to the datetime module, which supplies classes such as datetime.date, datetime.time, datetime.datetime, and timedelta for working with dates and times. The sys module, in contrast, does not provide any date or time functionality; instead it focuses on interpreter state. A common confusion arises because time-related functions like time.time() live in the separate time module, further distinguishing sys from date/time handling.
json: Provides functions for parsing and serializing JSON data.
Why this is correct
The json module is the standard library's implementation of JavaScript Object Notation (JSON) encoding and decoding. It provides json.dumps() to serialize Python objects into JSON strings, json.loads() to parse JSON strings back into Python data structures, and json.dump()/json.load() to work with file-like objects. This makes it the essential tool for exchanging data between Python programs and web APIs or configuration files that use the JSON format.
json: Provides support for regular expressions.
Why it's wrong here
Regular expression support in Python is provided by the re module, which offers functions like re.search(), re.match(), re.findall(), and re.sub() along with compiled pattern objects. The json module has nothing to do with pattern matching; its sole purpose is JSON serialization and parsing. This confusion likely originates from the fact that both modules are commonly used in data processing, but their responsibilities are entirely distinct: re parses text patterns, while json parses structured data interchange formats.
Go deeper
About these practice questions
One of 421 original PCAP practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This PCAP practice question is part of Courseiva's free Python Institute certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PCAP exam.