Exam weight Low
Exam weight Low
Exam weight Low
- Node.js: JavaScript on the server, built on Chrome’s V8 engine; single-threaded, event-driven, non-blocking I/O.
Exam weight Low
Exam weight Low
- Modules: require/module.exports (CommonJS) or import/export (ES modules).
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
- http.createServer((req, res) => { res.writeHead(200, …); res.end(…); }).listen(3000);
Exam weight Low
Exam weight Low
Exam weight High
- Blocking: each request ties up a thread while waiting for I/O. Non-blocking (Node): one thread hands I/O off and handles other requests meanwhile (event loop).
🎯 How this can come up · 1 question
MCQ
Node handles many concurrent connections efficiently because of:
Correct: Its non-blocking, event-driven I/O.
Exam weight Low
Exam weight Low
Exam weight Low
- Node is a poor fit for CPU-heavy work: one long computation blocks the single thread.
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight High
- Promise: an object for a future value: pending → fulfilled or rejected; .then/.catch, or await inside an async function.
🎯 How this can come up · 1 question
MCQ
await can be used directly inside:
Correct: An async function (or a module top level).
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight High
- fetch(url) returns a promise of a Response; call response.json() (also a promise) to get the data.
Exam trapfetch only rejects on network failure; a 404 still resolves, so check response.ok.
Exam weight Low
Exam weight Low
Exam weight Low
- npm installs packages; package.json lists dependencies and scripts; dev-dependencies are only for development (nodemon).
Exam weight Low
- CORS: browsers block cross-origin requests unless the server sends Access-Control-Allow-Origin.
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
- Express: app.get("/path", (req, res) => …); app.post; app.listen.
Exam weight High
- Middleware: functions (req, res, next) that run in order before route handlers (logging, parsing JSON: express.json(), static files).
🎯 How this can come up · 1 question
MCQ
An Express middleware function must call ___ to pass control to the next one:
Correct: next().
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight High
- Route parameters: /users/:id → req.params.id. Query string: /search?q=x → req.query.q. Form POST body: req.body (needs a body parser).
🎯 How this can come up · 1 question
MCQ
For the route /books/:isbn, the value is read from:
Correct: req.params.isbn.
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
- EJS: templates with <%= value %> (escaped output) and <% code %>; res.render("view", data).
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
No slides match this filter.
![Slide 1: Task [Chapter 5]](figures/slide-01.jpg)

































