You must be able to configure csv dialects, read xml.dom.minidom attributes correctly, copy directory trees with shutil while preserving metadata and controlling overwrite behavior, and keep tkinter windows animated during long work. The key skill is choosing the exact argument or method that matches the required behavior.
Start practicing
Library Modules — choose a session length
Free · No account required
Domain overview
The Library Modules domain of PCPP1 checks applied fluency with Python's standard library beyond the basics: csv dialect control, xml. dom. minidom attribute access, shutil tree copying with metadata and failure semantics, and tkinter event loops with long-running work.
Questions are scenario-based, asking you to pick the correct call, argument, or pattern rather than recite documentation.
Exam objectives
Configuring csv readers and writers with delimiter, quotechar, and dialect parameters for non-comma formats
Retrieving element attribute values via xml.dom.minidom getAttribute and related node methods
Using shutil.copytree with copy_function, dirs_exist_ok, and metadata-preserving copy2 behavior
Keeping tkinter responsive during long tasks using after, update, or worker threads instead of blocking mainloop
Assuming csv.reader auto-detects delimiters; you must pass delimiter=';' or a registered dialect explicitly
Confusing getAttribute with getElementsByTagName or childNodes when reading a specific attribute value from a DOM element
Letting shutil.copytree silently merge into an existing destination by forgetting dirs_exist_ok, or losing metadata by using copy instead of copy2
Click any question to see the full explanation and answer options, or start a focused practice session above.
When using sqlite3.Row, what is the primary benefit over using a standard tuple?
2You are using configparser.ConfigParser to read a configuration file. You have a file where option names are case-sensitive. How do you ensure the parser respects this casing?
3You are processing a CSV file using csv.DictReader. If your input file lacks a header row, how do you provide the field names?
4Which method in the xml.dom.minidom module is used to retrieve the value of a specific attribute of an element?
5You need to configure the logging module to capture logs from multiple modules while ensuring that logs from third-party libraries (e.g., 'urllib3') are only captured at the WARNING level. How do you set this?
6You are using the sqlite3 module to manage a database. You need to ensure that database changes are permanently saved even if your script terminates unexpectedly. Which method should you call after an INSERT operation?
7When using configparser, how do you retrieve a value as a boolean?
8In the csv module, how do you specify that the CSV file uses a semicolon (;) as a delimiter?
9You are logging events with custom levels. How do you add a custom level 'TRACE' (value 5) to the logging module?
10When executing a SQL query with parameters in sqlite3, why should you use placeholders (e.g., ?) rather than f-strings?
11You are configuring logging using a dictConfig. You want to send logs to a RotatingFileHandler. Which key must you define in the 'handlers' section?
12When using configparser, what happens if you attempt to read a configuration file that does not exist using the read() method?
13When using configparser, how do you handle multiline values?
14When parsing XML with ElementTree, how do you retrieve the text content of an element?
15You are writing to a CSV file. If your data contains the delimiter character itself (e.g., a comma in a text field), what does the csv module do by default?
16You are configuring a logging FileHandler. What does the 'mode' parameter control?
17You want to execute multiple SQL statements at once in sqlite3. Which method should you use?
18You are using sqlite3 and need to enforce foreign key constraints. How do you enable them?
19In the context of the CSV module, what is a 'dialect'?
20Which TWO of the following are valid ways to create a connection in the sqlite3 module?
21What is the purpose of the logging.StreamHandler?
22Which THREE of the following are valid parameters for the csv.writer constructor?
23You are using configparser and want to access a value that might not exist, but provide a default value if it is missing. Which method is most appropriate?
24Which THREE of the following are valid methods of the xml.etree.ElementTree.Element class?
25Which TWO of the following are true about the sqlite3.Cursor object?
26Which TWO of the following are valid ways to define a configuration option in configparser?
27Which TWO of the following are required to successfully write a row to a CSV file?
28You are using the sqlite3 module to insert a large number of rows into a table. You want to maximize performance by reducing the number of disk writes. Which approach is most effective?
29You are writing a Python script that must read a configuration file in TOML format. Which module from the Python Standard Library should you use?
30You are using the csv module to read a file that contains fields with embedded newlines and commas. Which TWO of the following statements about the csv.reader are correct? (Choose two.)
31You are writing a Python application that must parse a configuration file where a value spans multiple lines, such as a long list of email addresses separated by newlines. You decide to use the configparser module. Which of the following correctly describes how to include a multi-line value in the configuration file?
32You are building a Python script that needs to create a ZIP archive containing files from a directory. You want to preserve the directory structure inside the archive. Which approach using the zipfile module correctly adds the file '/data/reports/summary.txt' as 'reports/summary.txt' inside the archive?
33You are building a configuration manager that reads an INI file. A section contains the key-value pair `timeout = 30`. You need to retrieve the value as an integer, but if the key is missing, you want to get 60 without raising an exception. Which code snippet achieves this using the `configparser` module?
34You are developing a Python script that needs to determine the absolute path of a file located in a directory relative to the script's location. You decide to use the os.path module. Which of the following functions should you use to obtain the absolute path without resolving symbolic links?
35You are building a Python application that uses the shelve module to store persistent data. You want to ensure that the database file is updated correctly and that you can access keys as attributes. Which TWO of the following statements about the shelve module are true? (Choose two.)
36You are using the `json` module to serialize a custom object that contains a `datetime.date` attribute. When you call `json.dumps(obj)`, you get a `TypeError: Object of type date is not JSON serializable`. Which approach correctly allows serialization while preserving the date as an ISO 8601 string?
37You are writing a Python script that must process a large text file line by line. The file is UTF-8 encoded, but some lines contain characters that are not representable in the default system encoding. You want to ensure that the script reads the file correctly on any platform. Which code correctly opens the file?
38You are building a desktop tool with tkinter. A user clicks a button, and while a long file-compression routine runs you want a small window with a progress bar to stay visible and animated; the main application window must remain responsive to the user's clicks throughout. Which approach should you use?
39You are using the datetime module to calculate the difference between two dates. You have two datetime objects, start and end, and you need to find the number of full days between them, ignoring any fractional part. Which expression correctly computes this?
40You are using the logging module in a long-running service. You need to ensure that a specific logger named 'app.db' writes DEBUG and higher messages to a file, but its parent logger 'app' must not propagate these DEBUG messages to the root logger. Which configuration achieves this?
41You are writing a Python utility that copies a directory tree to a network share using shutil. You must preserve file metadata and fail loudly if the destination already contains a conflicting file, rather than silently overwriting it. Which TWO shutil features satisfy these requirements? (Choose two.)
42You are working with the sqlite3 module to build a small inventory application. You need to execute a parameterized INSERT statement and then retrieve the auto-generated primary key for the newly inserted row. Which two approaches are valid and safe? (Choose two.)
43You are working with a large XML file and need to extract specific elements efficiently without loading the entire document into memory. You decide to use the xml.etree.ElementTree module. Which of the following methods should you use to iterate over all 'book' elements in the document?
44A colleague's script parses a CSV export that uses a semicolon as the field separator and contains quoted text fields with embedded semicolons. They call csv.reader(f) without arguments and complain that rows are split incorrectly into too many fields. What is the correct fix?
45You are writing a script that reads a large CSV file using csv.reader. The file uses a semicolon as the delimiter and contains quoted fields with embedded newlines. Which instantiation correctly handles this format?
46You are writing a reusable module that must expose only a small public API while keeping several helper functions and constants internal. Users of the module should not import the helpers with 'from mymodule import *', but direct access such as mymodule._helper() may still be needed for tests. Which approach fits best?
47You are writing a Python script that needs to create a temporary directory, write several files into it, and ensure that the directory and its contents are automatically deleted when the script exits, even if an exception occurs. Which approach using the tempfile module is most appropriate?
48You are developing a Python application that must parse a large XML file and extract specific data. The file is too large to fit into memory, so you need to process it incrementally. Which approach using the xml.etree.ElementTree module is most appropriate?
You must be able to configure csv dialects, read xml.dom.minidom attributes correctly, copy directory trees with shutil while preserving metadata and controlling overwrite behavior, and keep tkinter windows animated during long work. The key skill is choosing the exact argument or method that matches the required behavior.
The Courseiva PCPP1 question bank contains 48 questions in the Library Modules domain. Click any question to see the full explanation and answer breakdown.
Start with a 10-question focused session to identify your baseline accuracy in this domain. Read every explanation — even for questions you answer correctly — to understand the reasoning. Once you score consistently above 80%, move to a 20–30 question session to confirm depth before moving to the next domain.
Yes — the session launcher on this page draws questions exclusively from the Library Modules domain. Choose 10, 20, 30, or 50 questions for a focused session, or click individual questions to review them one by one.
Save your results, see per-domain analytics, and get readiness scores — free, for every certification.
Sign Up FreeFree forever · Every certification included