Quiz: The Code Under Your App¶
Test your understanding of the stack under an AI-built app, from React and Express to lock files, storage buckets and background jobs, with these review questions.
1. What does a lock file such as package-lock.json record?¶
- The exact version of every package installed, direct and transitive
- The list of packages your code uses, with flexible version ranges
- The passwords the app uses to reach outside services
- Which files the agent is allowed to change
Show Answer
The correct answer is A. The lock file pins the exact version of every installed package, including the packages your packages depend on, so every later install gets the same code. Option B describes package.json, whose caret ranges such as ^5.1.0 let two installs a month apart get different code. Secrets belong in environment variables, not the lock file. Commit the lock file, and don't delete it to make an install error go away.
Concept Tested: Lock File
See: Lock File
2. What is a scheduled job?¶
- A request the browser sends at a set time each day
- A list of tasks the builder plans to give the agent next week
- A route the server runs only when a member is signed in
- A background job that runs automatically at set times, such as every night at 3 a.m.
Show Answer
The correct answer is D. A scheduled job runs because the clock says so, not because a member asked. In the dating-safety app, scheduled jobs sweep for orphaned scans and check vendor credit. A purge of old data is a job the app needed and didn't have at first. Because nobody is watching when they run, their mistakes can go unseen for a long time. The other options describe browser requests, a to-do list and a route guard.
Concept Tested: Scheduled Job
See: Scheduled Job
3. What is Node.js?¶
- A frontend framework that draws screens in the browser
- A runtime that runs JavaScript code outside a browser, on a laptop or a server
- A database that stores members and scans
- A package of developer-only plugins
Show Answer
The correct answer is B. Node.js took the JavaScript engine out of the Chrome browser so JavaScript could run on any computer. It is the engine under Express, Vite and npm in this stack. Because so much depends on it, its version matters, so write it down in package.json or a .nvmrc file where both your laptop and the host read it. React is the frontend framework (A), and Postgres is the database (C).
Concept Tested: Node.js
See: Node.js
4. What does a file storage bucket hold in the dating-safety app?¶
- Rows of short facts such as member IDs and scan dates
- The app's source code and its tests
- Photos and voice clips, each saved under a key
- The exact versions of every installed package
Show Answer
The correct answer is C. A bucket holds large files, each saved under a name called a key. The database holds rows of short facts, including each scan's file keys but not the files themselves (A). Source code lives in the codebase and git (B). Package versions live in the lock file (D). Whether the bucket is public or private is a must-be-right setting.
Concept Tested: File Storage Bucket
5. The agent's scoring code compares a check's status to "notChecked", but the type says the word is "not_checked". Why is type checking worth running here?¶
- Vite checks types on every build, so the error would stop the deploy
- Type checking proves the vendor will send
"not_checked"at runtime - It catches the mismatch in seconds, before a failed check can be scored as clear
- It renames the word automatically so both spellings work
Show Answer
The correct answer is C. To a person skimming, the two spellings look alike, so the line that should catch unrun checks never matches. npx tsc --noEmit flags it as a red line in under a minute. Vite doesn't check types (A), which surprises many builders. Type checking only checks code against itself, so it can't promise what a vendor sends at runtime (B). It reports errors and doesn't rename anything (D).
Concept Tested: Type Checking
See: Type Checking
6. Why is any setting whose name starts with VITE_ a risk for secrets?¶
- Vite copies it into the front-end code at build time, where every member can read it
- Vite deletes it after every build, so the app loses its keys
- Vite sends it to its own servers for checking
- Vite stores it in the lock file, which is committed to git
Show Answer
The correct answer is A. Vite copies every VITE_ setting into the files members download. Anything in the front end runs on the member's device and can be read by anyone, so an API key there is a published API key. Vite doesn't delete settings, send them anywhere, or write them to the lock file. Ask your agent to list every VITE_ variable and confirm none of them is a secret.
Concept Tested: Build Tool
See: Build Tool
7. The server replies 202 to start a scan and then runs the eight checks as a background job inside the same running program as the web server. What happens if a deploy restarts the server forty seconds later?¶
- The job keeps running on the old server until it finishes
- The host pauses the deploy until all jobs finish
- The member's browser restarts the scan automatically
- The job dies with the server, unless something records it and picks it up again
Show Answer
The correct answer is D. A job that runs inside the same program as the web server dies when that program restarts, and servers restart on every deploy. Without a record and a way to resume, the scan stays "running" forever. Larger apps hand jobs to a separate job queue whose worker can pick them up after a restart. Hosts don't wait for jobs by default, and the browser doesn't restart scans on its own.
Concept Tested: Background Job
See: Background Job
8. A scan is deleted from the database, but its photos stay in the bucket. What is the problem?¶
- The photos are now public to anyone
- The photos are orphaned: still stored and costing money, with no record of who they belong to
- The database will refuse to start until the photos are deleted
- Nothing, since the bucket deletes files on its own when their row goes away
Show Answer
The correct answer is B. The bucket and the database are two places that must agree. When a row goes and its files stay, the files are orphaned. They cost money and hold private photos that no record ties to a member, so they are easy to miss in any deletion request. That's why the dating-safety app runs a nightly sweep. Deleting the row doesn't make a file public (A), stop the database (C) or delete the file (D).
Concept Tested: File Storage Bucket
9. An install fails with a tangle of version errors, and the agent proposes deleting package-lock.json and node_modules and installing again. What should you tell it?¶
- "Keep the lock file. Show me which package conflicts, and change only that one."
- "Go ahead, and then commit the new lock file."
- "Delete
package.jsontoo, so we start clean." - "Remove the caret from every version so the error goes away."
Show Answer
The correct answer is A. Deleting the lock file throws away the record of the exact versions that were known to work. The fresh install pulls whatever the caret ranges allow today, which can quietly change dozens of packages at once. The safer move is to find the one conflict and change only that package. Options B and C make the problem bigger. Option D changes every version range to dodge one error.
Concept Tested: Lock File
See: Lock File
10. You are drafting an App Parts Map. Which column helps you most when deciding where to spend care?¶
- The tool each part is built with
- The file path where each part lives
- What happens to a member if the part stops
- The year each tool was first released
Show Answer
The correct answer is C. The last column asks Chapter 1's question of every part: what happens to a member if this goes wrong? A part whose failure hurts a member or loses data is a must-be-right part, and that column lets you go down the list one row at a time. The tool name (A) and file path (B) help you and the agent find a part. The release year (D) tells you nothing about risk.
Concept Tested: App Parts Map