University of Saskatchewan
CMPT 353
CMPT 353 Final Practice Exam – Full
Answer Key
· Q: What is a callback function?
1. A: A function passed to another function to be called later, often used in asynchronous
programming.
· Q: Difference between timeout and interval?
2. A: `setTimeout` runs a function once after a delay; `setInterval` runs it repeatedly every
d
...[Show More]
CMPT 353 Final Practice Exam – Full
Answer Key
· Q: What is a callback function?
1. A: A function passed to another function to be called later, often used in asynchronous
programming.
· Q: Difference between timeout and interval?
2. A: `setTimeout` runs a function once after a delay; `setInterval` runs it repeatedly every
delay interval.
· Q: What is a promise?
3. A: A Promise is an object representing the eventual completion or failure of an
asynchronous operation.
· Q: What are the 3 states of promises?
4. A: Pending, Fulfilled, Rejected.
· Q: What order is Node simple event loop?
5. A: Call Stack → Microtasks → Callback Queue (Macrotasks).
· Q: True/False: NodeJS gives priority to the call stack before the message/job queue?
6. A: True.
· Q: List all phases of the NodeJS event loop.
7. A: 1. Timers, 2. Pending Callbacks, 3. Idle/Prepare, 4. Poll, 5. Check, 6. Close Callbacks.
· Q: What is the syntax of async functions?
8. A: `async function name() {}` — allows use of `await` inside the function.
· Q: How are async functions related to promises?
9. A: Async functions always return a promise. `await` pauses execution until the promise
resolves.
· Q: Relational model matching terms:
10. A: Table = Relation, Row = Tuple, Column = Attribute, Column Set = Degree, Row Set =
Cardinality, Identifier = Key, Legal values = Domain.
· Q: What is a primary key?
11. A: A field that uniquely identifies each row in a table.
· Q: What is a foreign key?
12. A: A field that references the primary key of another table.
· Q: What are ACID properties?
13. A: Atomicity, Consistency, Isolation, Durability — ensure reliable transactions in
databases.
[Show Less]