Chapter 1 — Quiz
14 questions. Answers and explanations are at the bottom — try them all before scrolling.
Multiple choice
Q1. Which best describes a DBMS? - A) A collection of related data - B) The software that stores, retrieves, protects, and manages a database - C) A spreadsheet with many tabs - D) A backup of your data
Q2. SQL is described as a declarative language because: - A) You must specify the exact steps to retrieve data - B) You describe what result you want and the system decides how to get it - C) It only works on declared variables - D) It cannot change data, only read it
Q3. A customer's email is stored once in customers and referenced by customer_id in orders. This primarily prevents which problem?
- A) Durability failure
- B) Slow queries
- C) Data redundancy and the integrity problems it causes
- D) Concurrency conflicts
Q4. Two users buy the last in-stock item at the same instant, and the system must ensure only one succeeds. This is a matter of: - A) Structure - B) Concurrency control - C) Indexing - D) Schema design
Q5. Who proposed the relational model, and when? - A) Edgar F. Codd, 1970 - B) Tim Berners-Lee, 1989 - C) Larry Ellison, 1977 - D) Donald Chamberlin, 1965
Q6. Which is the best reason this book uses PostgreSQL? - A) It is the only database that supports SQL - B) It is free, open-source, highly standards-compliant, and very capable - C) It is the fastest database in every benchmark - D) It cannot be used in production, so it's safe for learning
Q7. The database component that decides the fastest way to execute a query is the: - A) Parser - B) Executor - C) Optimizer (planner) - D) Write-ahead log
Q8. Which is a document database? - A) PostgreSQL - B) MongoDB - C) Redis - D) Neo4j
Q9. "Once the system confirms your data is saved, it survives even an immediate power failure." This property is called: - A) Consistency - B) Concurrency - C) Durability - D) Atomicity
Q10. A foreign key constraint guarantees that: - A) Every value in a column is unique - B) A referenced row actually exists in another table - C) A column cannot be NULL - D) Queries run faster
True/False
Q11. NoSQL databases completely replaced relational databases in modern systems. (True / False)
Q12. A spreadsheet is always the wrong tool and should never be used. (True / False)
Short answer
Q13. Name the five problems databases solve, and give a one-line example of any one of them.
Q14. In two or three sentences, explain why "the ORM handles the database, so I don't need to understand SQL" is a risky belief.
---
Answer key
Q1 — B. A DBMS is the software (PostgreSQL); the database is the data it manages.
Q2 — B. Declarative = you state the desired result; the optimizer chooses the execution strategy. This is why the same request can run fast or slow depending on indexes and statistics.
Q3 — C. Storing a fact once and referencing it eliminates redundancy, which is the root of update/insert/delete anomalies (integrity problems).
Q4 — B. Ensuring exactly one of two simultaneous operations succeeds is concurrency control (Chapters 26–27).
Q5 — A. Edgar F. Codd, in his 1970 paper "A Relational Model of Data for Large Shared Data Banks."
Q6 — B. Free, open-source, standards-compliant, and exceptionally capable. (It's excellent in production and fast, but "fastest in every benchmark" is false — no database wins every benchmark.)
Q7 — C. The optimizer/planner estimates the cost of alternative plans and picks the cheapest.
Q8 — B. MongoDB is a document store. Redis is key-value, Neo4j is a graph database, PostgreSQL is relational.
Q9 — C. Durability. (Atomicity, consistency, isolation, and durability together are the ACID properties — Chapter 26.)
Q10 — B. A foreign key enforces referential integrity: the referenced row must exist. (Uniqueness is a unique/primary-key constraint; non-null is NOT NULL.)
Q11 — False. NoSQL expanded the options for specific problems; relational databases remain the default for most applications, and the most-used databases are still relational.
Q12 — False. Spreadsheets are excellent for small, personal, ad-hoc, visual data. The point is that they break down once data is shared, growing, long-lived, and important.
Q13. Structure, Integrity, Concurrency, Durability, Querying-at-scale. Example (Durability): after a power outage, a database recovers committed orders that a spreadsheet would have lost.
Q14. An ORM generates SQL for you, but when a query is slow, wrong, or insecure, you must understand the SQL underneath to diagnose and fix it. The ORM is a convenience for people who know SQL, not a replacement for that knowledge — and treating it as a black box leads to problems like the N+1 query (Chapter 30).
Scoring: 12–14 solid; 9–11 re-skim the "five problems" and "history" sections; below 9, re-read the chapter before moving on — these ideas recur constantly.