Courseiva

PCPP1 · domain

Library Modules

Practise Python Institute Certified Professional in Python Programming 1 (PCPP1, PCPP-32-101) (PCPP1) Library Modules practice questions — original exam-style scenarios with answer choices, explanations, and analysis of common mistakes.

38 questions11 easy19 medium8 hard

Focused practice

Practice Library Modules questions

Scored sessions drawing only from this domain — pick a length below.

Start 20-question practice test →

What this domain covers

What to know about Library Modules

Library Modules questions test whether you can apply the concept in context, not just recognise a definition.

How the topic appears in realistic exam-style scenarios.

Which detail in the question changes the correct answer.

How to eliminate plausible but wrong options.

How to connect the question back to the wider exam objective.

Watch out for

Common Library Modules exam traps

  • Answering from memory before reading the full scenario.
  • Missing a constraint such as cost, availability, security, scope or command context.
  • Choosing a broad answer when the question asks for the most specific fix.
  • Ignoring why the wrong options are tempting.

Question index

All Library Modules questions (38)

Click any question to see the full explanation, or start a practice session above.

1

What is the purpose of the logging.StreamHandler?

Easy
2

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

Medium
3

When using configparser, how do you retrieve a value as a boolean?

Easy
4

You are logging events with custom levels. How do you add a custom level 'TRACE' (value 5) to the logging module?

Hard
5

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?

Medium
6

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

Hard
7

In the context of the CSV module, what is a 'dialect'?

Easy
8

When using configparser, what happens if you attempt to read a configuration file that does not exist using the read() method?

Medium
9

Which TWO of the following are valid ways to define a configuration option in configparser?

Medium
10

You 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?

Medium
11

When parsing XML with ElementTree, how do you retrieve the text content of an element?

Easy
12

Which THREE of the following are valid parameters for the csv.writer constructor?

Medium
13

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

Easy
14

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

Easy
15

You 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?

Medium
16

When executing a SQL query with parameters in sqlite3, why should you use placeholders (e.g., ?) rather than f-strings?

Medium
17

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

Easy
18

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

Easy
19

Which THREE of the following are valid methods of the xml.etree.ElementTree.Element class?

Hard
20

You 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?

Medium
21

Which TWO of the following are valid ways to create a connection in the sqlite3 module?

Easy
22

In the csv module, how do you specify that the CSV file uses a semicolon (;) as a delimiter?

Medium
23

Which logging configuration would effectively suppress all log messages?

Medium
24

Which method in the xml.dom.minidom module is used to retrieve the value of a specific attribute of an element?

Medium
25

You want to execute multiple SQL statements at once in sqlite3. Which method should you use?

Medium
26

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

Medium
27

When using configparser, how do you handle multiline values?

Hard
28

When using sqlite3.Row, what is the primary benefit over using a standard tuple?

Easy
29

You are configuring a logging FileHandler. What does the 'mode' parameter control?

Medium
30

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

Hard
31

Which TWO of the following are required to successfully write a row to a CSV file?

Medium
32

You 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?

Hard
33

You are configuring logging using a dictConfig. You want to send logs to a RotatingFileHandler. Which key must you define in the 'handlers' section?

Hard
34

You 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?

Medium
35

Which THREE of the following are valid logging levels?

Easy
36

You are processing a CSV file using csv.DictReader. If your input file lacks a header row, how do you provide the field names?

Medium
37

You are using sqlite3 and need to enforce foreign key constraints. How do you enable them?

Medium
38

Which TWO of the following are true about the sqlite3.Cursor object?

Hard

Frequently asked questions

What does the Library Modules domain cover on the PCPP1 exam?
Library Modules questions test whether you can apply the concept in context, not just recognise a definition.
How many questions are in this domain?
This page lists all 38 Library Modules questions in the PCPP1 question bank. The actual exam draws from this domain proportionally to its weighting in the official exam blueprint.
What is the best way to practise this domain?
Start with a short focused session (10 questions) to identify gaps, then work through explanations. Repeat with a longer session once the weak areas feel solid.
Can I practise only Library Modules questions?
Yes — the session launcher on this page filters questions to this domain only. Choose any session length for inline explanations and scoring.
python-pcpp1 PYTHON-PCPP1 library modules Practice Questions