🌍

Web & Software Development MCQ

Test your Web & Software Development knowledge with 100 multiple choice questions covering fundamentals to advanced concepts, with instant feedback and explanations.

100 Questions 40 Beginner 40 Intermediate 20 Advanced

How This Practice Test Works

Every question below expands right on this page — click a question to reveal its four options, pick the one you think is correct, and you'll get instant feedback along with the correct answer and a short explanation of the reasoning. Questions are grouped by difficulty, so start with the 40 beginner questions to confirm your fundamentals, work through the 40 intermediate ones, and finish with the 20 advanced questions that mirror what exams and technical screenings actually ask. There's no sign-up, no timer, and no limit — retake the test as often as you like.

Curated by Tech Baithak Editorial Team  ·  Last updated: June 2026

1

What does HTML stand for?

A

Correct Answer

HyperText Markup Language — the standard language for creating web page structure

Explanation

HTML (HyperText Markup Language) defines the structure and content of web pages using elements (tags). CSS styles them; JavaScript adds interactivity.

2

What does CSS stand for and what is its purpose?

B

Correct Answer

Cascading Style Sheets — a language for describing the presentation (layout, colors, fonts) of HTML documents

Explanation

CSS (Cascading Style Sheets) separates presentation from structure. The "cascading" refers to how multiple style rules are combined by specificity, importance, and source order.

3

What is the DOM?

B

Correct Answer

Document Object Model — a tree representation of an HTML/XML document that allows JavaScript to dynamically access and modify content

Explanation

The DOM represents HTML as a tree of nodes. JavaScript can manipulate it: document.getElementById(), querySelector(), createElement(), appendChild(). Changes to the DOM update the rendered page.

4

What is REST in web development?

B

Correct Answer

Representational State Transfer — an architectural style for designing stateless HTTP APIs using standard HTTP methods

Explanation

RESTful APIs use HTTP methods: GET (retrieve), POST (create), PUT/PATCH (update), DELETE (remove). Resources are identified by URLs. Responses are typically JSON. Stateless: each request is self-contained.

5

What is an API?

B

Correct Answer

Application Programming Interface — a contract defining how software components communicate, specifying requests, responses, and data formats

Explanation

APIs define how applications communicate. Web APIs use HTTP. Libraries expose APIs for using their features. The API contract separates interface from implementation — callers don't need to know internal details.

6

What is version control and why is it important?

B

Correct Answer

A system tracking changes to files over time, enabling collaboration, rollback, and history — Git is the most widely used system

Explanation

Version control (Git, SVN) tracks every change. Benefits: history, collaboration, branching, rollback, blame/blame. Git is distributed — every clone has the full history.

7

What is agile software development?

B

Correct Answer

An iterative development methodology delivering working software in short cycles (sprints), emphasizing collaboration, feedback, and adaptability

Explanation

Agile (Scrum, Kanban, XP) iterates in 1-4 week sprints. Key practices: daily standups, sprint planning, retrospectives, continuous delivery. Values responding to change over following a fixed plan.

8

What is the difference between frontend and backend development?

B

Correct Answer

Frontend: client-side UI (HTML/CSS/JS, user sees it); Backend: server-side logic, databases, APIs (user doesn't see it directly)

Explanation

Frontend (React, Vue, Angular): renders UI in the browser. Backend (Node.js, Django, Rails, Spring): handles business logic, database access, authentication. Full-stack developers work on both.

9

What is a framework in software development?

B

Correct Answer

A reusable software platform providing standardized structure, libraries, and patterns for building applications — developers fill in specific logic

Explanation

Frameworks (Django, React, Spring, Rails) provide the skeleton. Inversion of Control: the framework calls your code, not vice versa. Libraries: you call their code. Frameworks offer conventions reducing boilerplate.

10

What is responsive web design?

B

Correct Answer

A design approach making web pages render well on all screen sizes using flexible layouts, CSS media queries, and fluid images

Explanation

Responsive design (Ethan Marcotte 2010): fluid grids (%), flexible images, CSS media queries. Mobile-first approach designs for small screens first then scales up. Alternatives: adaptive design (multiple fixed layouts).

11

What is OOP (Object-Oriented Programming)?

B

Correct Answer

A programming paradigm organizing code into objects combining data (attributes) and behavior (methods), based on the principles of encapsulation, inheritance, and polymorphism

Explanation

OOP: classes define blueprints; objects are instances. Encapsulation hides internal state. Inheritance reuses behavior. Polymorphism allows different implementations of the same interface.

12

What is a design pattern?

B

Correct Answer

A reusable general solution to a commonly occurring problem in software design, formalized and named for communication

Explanation

Design patterns (GoF: Gang of Four) are categorized as Creational (Singleton, Factory), Structural (Adapter, Decorator), and Behavioral (Observer, Strategy). They communicate proven solutions concisely.

13

What is TDD (Test-Driven Development)?

B

Correct Answer

A development practice writing failing tests before code, then writing minimum code to pass, then refactoring — Red, Green, Refactor cycle

Explanation

TDD: write a failing test (Red) → write minimum code to pass (Green) → refactor cleanly. Ensures tests exist, keeps design simple, and catches regressions. Uncle Bob, Kent Beck advocate TDD.

14

What is CI/CD?

B

Correct Answer

Continuous Integration (automating builds/tests on every commit) and Continuous Deployment/Delivery (automating release pipeline)

Explanation

CI: developers merge to mainline frequently, triggering automated builds and tests. CD: automatically deploy passing builds to staging/production. Reduces integration hell and delivery risk. Tools: GitHub Actions, Jenkins, GitLab CI.

15

What is Docker and what problem does it solve?

B

Correct Answer

A platform packaging applications and dependencies into portable containers that run consistently across different environments

Explanation

Docker containers bundle app code + dependencies + OS libraries into an image. "Works on my machine" problem solved: same container runs in dev, CI, and production. Lighter than VMs (shared kernel).

16

What is a microservices architecture?

B

Correct Answer

An architectural style structuring an application as a collection of small, independently deployable services communicating via APIs

Explanation

Microservices (vs monolith): each service owns its data and can be deployed independently. Enables team autonomy, independent scaling, and technology diversity. Tradeoffs: distributed system complexity, network overhead.

17

What is GraphQL?

B

Correct Answer

A query language and runtime for APIs allowing clients to request exactly the data they need — no over-fetching or under-fetching

Explanation

GraphQL (Facebook, 2015): client specifies exactly what fields it needs. Single endpoint vs multiple REST endpoints. Supports queries, mutations, and subscriptions. Introspection enables self-documentation.

18

What is Kubernetes?

B

Correct Answer

An open-source container orchestration platform automating deployment, scaling, and management of containerized applications

Explanation

Kubernetes (k8s) manages container clusters: scheduling pods, scaling deployments, load balancing, rolling updates, self-healing. Helm for package management. Used to run microservices at scale.

19

What is a single-page application (SPA)?

B

Correct Answer

A web application loading a single HTML page and dynamically updating content via JavaScript without full page reloads

Explanation

SPAs (React, Vue, Angular) feel like native apps: routing, state management, and rendering in the browser. Tradeoffs: initial load (bundle size), SEO challenges (solved by SSR/SSG), client-side complexity.

20

What is SQL injection prevention?

B

Correct Answer

Using parameterized queries/prepared statements so user input is treated as data, never as executable SQL

Explanation

Parameterized queries: query = "SELECT * FROM users WHERE id = ?" with parameter ID. The DB driver escapes it. Never concatenate user input into SQL strings. ORM frameworks use parameterization by default.

21

What is caching in web development?

B

Correct Answer

Storing copies of expensive responses or computations to serve future requests faster, reducing latency and database/server load

Explanation

Caching layers: browser cache (HTTP headers), CDN cache (edge servers), application cache (Redis, Memcached), database query cache. Cache invalidation ("two hard things in CS") is the key challenge.

22

What is the difference between GET and POST HTTP methods?

B

Correct Answer

GET retrieves data (idempotent, params in URL, cacheable); POST sends data to create/modify (non-idempotent, data in body, not cached)

Explanation

GET: retrieve, safe (no side effects), idempotent, URL parameters visible in logs/history. POST: create/submit, not idempotent, body carries data. PUT/PATCH: update. DELETE: remove.

23

What is authentication vs authorization in web apps?

B

Correct Answer

Authentication: verify who you are (login). Authorization: verify what you can do (permissions/roles)

Explanation

Authentication: "Are you who you say you are?" — passwords, tokens, biometrics. Authorization: "Are you allowed to access this?" — RBAC, ACLs, JWT claims. Both are required for access control.

24

What is a webhook?

B

Correct Answer

An HTTP callback that notifies your application of events by sending HTTP POST requests to a configured URL when the event occurs

Explanation

Webhooks (reverse APIs / push APIs): instead of polling, the service calls your URL. Example: Stripe sends payment events to your webhook URL. You respond with 200 OK to acknowledge receipt.

25

What is CORS (Cross-Origin Resource Sharing)?

B

Correct Answer

A browser security mechanism controlling which origins can access resources on a server, using HTTP headers to allow/deny cross-origin requests

Explanation

Same-origin policy blocks cross-origin AJAX by default. CORS headers (Access-Control-Allow-Origin) allow the server to whitelist origins. Preflight OPTIONS request checks permissions for non-simple requests.

26

What is server-side rendering (SSR) vs client-side rendering (CSR)?

B

Correct Answer

SSR: HTML generated on server, sent to client (better SEO, faster first paint); CSR: JavaScript renders in browser (better interactivity, slower initial load)

Explanation

SSR (Next.js, Nuxt): HTML ready for SEO bots, fast FCP. CSR (CRA, Vite): full bundle first, then renders. SSG: pre-render at build time. ISR: regenerate on demand. Modern frameworks blend all approaches.

27

What is the MVC design pattern?

B

Correct Answer

Model-View-Controller — separates data (Model), presentation (View), and user interaction handling (Controller)

Explanation

MVC: Model (data, business logic), View (presentation, UI), Controller (handles requests, updates model/view). Used in Rails, Django, Spring MVC, Laravel. Enables separation of concerns and testability.

28

What is an ORM?

B

Correct Answer

Object-Relational Mapper — a library mapping database tables to programming language objects, abstracting SQL

Explanation

ORMs (Hibernate, SQLAlchemy, ActiveRecord, Eloquent) map tables to classes, rows to objects. Handle CRUD without raw SQL. Tradeoffs: N+1 query problem, less control vs raw SQL for complex queries.

29

What is JWT (JSON Web Token) authentication?

B

Correct Answer

A stateless authentication method using signed tokens containing user claims, eliminating server-side session storage

Explanation

JWT: header.payload.signature. Server signs with secret (HS256) or private key (RS256). Client sends JWT in Authorization header. Server verifies signature — no database lookup needed. Risk: can't be invalidated before expiry.

30

What is the purpose of package.json in Node.js?

B

Correct Answer

A file describing a project's dependencies, scripts, version, name, and metadata for npm/yarn package management

Explanation

package.json: dependencies (runtime), devDependencies (development only), scripts (start, test, build), version, main entry point. package-lock.json (npm) or yarn.lock pins exact versions for reproducible installs.

31

What is a CDN (Content Delivery Network)?

B

Correct Answer

A distributed network of servers caching and serving static assets (images, JS, CSS) from locations close to users, reducing latency

Explanation

CDNs (Cloudflare, CloudFront, Akamai) cache static assets at edge nodes worldwide. A user in Tokyo gets assets from a Tokyo node rather than a US origin server. Reduces latency from 200ms to <20ms.

32

What is Webpack?

B

Correct Answer

A module bundler for JavaScript applications that combines modules with their dependencies into optimized bundles for the browser

Explanation

Webpack (and modern alternatives: Vite, esbuild, Rollup) bundles JS/CSS/images into optimized files. Features: code splitting, tree shaking (dead code elimination), loaders (Babel for transpilation), hot module replacement.

33

What is semantic versioning (SemVer)?

B

Correct Answer

A versioning standard using MAJOR.MINOR.PATCH where MAJOR=breaking changes, MINOR=backward-compatible features, PATCH=bug fixes

Explanation

SemVer 2.0: 1.2.3 — major.minor.patch. Breaking change → increment major (reset minor/patch). New feature backward-compat → increment minor. Bug fix → increment patch. npm, pip, Cargo all use SemVer.

34

What is the difference between SQL and NoSQL databases for web apps?

B

Correct Answer

SQL: structured data with complex relationships and ACID transactions (e-commerce, banking); NoSQL: flexible schema, high throughput for unstructured/semi-structured data (social feeds, caching)

Explanation

Choose based on access patterns: complex queries/transactions → PostgreSQL, MySQL. Simple key-value lookups/caching → Redis. Document storage with flexible schema → MongoDB. Time-series → InfluxDB. Graph → Neo4j.

35

What is server-sent events (SSE)?

B

Correct Answer

A web API enabling servers to push real-time updates to clients over a persistent HTTP connection

Explanation

SSE (EventSource API) is a one-way push from server to client over HTTP. Simpler than WebSockets for read-only streams (live feeds, progress updates). WebSockets are bidirectional. Both enable real-time communication.

36

What is localStorage vs sessionStorage?

B

Correct Answer

Both store key-value pairs in the browser: localStorage persists until explicitly cleared; sessionStorage is cleared when the browser tab closes

Explanation

Web Storage API: localStorage (5-10MB, persistent, shared across tabs from same origin). sessionStorage (5MB, tab-scoped, cleared on tab close). Neither sends data to server (unlike cookies).

37

What is a progressive web app (PWA)?

B

Correct Answer

A web application using modern browser APIs (service workers, manifest) to provide native app-like experiences including offline support and installation

Explanation

PWAs use: Service Worker (background processing, offline cache), Web App Manifest (home screen install, splash screen), Push Notifications. Work on any browser/OS without an app store. Starbucks, Twitter Lite are examples.

38

What is technical debt?

B

Correct Answer

The implied cost of future work created by choosing a quick/easy solution now instead of a better but slower approach

Explanation

Technical debt: shortcuts taken for speed (hardcoded values, no tests, poor abstractions) accumulate "interest" — future changes take longer. Managing debt requires regular refactoring and code quality practices.

39

What is continuous integration?

B

Correct Answer

A development practice merging code to a shared repository frequently (daily), with automated builds and tests running on each merge

Explanation

CI catches integration bugs early by running tests on every commit. Tools: GitHub Actions, Jenkins, CircleCI, GitLab CI. Key: fast feedback, automated quality gates, a failing build requires immediate attention.

40

What does SOLID stand for in software development?

B

Correct Answer

Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion — five OOP design principles

Explanation

SOLID (Robert Martin): S=one reason to change, O=open for extension closed for modification, L=subtypes substitutable for base types, I=small focused interfaces, D=depend on abstractions not concretions.

1

What is event-driven architecture?

B

Correct Answer

An architecture pattern where components communicate by producing and consuming events via an event bus or message broker, enabling loose coupling

Explanation

Event-driven: producer emits event (order.placed), broker (Kafka, RabbitMQ) delivers to consumers (payment service, email service). Decoupled, scalable, but harder to debug causality chains.

2

What is CQRS (Command Query Responsibility Segregation)?

B

Correct Answer

An architectural pattern separating read (query) and write (command) models, enabling independent optimization and scaling of each

Explanation

CQRS: writes update the write model, which publishes events; reads use a denormalized read model optimized for queries. Often paired with Event Sourcing. Adds complexity but enables scalability and read optimization.

3

What is Event Sourcing?

B

Correct Answer

Storing state changes as an immutable sequence of events rather than current state, enabling full audit history and state reconstruction

Explanation

Event sourcing: append events (OrderCreated, OrderShipped) to an event log. Current state = replay of events. Benefits: complete audit trail, temporal queries, easy debugging. Used with CQRS and Kafka.

4

What is the Dependency Inversion Principle?

B

Correct Answer

High-level modules should not depend on low-level modules; both should depend on abstractions (interfaces), and abstractions should not depend on details

Explanation

DIP enables loose coupling: UserService depends on IUserRepository (interface), not MySQLUserRepository (concrete). Concrete implementation injected via DI. Enables testing with mocks and swapping implementations.

5

What is dependency injection (DI)?

B

Correct Answer

A design pattern providing a class its dependencies from outside (via constructor, setter, or interface) rather than having the class create them

Explanation

DI: class declares what it needs; a DI container or caller provides it. Enables loose coupling and testability (inject mocks). DI containers (Spring, Dagger, Autofac) manage object graphs automatically.

6

What is the difference between horizontal and vertical scaling?

B

Correct Answer

Vertical: adding more resources to one server (bigger machine); Horizontal: adding more servers (scale out) — horizontal scales further but requires stateless architecture

Explanation

Vertical (scale up): more CPU/RAM — simple but limited. Horizontal (scale out): more servers — requires stateless apps, load balancers, distributed state. Cloud-native apps are designed for horizontal scaling.

7

What is an idempotent operation?

B

Correct Answer

An operation that produces the same result whether executed once or multiple times — critical for safe retries in distributed systems

Explanation

Idempotency: PUT request applying the same update multiple times has the same effect as once. GET is idempotent. POST usually isn't (creates duplicate records). Essential for retry safety in distributed systems.

8

What is the 12-Factor App methodology?

B

Correct Answer

A methodology for building scalable, maintainable SaaS apps with 12 principles including config in env, stateless processes, and disposable servers

Explanation

12-Factor (Heroku): 1) Codebase 2) Dependencies 3) Config 4) Backing services 5) Build/release/run 6) Processes (stateless) 7) Port binding 8) Concurrency 9) Disposability 10) Dev/prod parity 11) Logs 12) Admin processes.

9

What is service mesh?

B

Correct Answer

A dedicated infrastructure layer managing service-to-service communication: load balancing, service discovery, TLS, retries, circuit breaking, observability

Explanation

Service meshes (Istio, Linkerd, Consul) inject sidecar proxies (Envoy) alongside each service. Capabilities: mutual TLS (mTLS), traffic shaping, distributed tracing, circuit breaking — without application code changes.

10

What is eventual consistency in distributed systems?

B

Correct Answer

A consistency model where the system guarantees all nodes will eventually have the same value if no new updates occur, accepting temporary inconsistency

Explanation

Eventual consistency (DNS, Amazon DynamoDB): updates propagate asynchronously — reads may see stale data temporarily. Highly available but requires application-level conflict resolution. Strong consistency (ACID, CP systems) sacrifices availability.

11

What is the circuit breaker pattern?

B

Correct Answer

A pattern that stops calling a failing service to prevent cascading failures, automatically retrying after a recovery period

Explanation

Circuit breaker (Hystrix, Resilience4j): CLOSED (normal), OPEN (failing — reject calls immediately), HALF-OPEN (test one request). Prevents cascading failures when a dependency is down.

12

What is blue-green deployment?

B

Correct Answer

A deployment strategy maintaining two identical production environments, routing all traffic to blue while deploying to green, then switching instantly with easy rollback

Explanation

Blue-green: switch load balancer from blue (current) to green (new). Instant rollback by switching back. Requires double infrastructure. Alternative: canary deployment (gradually shift traffic %) for lower risk.

13

What is strangler fig pattern in migration?

B

Correct Answer

A migration pattern incrementally replacing a monolith by routing new functionality to new services while legacy handles the rest, gradually strangling the old system

Explanation

Strangler Fig (Martin Fowler): create new service for specific features, redirect those requests, keep the monolith for the rest. Over time, more features migrate. Avoids risky big-bang rewrites.

14

What is infrastructure as code (IaC)?

B

Correct Answer

Managing and provisioning infrastructure through machine-readable configuration files (Terraform, CloudFormation) rather than manual UI/CLI operations

Explanation

IaC (Terraform, Pulumi, Ansible, CloudFormation): version-control infrastructure, peer-review changes, reproducible environments. Prevents configuration drift and enables disaster recovery.

15

What is the observer pattern?

B

Correct Answer

A behavioral pattern where objects (observers) subscribe to notifications from a subject, which notifies all registered observers when its state changes

Explanation

Observer pattern (publish-subscribe): EventEmitter in Node.js, addEventListener in DOM, @Output in Angular. The subject doesn't know who its observers are — loose coupling. Foundation for reactive programming.

16

What is the difference between monorepo and polyrepo?

B

Correct Answer

Monorepo: all code in one repo (atomic commits across services, shared tooling); Polyrepo: each service has its own repo (independent deployments, less coupling)

Explanation

Monorepo (Google, Meta, Microsoft, Nx, Turborepo): atomic cross-project changes, shared tooling, unified testing. Polyrepo: team autonomy, independent versioning. No universal winner; depends on team size and coupling needs.

17

What is server-side rendering with hydration?

B

Correct Answer

SSR sends pre-rendered HTML for fast FCP, then JavaScript hydrates it — attaching event listeners and making it interactive without re-rendering

Explanation

Hydration: server renders HTML (fast visible content), client downloads JS bundle, React/Vue hydrates existing DOM (attaches event handlers). Partial hydration (Islands Architecture) hydrates only interactive components.

18

What is the CAP theorem's impact on web service design?

B

Correct Answer

Web services must trade off between consistency and availability during network partitions — most web services choose AP (availability+partition) with eventual consistency

Explanation

AP systems (most web services): remain available with eventual consistency during partitions. CP systems (financial: bank balances): refuse service rather than return stale data. Choice drives architecture decisions.

19

What is the saga pattern for distributed transactions?

B

Correct Answer

A pattern managing distributed transactions as a sequence of local transactions with compensating transactions for rollback on failure, avoiding 2PC

Explanation

Saga: each step is a local DB transaction + event. On failure, compensating transactions undo previous steps. Choreography: services react to events. Orchestration: a central coordinator directs. Used in e-commerce orders.

20

What is OAuth 2.0 PKCE (Proof Key for Code Exchange)?

B

Correct Answer

A security extension for OAuth 2.0 public clients (SPAs, mobile) using code verifier and code challenge to prevent authorization code interception attacks

Explanation

PKCE: client generates random code_verifier, sends SHA256 hash (code_challenge) in auth request. After redirect, sends code_verifier with token request — proves the token requester is the auth initiator.

21

What is the difference between REST and gRPC?

B

Correct Answer

REST uses HTTP/JSON (human-readable, widely supported); gRPC uses HTTP/2 + Protocol Buffers (binary, strongly typed, efficient for microservices)

Explanation

gRPC (Google): IDL defines services, Protobuf serializes efficiently (5-10x smaller than JSON), HTTP/2 enables multiplexing and streaming. Ideal for internal microservices. REST: better browser support, human-readable.

22

How does a load balancer decide which backend server should handle an incoming request?

C

Correct Answer

It applies an algorithm such as round-robin, least-connections, or weighted/IP-hash, often combined with health checks that remove unhealthy servers from rotation

Explanation

Load balancers (Nginx, HAProxy, AWS ELB) use selection algorithms like round-robin, least connections, weighted distribution, or IP hashing for session affinity, and continuously run health checks so traffic is not routed to failing instances.

23

What is database connection pooling and why do web applications use it?

C

Correct Answer

Maintaining a reusable set of open database connections so requests can borrow and return them instead of paying the cost of opening a new connection for every query, improving throughput under load

Explanation

Opening a new TCP connection and authenticating with the database for every request is expensive. Connection pools (PgBouncer, HikariCP, Laravel's persistent connections) keep a set of warm connections that requests borrow and return, reducing latency and preventing resource exhaustion under load.

24

When writing unit tests, what is the main purpose of using mocks and stubs for external dependencies?

A

Correct Answer

To replace real collaborators (databases, APIs, file systems) with controlled fakes so the test runs fast, deterministically, and in isolation from things you don't control

Explanation

Mocks and stubs stand in for slow or unpredictable collaborators (a payment gateway, a database) so a unit test can verify behavior in isolation, run quickly, and produce the same result every time it runs.

25

In Git, what is the practical difference between `git merge` and `git rebase` when integrating a feature branch into main?

C

Correct Answer

`git merge` creates a merge commit that preserves both histories as they happened, while `git rebase` rewrites the feature branch's commits on top of main, producing a linear history

Explanation

Merge records a new commit joining two histories, keeping an accurate (if branchy) record of what happened. Rebase replays your commits onto the tip of main, yielding a cleaner linear history but rewriting commit hashes — risky on shared branches.

26

What is the main advantage of the repository pattern in a layered application?

D

Correct Answer

It abstracts data-access logic behind an interface, so business logic does not depend on a specific persistence technology and can be tested with an in-memory fake

Explanation

A repository (e.g., OrderRepository) exposes methods like find() and save() while hiding whether data comes from MySQL, MongoDB, or an API. Swapping the underlying store or substituting a fake for tests does not require touching business logic.

27

What does it mean for an HTTP API to support pagination, and why is it important for large collections?

B

Correct Answer

It means responses are split into pages (using parameters like `page`/`limit` or cursors), letting clients fetch large collections incrementally instead of loading everything at once, reducing memory use and latency

Explanation

Pagination (offset-based with page/limit, or cursor-based for large/changing datasets) lets an API return manageable chunks of data, which keeps response payloads small, reduces server load, and improves perceived performance for the client.

28

What is a race condition in concurrent or multi-threaded web application code?

A

Correct Answer

A bug where the outcome of an operation depends on the unpredictable timing or interleaving of concurrent operations accessing shared state, producing inconsistent results

Explanation

A race condition occurs when two or more operations read and write shared data concurrently and the final result depends on execution order — for example, two requests incrementing a counter at the same time and one update being lost. Locks, atomic operations, and transactions prevent it.

29

What is the strangler-fig-friendly practice of feature toggling combined with trunk-based development primarily meant to achieve?

A

Correct Answer

Allowing developers to merge incomplete work into the main branch frequently while keeping unfinished features hidden from users until they are ready, reducing long-lived branches and merge conflicts

Explanation

Trunk-based development keeps everyone merging small changes into a shared main branch frequently. Feature flags let half-finished work ship to production hidden behind a toggle, avoiding the integration pain of long-lived feature branches.

30

What problem does rate limiting solve for a public web API?

D

Correct Answer

It caps how many requests a client can make in a given time window, protecting the service from abuse, accidental overload, and ensuring fair resource usage among consumers

Explanation

Rate limiting (token bucket, sliding window, fixed window algorithms) restricts request volume per client/IP/API key over time. It protects backend resources from being overwhelmed and keeps the service fair and available for all consumers.

31

In automated testing, what distinguishes an integration test from a unit test?

A

Correct Answer

Integration tests check how multiple components or systems (e.g., application code plus a real database or external service) work together, while unit tests isolate and verify a single function or class in isolation

Explanation

Unit tests isolate a single piece of logic (often using mocks for collaborators) and run very fast. Integration tests exercise the interaction between real components — application code with a real database, message queue, or third-party API — catching issues unit tests miss.

32

What is the purpose of database indexing, and what is its main tradeoff?

C

Correct Answer

Indexes speed up read queries that filter or sort on indexed columns by avoiding full table scans, but they add storage overhead and slow down writes because each index must be updated on insert/update/delete

Explanation

A database index is a data structure (commonly a B-tree) that lets the engine locate rows quickly without scanning every row. The cost is extra disk space and slower writes, since every indexed column must be kept in sync whenever a row changes.

33

What is the main purpose of a staging environment in a software delivery pipeline?

A

Correct Answer

A mirror of production used to validate a release with realistic data and configuration before it reaches real users, catching environment-specific issues that local development might miss

Explanation

Staging closely mirrors production (same infrastructure, similar data volume, same configuration patterns) so a team can catch deployment, integration, and configuration issues before they affect real users — a step beyond local development and automated CI test runs.

34

What does "DRY" mean as a software design principle, and what is a risk of over-applying it?

A

Correct Answer

"Don't Repeat Yourself" — extract duplicated logic into shared functions or modules; over-applying it can produce premature, overly generic abstractions that are harder to understand and change than the duplication they replaced

Explanation

DRY encourages factoring out duplicated logic into a single, well-named place so changes happen in one spot. Taken too far, it can produce a tangled abstraction shared by unrelated use cases — sometimes a little duplication is easier to evolve than a forced abstraction (the "wrong abstraction" problem).

35

What is the main benefit of writing API documentation using a specification format like OpenAPI (Swagger)?

D

Correct Answer

It provides a machine-readable contract describing endpoints, request/response shapes, and authentication, enabling auto-generated docs, client SDKs, mock servers, and contract testing

Explanation

OpenAPI describes an API in a structured, machine-readable YAML/JSON document. Tooling can then generate interactive documentation (Swagger UI), client libraries in multiple languages, mock servers for early frontend development, and contract tests that verify the implementation matches the spec.

36

What is the strategy pattern used for in object-oriented software design?

B

Correct Answer

Defining a family of interchangeable algorithms or behaviors, encapsulating each one, and allowing the algorithm to be selected and swapped at runtime without changing the code that uses it

Explanation

The strategy pattern lets you define several interchangeable behaviors (e.g., different sorting or pricing algorithms) behind a common interface, and choose or swap the concrete implementation at runtime — avoiding large conditional blocks and making new behaviors easy to add.

37

In a typical CI pipeline, what does a "code coverage" metric measure, and what is its main limitation?

A

Correct Answer

It measures the percentage of source code lines or branches exercised by automated tests; high coverage shows code was executed during tests, but it does not guarantee the tests actually assert correct behavior

Explanation

Code coverage tools (Istanbul, JaCoCo, PHPUnit coverage) report what percentage of code paths ran during tests. A high number means code was executed, but tests without meaningful assertions can still show 100% coverage while verifying nothing — coverage is a useful signal, not a quality guarantee.

38

What is the purpose of database migrations in a software project?

B

Correct Answer

Version-controlled, incremental scripts that evolve a database schema over time in a repeatable, trackable way, so every environment (dev, staging, production) can apply the same changes in the same order

Explanation

Migrations (Laravel, Rails ActiveRecord, Django, Flyway) are ordered, version-controlled files describing schema changes — creating tables, adding columns, etc. Running them in sequence keeps every environment's schema consistent and lets teams track and roll back changes like any other code.

39

What is the main goal of code review as a software engineering practice?

D

Correct Answer

To catch defects, share knowledge across the team, maintain consistency, and improve code quality through a second set of eyes before changes are merged

Explanation

Code review (pull requests on GitHub/GitLab) catches bugs and design issues early, spreads knowledge of the codebase across the team, enforces consistent style and standards, and serves as a teaching opportunity for both reviewer and author — well beyond simply finding faults.

40

What does it mean for a software system to be "loosely coupled," and why do engineers favor it?

A

Correct Answer

It means components have minimal knowledge of each other's internal details and interact through well-defined interfaces, so one component can change, be replaced, or fail without forcing changes throughout the rest of the system

Explanation

Loose coupling means components depend on stable contracts (interfaces, APIs, message formats) rather than each other's internals. This makes systems easier to change, test independently, deploy separately, and replace piece by piece without a cascade of breakages.

1

What is the CQRS + Event Sourcing combination and its challenges?

B

Correct Answer

Events are the source of truth (ES); commands mutate state by appending events; read models are projections of events (CQRS) — powerful but adds operational complexity

Explanation

ES+CQRS: append-only event store, project events to multiple read models optimized for different queries. Challenges: event schema evolution, eventual consistency lag, projection rebuilds, operational complexity.

2

What is a content security policy (CSP) and how does it prevent XSS?

B

Correct Answer

An HTTP response header instructing browsers which content sources are trusted, blocking inline scripts and unauthorized origins that could execute XSS payloads

Explanation

CSP: Content-Security-Policy: default-src 'self'; script-src cdn.example.com. Blocks inline scripts (unsafe-inline) and eval(). Nonces/hashes allow specific inline scripts. Makes XSS exploitation much harder even if code is injected.

3

What is the difference between compile-time and runtime polymorphism?

B

Correct Answer

Compile-time (static): method overloading, generics — resolved at compile time. Runtime (dynamic): method overriding via virtual dispatch — resolved at runtime based on actual object type

Explanation

Compile-time (early binding): C++ templates, Java generics, function overloading. Runtime (late binding): virtual method calls through vtables/dispatch tables. Java interfaces, C++ virtual enable runtime polymorphism.

4

What is HTTP/3 and QUIC and their impact on web performance?

B

Correct Answer

HTTP/3 runs over QUIC (UDP-based), eliminating TCP head-of-line blocking, enabling connection migration, and providing 0-RTT reconnection — improving performance on mobile/lossy networks

Explanation

HTTP/3 (RFC 9114) over QUIC (RFC 9000): per-stream loss recovery (no HoL blocking), connection migration (IP change without reconnecting), 0-RTT resumption. Adopted by Cloudflare, Google, Meta.

5

What is a reactive system and what properties define it?

B

Correct Answer

Systems defined by the Reactive Manifesto: Responsive (fast response), Resilient (stays available under failure), Elastic (scales), Message-driven (async non-blocking)

Explanation

Reactive Manifesto (2013): responsive under load, resilient under failure (replication, isolation), elastic (scales up/down), message-driven (location transparency, back-pressure). Implemented by Akka, RxJava, Project Reactor.

6

What is the difference between symmetric and asymmetric session keys in TLS?

B

Correct Answer

Asymmetric keys (RSA/ECDH) are used only for key exchange in the handshake; then symmetric keys (AES) are derived and used for bulk data encryption — much faster

Explanation

TLS handshake: ECDHE generates a shared secret using asymmetric math. From this shared secret, HKDF derives symmetric session keys for AES-GCM bulk encryption. Asymmetric crypto is 100-1000x slower than symmetric.

7

What is tail latency and why does it matter for web services?

B

Correct Answer

The high percentile latencies (P99, P999) — the slowest 1% or 0.1% of requests — which disproportionately affect user experience and cascade in microservices

Explanation

In a service with 10 dependencies, P99 of the slowest is ~1-(0.99^10) ≈ 10% slow requests at the edge. "The Long Tail of Latency" (Google): optimize P99, not just average. Techniques: timeouts, hedged requests, tail-cutting.

8

What is a bounded context in Domain-Driven Design?

B

Correct Answer

DDD: a boundary within which a particular domain model applies — same term may mean different things in different bounded contexts (e.g., User in Auth vs Billing)

Explanation

Bounded contexts map to teams and services. Context mapping: shared kernel, customer-supplier, anticorruption layer. Ubiquitous language is consistent within a context. Prevents semantic confusion across large domains.

9

What is WebAssembly (WASM) and what does it enable?

B

Correct Answer

A binary instruction format running near-native speed in browsers, enabling high-performance code from C/C++/Rust to run alongside JavaScript

Explanation

WASM enables compute-intensive code (image editing, 3D rendering, video encoding, games) in browsers at near-native speed. AutoCAD, Figma, Google Earth use WASM. WASI extends it to server-side.

10

What is the Saga pattern orchestration vs choreography?

B

Correct Answer

Orchestration: a central coordinator directs each step (easier to trace, single point of failure). Choreography: services react to each other's events (decoupled, harder to debug)

Explanation

Orchestration saga (Temporal, AWS Step Functions): workflow coordinator calls services and handles failures. Choreography saga (Kafka events): each service does its work and emits events; others react. Choose based on complexity and coupling requirements.

11

What is the difference between synchronous and asynchronous communication in microservices?

B

Correct Answer

Synchronous (REST/gRPC): request waits for response — simple, immediate, but couples availability. Asynchronous (Kafka, RabbitMQ): fire-and-forget — decoupled, resilient, but adds complexity

Explanation

Sync: service A waits for service B's response — if B is down, A fails. Async: A publishes to Kafka, B consumes when ready — temporal decoupling. Choose async for resilience; sync for simplicity when coupling is acceptable.

12

What is a feature flag and how does it enable continuous deployment?

B

Correct Answer

Runtime configuration enabling/disabling features without deployment, allowing incremental rollout, A/B testing, and instant rollback of problematic features

Explanation

Feature flags (LaunchDarkly, Split, Unleash): deploy code dark (disabled), enable for % of users, monitor, roll back by toggle — not by reverting code. Enables trunk-based development and continuous deployment safely.

13

What is API gateway pattern in microservices?

B

Correct Answer

A single entry point for all clients, handling cross-cutting concerns: authentication, rate limiting, logging, request routing, protocol translation, and response aggregation

Explanation

API gateways (Kong, AWS API Gateway, Nginx): off-load auth, rate limiting, TLS termination from services. Backend-For-Frontend (BFF) pattern: specialized gateways per client type (mobile, web, partner APIs) with different data shapes.

14

What is a chaos engineering practice?

B

Correct Answer

Deliberately injecting failures into production systems to test resilience, discover weaknesses before users do, and build confidence in system reliability

Explanation

Chaos engineering (Netflix Chaos Monkey, Gremlin): deliberately kill servers, inject network latency, corrupt data. Principles: build hypotheses about steady-state, inject chaos, observe, improve. GameDays test incident response.

15

What is the difference between stateful and stateless microservices?

B

Correct Answer

Stateless services store no session data locally (can be scaled/replaced freely); stateful services maintain state (harder to scale, require sticky sessions or distributed state management)

Explanation

Stateless (ideal): any instance handles any request. Scale horizontally, restart freely. Stateful: session/cart data must go to the same instance or external state store (Redis). 12-factor mandates stateless processes.

16

What is observability in distributed systems?

B

Correct Answer

The ability to infer internal system states from external outputs using the three pillars: metrics (what), logs (why), and traces (where) for distributed systems debugging

Explanation

Observability (CNCF): Metrics (Prometheus/Grafana: counters, gauges, histograms), Logs (structured: JSON, correlated with trace IDs), Distributed Tracing (Jaeger, Zipkin: end-to-end request flows). OpenTelemetry standardizes collection.

17

What is a saga's compensating transaction and when is it not possible?

B

Correct Answer

A business-level undo operation (e.g., refund payment, unbook hotel) to reverse a completed step — not always possible for side effects like sending emails

Explanation

Compensating transactions undo the business effect of a step. Challenges: some effects are irreversible (sending email, SMS, physically dispatching goods). Design sagas with reversibility in mind; for irreversible steps, use careful sequencing.

18

What is the Twelve-Factor methodology's stance on configuration?

B

Correct Answer

Configuration must be stored in environment variables (not code or config files in the repo), enabling deployment to different environments without code changes

Explanation

12-Factor Factor III: config in env. Different environments (dev, staging, prod) have different values for database URLs, API keys, feature flags. Env vars are external to code, never committed, and work across languages and OSes.

19

In distributed systems, what is the "thundering herd" problem and what is a common mitigation?

C

Correct Answer

Many clients waking up and hitting a resource at once — e.g. when a hot cache key expires — overwhelming it; mitigated with jittered expiration, request coalescing, or a lock so only one caller repopulates it

Explanation

When a hot cache entry expires, every concurrent request can simultaneously fall through to the origin (database or backend service), causing a spike that can crash it. Adding random jitter to expiration times, coalescing duplicate in-flight requests, or locking so only one request recomputes the value are standard mitigations.

20

What is backpressure in a streaming or message-driven system, and why does it matter?

A

Correct Answer

A mechanism allowing a slow consumer to signal a fast producer to slow down or buffer, preventing the consumer from being overwhelmed and the system from running out of memory or dropping messages uncontrollably

Explanation

Without backpressure, a fast producer can flood a slower consumer, causing unbounded queues, memory exhaustion, or dropped messages. Reactive Streams, RxJava, and message brokers implement backpressure so consumers can request data at a sustainable rate, keeping the whole pipeline stable under load.