
GIAC Python Coder
Domain 2Objective 3
Database Interaction GPYC Practice Questions (Page 3)
Part of the Scripting and Automation domain, which makes up ~23% of our current practice bank. GIAC (SANS) does not publish an official question count, but from its 120-minute exam (~50–80 total, ~12–18 in this domain), expect 4–6 from this objective — we provide 30 practice questions to prepare you well beyond it. (estimate)
30questions here
6free pages
7concepts
Questions 11–15
- 11
A Python script performs a DELETE operation on a MySQL table. The script should log an error and roll back the transaction if the delete fails due to a foreign key constraint. Which exception handling approach is correct?
Select an answer first - 12
A company is migrating its Python application from MySQL to PostgreSQL. The application currently uses raw SQL queries with the mysql-connector-python library. The team wants to minimize code changes and make the database layer more portable. Which approach best achieves this?
Select an answer first - 13
A Python script connects to a PostgreSQL database and performs a series of INSERT statements. If one INSERT fails due to a constraint violation, the script must log the error and continue with the remaining inserts, but it must not leave the earlier inserts in a partial state. What is the correct error-handling pattern?
Select an answer first - 14
A developer is using SQLAlchemy Core to query a SQLite database. The query returns thousands of rows, and the developer wants to process them one at a time without loading all rows into memory at once. Which approach should be used?
Select an answer first - 15
A Python application connects to an Oracle database. The connection may fail due to network issues, and queries may fail due to constraint violations. The developer wants to handle these failures gracefully without crashing the application. Which exception-handling strategy is most appropriate?
Select an answer first
Finished these 5 questions?
Review the revealed explanations, or continue through the curriculum.
Free Basic Practice is a study aid with revealable answers — not a scored exam. Examers.io is independent and not affiliated with or endorsed by GIAC (SANS). “GPYC” is a trademark of its owner, used for identification only.