Backend Development Fundamentals MCQs for NSCT
Backend development is the server side of a web application: the code that receives HTTP requests, routes them to the right handler, applies business rules, talks to the database and sends back a response. It is topic 9 of the Web Development area, which carries 10% of the NSCT according to HEC's Areas of Competencies. In 2026 candidates averaged 54.1% accuracy in Web Development, per the HEC NSCT report and APP.
The examples use Node.js and Express because they are short and common in FYPs, but the ideas carry over to Django, Laravel and Spring. Revise Web Architecture & Protocols first for HTTP methods and status codes.
Servers
A server is a program that listens on a port, accepts requests and returns responses. Two roles are worth separating:
| Web server | Application server | |
|---|---|---|
| Main job | Handle HTTP, serve static files | Run application code for dynamic responses |
| Examples | Nginx, Apache httpd | Node.js process, Gunicorn with Django, Tomcat |
| Typical extras | Reverse proxy, TLS, load balancing, caching | Business logic, database access |
A reverse proxy such as Nginx sits in front of the app servers and forwards requests to them. HTTP is stateless: each request stands alone, so apps remember users with sessions (server-side data plus a session-ID cookie) or tokens such as JWTs.
Exam angle: Node.js runs JavaScript on one main thread. Its I/O is non-blocking, but a long synchronous loop in one route delays every other request.
Routing
Routing maps a method and URL path to a handler. REST-style routes use nouns for resources and HTTP methods as verbs.
app.get('/courses/:code', showCourse); // req.params.code
app.get('/courses', listCourses); // ?page=2 -> req.query.page
app.post('/courses', createCourse); // 201 Created
app.patch('/courses/:code', updateCourse); // partial update
app.delete('/courses/:code', deleteCourse);
Route parameters (/courses/CS101) identify a resource and arrive as strings in req.params. Query strings (?page=2&limit=20) carry options such as paging and filtering. GET, PUT and DELETE are idempotent; POST is not. PUT replaces a whole resource, while PATCH changes part of it.
Exam angle: routes are matched in registration order, so /users/:id declared before /users/new catches /users/new with id = 'new'.
Middleware
Middleware is a function (req, res, next) that runs during the request-response cycle. It can read or change the request, end the cycle by sending a response, or call next() to pass control on. Logging, body parsing (express.json()), authentication and CORS headers are typical jobs.
app.use(express.json()); // fills req.body
app.use('/admin', requireAdmin); // /admin and /admin/*, any method
app.get('/admin/stats', showStats);
app.use((err, req, res, next) => { // four params = error handler
res.status(500).json({ error: err.message });
});
Order matters: middleware runs top to bottom, and error handlers must come after the routes. Express 4 does not catch a rejected promise from an async handler, so you call next(err) yourself. Express 5 forwards it automatically.
Exam angle: a middleware that neither responds nor calls next() leaves the request hanging.
MVC
Model-View-Controller (MVC) separates an application into three roles: - Model: data and business rules, usually backed by the database. - View: presentation, such as an HTML template or a JSON shape. - Controller: receives the request, calls the model and picks the view.
Django calls the same idea Model-Template-View, where its "view" plays the controller role. Whatever the names, keep controllers thin and put rules such as discounts or validation in the model or a service layer.
Exam angle: a "fat controller" that runs SQL, calculates prices and builds HTML is the usual refactoring question.
Common traps
- Calling
res.send()withoutreturn, then sending again, which raises "Cannot set headers after they are sent". - Forgetting
express.json(), soreq.bodyisundefined. - Returning 401 for a logged-in user who lacks permission. That is 403.
- Storing sessions in one server's memory and then adding a second server behind a load balancer.
- Comparing
req.urlwith a bare path in Node'shttpmodule, forgetting that it includes the query string. - Assuming "logout" revokes a stateless JWT. It stays valid until it expires unless the server keeps a denylist.
Worked examples
1. Understanding. In MVC, which part should validate that a student's CGPA is between 0 and 4 before saving? Answer: the model. Validation is a data rule, so it belongs with the data. A check only in the controller or view can be bypassed by another route or an API client.
2. Application. An Express app registers app.use(logger), then app.get('/health', (req, res) => res.send('ok')), then app.use(notFound). A client requests GET /health. Which functions run?
Answer: logger, then the /health handler. The logger calls next(), the handler sends a response without calling next(), so notFound never runs.
3. Analysis. A Node API that resizes images synchronously inside its route becomes slow for all users whenever someone uploads a photo, even users who only call GET /status. What is the cause, and what is the right fix?
Answer: the resize holds Node's single JavaScript thread, so the event loop cannot answer other requests. Move the work to a worker thread or a background job queue. Adding more routes or raising the request timeout changes nothing, because the thread is still blocked.
Practise
The quiz below has 100 Backend Development Fundamentals questions, filterable by tier and difficulty. The Express and Node.js behaviour questions were run against real servers (Express 4 and 5) to confirm the answers.
Practise: 100 questions
FAQs
What is the difference between frontend and backend development?
Frontend code runs in the browser and builds what the user sees and clicks, using HTML, CSS and JavaScript. Backend code runs on a server and handles requests, business rules, authentication and data storage. They communicate over HTTP, usually with JSON. Full-stack developers work on both sides.
Which backend language should I learn for the NSCT?
The questions test concepts such as routing, middleware, MVC, HTTP methods and status codes, which work the same way in every stack. Pick one framework you already use, such as Express, Django or Laravel, and learn its request cycle well. Then compare how other server-side languages do the same job.
Should I use sessions or JWTs for login?
Sessions keep state on the server and send only an ID in a cookie, so logging out or banning a user takes effect at once. JWTs carry signed claims, so any server can verify them without a lookup, which suits APIs and multiple services. The cost is revocation: a JWT stays valid until it expires unless you add a denylist or keep lifetimes short.
What does next() do in Express?
next() hands the request to the next matching middleware or route in the stack. Calling next(err) skips ordinary middleware and jumps to the next error handler. If a function neither calls next() nor sends a response, the request hangs until the client gives up.
Next step
Continue with Server-Side Programming MCQs, check codes in HTTP status codes, go back to the Web Development MCQ hub, or test yourself across every area in an NSCT mock test.