Courseiva

PCPP1 · topic practice

Library Modules practice questions

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.

Courseiva uses original exam-style practice questions designed for learning and revision. The goal is to understand the concepts, recognise exam patterns, and improve through explanations — not memorise copied exam dumps.

Editorial oversight:Johnson Ajibi· MSc IT Security, IEEE Senior Member
20 questionsDomain: Library Modules

What the exam tests

What to know about Library Modules

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.

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

Watch out for

Common Library Modules exam traps

  • ▸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

Practice set

Library Modules questions

20 questions · select your answer, then reveal the explanation

Question 1mediummultiple choice
Read the full Library Modules explanation →

When parsing an XML document using xml.etree.ElementTree, you want to find all 'item' tags that are immediate children of the root element. Which method is most efficient for this?

You are writing data to a CSV file using csv.writer. You want to ensure that row delimiters are handled correctly across different operating systems. What should you set the 'lineterminator' parameter to?

Which class in xml.etree.ElementTree should you use to parse an XML file from a file object?

What is the result of using '?' as a placeholder in sqlite3 for a parameter that is a Python list?

In xml.etree.ElementTree, what is the difference between find() and findall() when used with XPath support?

Question 6mediummultiple choice
Read the full Library Modules explanation →

Which logging configuration would effectively suppress all log messages?

You want to retrieve a list of all section names from a ConfigParser object. How do you do this?

Which TWO of the following are true about the logging module?

Which TWO of the following are valid ways to read sections in a configparser object?

Which THREE of the following are valid states/modes for the csv.QUOTE_* constants?

Which THREE of the following are components of the logging module?

Which THREE of the following are valid parsing modes for the XML module?

Which THREE of the following are valid logging levels?

You are writing a Python script that must parse a large XML file using xml.etree.ElementTree. The file contains many namespaces, and you need to find all elements with the local name 'price' regardless of their namespace. Which approach is most efficient and correct?

Question 15mediummultiple choice
Study the full Python automation breakdown →

You are building a Python tool that must parse a configuration file generated by a legacy application. The file contains sections whose keys are case-sensitive and may include duplicate keys within the same section; the tool must preserve every value and detect duplicates for a warning report. Which approach using configparser is technically correct?

You are working with the os module to manipulate file paths in a cross-platform Python application. You need to perform operations that are portable across Windows and Unix-like systems. Which TWO of the following are valid and recommended uses of the os.path submodule for path manipulation? (Choose two.)

You are writing a Python script that needs to parse a JSON string containing a date in ISO 8601 format. You want to automatically convert this date string into a datetime.date object during parsing. Which of the following approaches using the json module is correct?

Question 18mediummultiple choice
Study the full Python automation breakdown →

You are writing a Python script to monitor a directory. When a new file appears, you need to read its last line efficiently without loading the entire file into memory. The files can be very large (several gigabytes). Which approach using the os module is most appropriate?

You are using the `os` module to manipulate file paths in a cross-platform script. You need to extract the filename without extension from a path, and also check if a path is absolute. Which TWO of the following statements about the `os.path` module are correct? (Choose two.)

Question 20hardmultiple choice
Read the full Library Modules explanation →

You are designing a class that needs to support the context manager protocol. The class manages a network connection that must be closed exactly once, even if multiple exceptions occur within the with block. Which implementation correctly ensures that the connection is closed and that any exception is propagated?

Free account

Track your progress over time

Create a free account to save your results and see which topics improve across sessions.

Focused Library Modules sessions

Start a Library Modules only practice session

Every question in these sessions is drawn from the Library Modules domain — nothing else.

Related practice questions

Related PCPP1 topic practice pages

Move into related areas when this topic feels solid.

Frequently asked questions

What does the PCPP1 exam test about Library Modules?
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.
How should I use these practice questions?
Select your answer before revealing the explanation. Then read why each option is right or wrong — this active recall approach builds retention far faster than re-reading notes.
Can I practise just Library Modules questions in a focused session?
Yes — the session launcher on this page draws every question from the Library Modules domain. Use a 10-question session first to gauge your baseline, then move to 20 or 30 once the weak spots are clear.
Where can I practise other PCPP1 topics?
Use the topic links above to move to related areas, or go back to the PCPP1 question bank to see all topics.
Are these real exam questions or dumps?
These are original practice questions written to test the same concepts the PCPP1 exam covers. They are not copied from any real exam or dump site.