PCPP2 · domain
Database Access
Practise Python Institute Certified Professional in Python Programming 2 (PCPP2) (PCPP2) Database Access practice questions — original exam-style scenarios with answer choices, explanations, and analysis of common mistakes.
Focused practice
Practice Database Access 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 Database Access
Database Access 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 Database Access 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 Database Access questions (34)
Click any question to see the full explanation, or start a practice session above.
You are using sqlite3 in Python and need to ensure that data integrity is maintained when performing multiple related INSERT operations. Which method should you call on the connection object to commit your changes?
Easy2Which Python library is the standard built-in interface for SQLite databases?
Easy3How do you retrieve the number of documents matched by a PyMongo 'find' operation without fetching all documents into memory?
Medium4Which of the following best describes the benefit of using parameterized queries in sqlite3?
Easy5In sqlite3, how do you handle a database error such as a constraint violation?
Easy6Which TWO of these are valid parameters for the MongoClient constructor?
Medium7What is the purpose of the 'upsert=True' option in MongoDB update operations?
Medium8You are implementing a custom type in SQLAlchemy. Which method must be overridden to convert data from the database type back to a Python object?
Hard9Which object in SQLAlchemy is responsible for maintaining a collection of loaded objects and managing their lifecycle?
Medium10You are using SQLAlchemy with an asynchronous driver (asyncio). Which object must be used to perform database operations asynchronously?
Hard11Which THREE of these are valid relationship loading strategies in SQLAlchemy?
Hard12In SQLAlchemy, what does the 'metadata.create_all(engine)' command do?
Medium13When using the sqlite3 module, what is the primary purpose of using a context manager (the 'with' statement) on a connection object?
Easy14Which TWO are common pitfalls when working with SQLite databases in a multi-threaded environment?
Easy15Which THREE are valid cascade options in SQLAlchemy?
Hard16Which THREE operations are supported by the PyMongo 'bulk_write' method?
Medium17Which THREE methods are part of the PEP 249 Python DB-API 2.0 interface?
Easy18Which THREE features are provided by SQLAlchemy's Unit of Work pattern?
Hard19In SQLAlchemy, how do you prevent an object from being saved to the database during a session.commit()?
Hard20Which THREE are characteristics of BSON (Binary JSON) as used by MongoDB?
Medium21Which TWO are common methods to handle BSON Date objects in PyMongo?
Easy22Which PyMongo method should be used to update a single document if you want to modify specific fields without replacing the entire document?
Medium23In a PyMongo application, what happens when you use 'insert_many' with 'ordered=False'?
Hard24Which TWO of the following are valid ways to execute a raw SQL query in SQLAlchemy?
Medium25When connecting to a MongoDB instance using PyMongo, what is the role of the 'MongoClient' object?
Medium26When configuring a connection pool in SQLAlchemy, what does the 'pool_size' parameter define?
Hard27In SQLAlchemy, what is the difference between 'lazy='select'' and 'lazy='joined'' loading strategies?
Medium28You are developing an application using SQLAlchemy and need to retrieve a single object by its primary key. Which method is preferred for this operation?
Medium29When using the MongoDB aggregation framework in PyMongo, which stage should be used to filter documents based on a condition?
Hard30When performing bulk inserts in PyMongo, which method is the most efficient?
Medium31You are using SQLAlchemy's relationship() function. What does 'back_populates' achieve?
Hard32Which command-line tool is typically used to inspect the contents of a SQLite database file?
Easy33When using SQLAlchemy Declarative Base, how do you define a table name that differs from the class name?
Medium34In SQL, which clause is used to filter results based on a condition after grouping?
EasyOther domains
All PCPP2 exam domains
Frequently asked questions
- What does the Database Access domain cover on the PCPP2 exam?
- Database Access 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 34 Database Access questions in the PCPP2 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 Database Access questions?
- Yes — the session launcher on this page filters questions to this domain only. Choose any session length for inline explanations and scoring.