First 50 of 200 questions. Each one lists the choices, the correct answer, and an explanation. The checker at the top of this page saves progress in this browser when it is available.
Continue in the practice tool above to load more questions, 50 at a time.
Question 1Software Development Fundamentals
In a Git repository, a developer wants to record the staged snapshot of a feature branch permanently in the project history. Which Git command performs this action?
- git merge
- git push
- git add
- git commit Correct answer.
Explanation
A commit takes the contents currently staged in the index and writes them as a new immutable snapshot on the current branch, along with a message and parent pointer. Staging prepares changes, pushing transfers commits to a remote, and merging combines histories, so only commit records the snapshot locally.
Question 2Software Development Fundamentals
A team uses a branching model where each new feature is developed on its own branch and later integrated into main. Which practice best supports this workflow?
- Sharing a single long-running branch among all developers
- Avoiding branches and relying on file copies for versions
- Committing directly to main for every small change
- Creating a short-lived feature branch and merging it through a pull request Correct answer.
Explanation
Feature branches isolate work in progress so main stays deployable, and pull requests add review and automated checks before integration. Short-lived branches reduce merge conflicts compared with long-running shared branches.
Question 3Software Development Fundamentals
Which HTTP status code family indicates that a client request succeeded and the server is returning the expected representation?
- 5xx
- 1xx
- 2xx Correct answer.
- 4xx
Explanation
The 2xx class signals successful processing, for example 200 OK or 201 Created. The other classes communicate informational progress, client errors, or server errors rather than success.
Question 4Software Development Fundamentals
A REST API exposes resources at paths such as /customers/42/orders. Which architectural constraint does this path design primarily reflect?
- Layered system intermediaries
- Statelessness of each request
- Code on demand
- Resource-oriented identification through URIs Correct answer.
Explanation
REST models the domain as resources, each addressable by a uniform identifier. Nesting orders under a specific customer expresses that relationship in the URI rather than in a remote procedure call name.
Question 5Software Development Fundamentals
In a relational database, which SQL clause is used to filter individual rows before grouping, whereas HAVING filters groups after aggregation?
- GROUP BY
- WHERE Correct answer.
- ORDER BY
- JOIN
Explanation
The WHERE clause restricts rows before aggregation, so aggregate functions cannot be used there. HAVING applies to grouped results, which is why it can reference aggregate expressions such as COUNT or SUM.
Question 6Software Development Fundamentals
A developer writes CSS rules for a button: an element selector, a class selector, and an ID selector all target the same property. Which rule wins when the selectors are otherwise equally specific in origin and importance?
- The class selector
- The element selector
- The rule declared last in the file regardless of selector type
- The ID selector Correct answer.
Explanation
Specificity ranks ID selectors above class selectors, which rank above element selectors. Source order only breaks ties between selectors of equal specificity, so the ID rule takes precedence here.
Question 7Software Development Fundamentals
In JavaScript, what is the primary difference between let and var for a variable declared inside a block?
- var is block-scoped, while let is function-scoped
- Both are block-scoped but var is hoisted
- let prevents reassignment while var allows it
- let is block-scoped, while var is function-scoped Correct answer.
Explanation
A let declaration is confined to the nearest enclosing block, so it is not visible outside that block. A var declaration is scoped to the enclosing function or global scope, which is why it can leak out of loops and if blocks.
Question 8Software Development Fundamentals
A function in a JavaScript module is exported with a named export. Which statement correctly imports it into another module?
- import { myFunc } from './mod.js'; Correct answer.
- export { myFunc } from './mod.js';
- const x = require('./mod')
- import myFunc = './mod.js';
Explanation
Named exports are imported with curly braces that list the exported binding names, using ES module import syntax. The require form belongs to CommonJS, and the other options are not valid ES module import statements.
Question 9Software Development Fundamentals
Which Node.js characteristic makes it well suited to handling many concurrent I/O-bound connections?
- It requires synchronous file reads for correctness
- It runs each request on a dedicated OS thread
- It uses a single-threaded event loop with non-blocking I/O Correct answer.
- It compiles JavaScript to native machine code ahead of time
Explanation
Node.js executes JavaScript on one main thread and delegates I/O to the operating system, resuming callbacks through the event loop. This avoids blocking a thread per connection, so many idle connections are handled efficiently.
Question 10Software Development Fundamentals
An Express route handler calls res.json(data). What effect does this have on the HTTP response?
- It writes data to the server log for debugging
- It parses an incoming JSON request body
- It sets the Content-Type to application/json and sends the serialized body Correct answer.
- It redirects the client to a JSON endpoint
Explanation
res.json serializes the value to JSON, sets the Content-Type header to application/json, and ends the response. Parsing request bodies is handled by middleware such as express.json, not by res.json.
Question 11Software Development Fundamentals
Which HTTP method is conventionally used to replace an existing resource with the provided representation, where repeating the request yields the same state?
- GET
- POST
- PATCH
- PUT Correct answer.
Explanation
PUT replaces the target resource with the enclosed representation, and repeating an identical request produces the same result, making it idempotent. POST creates subordinate resources and is not idempotent, while PATCH applies partial modifications.
Question 12Software Development Fundamentals
A web page must display user-supplied text without allowing injected script tags to execute. Which approach should the developer choose?
- Insert the text using textContent Correct answer.
- Insert the text with innerHTML after escaping only quotes
- Encode the text in a data attribute and eval it at runtime
- Store the text in a cookie and render it with document.write
Explanation
Setting textContent treats the value as plain text, so characters such as angle brackets are displayed rather than parsed as markup. This prevents script injection because the browser never interprets the content as HTML.
Question 13Software Development Fundamentals
Which practice most directly protects a password database if the stored hashes are later exposed?
- Limiting login attempts to ten per hour
- Storing passwords with reversible symmetric encryption
- Hashing passwords with a slow, salted algorithm such as bcrypt Correct answer.
- Encrypting the database backups with a shared key
Explanation
A slow salted hash makes offline guessing expensive and ensures identical passwords produce different hashes. Rate limiting and backups help operationally but do not protect the hashes themselves once an attacker holds them.
Question 14Software Development Fundamentals
Which statement correctly describes the difference between authentication and authorization?
- Authorization verifies identity, while authentication determines permitted actions
- Authentication verifies identity, while authorization determines permitted actions Correct answer.
- Authentication applies only to APIs and authorization only to web pages
- Both terms describe the same check performed at login
Explanation
Authentication answers who the principal is, typically through credentials or tokens. Authorization then decides which resources or operations that identified principal may access, for example through roles or scopes.
Question 15Software Development Fundamentals
In a microservices architecture, which problem does an API gateway primarily solve for clients?
- It eliminates the need for service-to-service authentication
- It stores all service data in a single shared schema
- It provides a single entry point that routes and aggregates calls to backend services Correct answer.
- It guarantees strong consistency across service databases
Explanation
An API gateway gives clients one stable endpoint and handles routing, protocol translation, and cross-cutting concerns such as rate limiting. It does not unify data storage or remove the need for internal authentication between services.
Question 16Software Development Fundamentals
A container image for a Node.js service should be built so that rebuilding after a source code change reuses cached dependency installation. Which Dockerfile ordering achieves this?
- Copy package.json and package-lock.json, run npm install, then copy the source Correct answer.
- Run npm install and copy the source in a single RUN instruction
- Run npm install before copying package.json
- Copy all source files first, then run npm install
Explanation
Docker caches each layer and invalidates it when its inputs change. Copying only the manifest files before installing dependencies means source edits do not invalidate the dependency layer, so npm install is reused from cache.
Question 17Software Development Fundamentals
In Kubernetes, a Deployment is configured with three replicas and one pod crashes. What does the controller do?
- It stops the remaining pods until an operator intervenes
- It promotes one of the remaining pods to run two containers
- It converts the Deployment into a DaemonSet
- It creates a replacement pod to restore the desired replica count Correct answer.
Explanation
A Deployment manages a ReplicaSet that continuously reconciles observed state with the declared replica count. When a pod is lost, the controller schedules a new pod so that three healthy replicas exist again.
Question 18Software Development Fundamentals
Which cloud design choice best supports the goal of loose coupling between a web tier and a background image-processing tier?
- The processing tier polls the web tier's database every second for new rows
- The web tier writes jobs directly into the processing tier's local filesystem
- Both tiers share a single relational table with row locks
- The web tier publishes jobs to a managed message queue consumed by the processing tier Correct answer.
Explanation
A message queue decouples producer and consumer in time and space, letting each tier scale and fail independently. Direct filesystem access and tight database polling create runtime dependencies that undermine that independence.
Question 19Software Development Fundamentals
A developer needs to store session tokens so they are not readable by JavaScript running on the page. Which browser storage mechanism should be used?
- sessionStorage
- A global JavaScript variable
- An HttpOnly cookie Correct answer.
- localStorage
Explanation
The HttpOnly attribute prevents client-side scripts from reading the cookie, which reduces exposure if cross-site scripting occurs. Web Storage and in-memory variables are all accessible to JavaScript on the page.
Question 20Software Development Fundamentals
A developer writes a unit test that depends on the current date. Which technique makes the test deterministic?
- Compare against a value captured from yesterday's run
- Inject a clock or freeze time through a test double Correct answer.
- Add a random sleep before the assertion
- Rerun the test until it passes
Explanation
Injecting a controllable clock replaces the real time source, so the test always observes the same value. Deterministic tests must not depend on wall-clock time, network access, or execution order.
Question 21Software Development Fundamentals
In a CI/CD pipeline, which stage should run immediately after code is committed to a shared branch to give fast feedback?
- Quarterly dependency audit
- Manual production deployment
- Automated build and unit tests Correct answer.
- Database schema migration on production
Explanation
Build and unit tests are fast and catch most integration errors early, so they belong at the start of the pipeline. Production changes and slow audits should occur later or on a separate schedule.
Question 22Software Development Fundamentals
A REST endpoint returns a large collection that clients page through. Which response design best allows a client to fetch the next page reliably while data changes?
- Return a cursor or opaque token pointing to the next page Correct answer.
- Return only the first page and require a full refetch for later pages
- Return the entire collection and let the client slice it
- Return a random sample of records on each request
Explanation
Cursor-based pagination anchors the next request to a stable position in the result set, so inserts or deletes do not shift items across pages as offset paging can. The token hides the underlying ordering from the client.
Question 23Software Development Fundamentals
A SQL query joining a large orders table to a small customers table is slow. The orders table has no index on customer_id. Which change is most likely to improve performance?
- Convert the join to a cross join
- Select all columns with SELECT *
- Add an index on orders.customer_id Correct answer.
- Remove the customers table from the query
Explanation
An index on the join key lets the database locate matching orders without scanning the whole table for each customer. Removing or cross-joining tables changes results rather than optimizing the intended query.
Question 24Software Development Fundamentals
A developer must choose between a relational database and a document store for an application with highly variable, nested records and few cross-record transactions. Which choice is most defensible?
- A relational database, because normalization is always required
- A relational database, because it cannot store JSON
- A document store, because it guarantees ACID transactions across collections by default
- A document store, because flexible schemas fit nested, variable records Correct answer.
Explanation
Document stores let each record carry its own shape and nest related data, which suits variable structures without a rigid schema. Relational databases remain preferable when multi-entity transactions and strong relational integrity dominate.
Question 25Software Development Fundamentals
A React component receives props and needs to display derived data that should be recalculated only when a specific prop changes. Which approach avoids unnecessary recomputation?
- Recompute the value on every render without memoization
- Use useMemo with the specific prop in the dependency array Correct answer.
- Call setState during render to force recalculation
- Store the derived value in a module-level global variable
Explanation
useMemo caches the computed value and recomputes only when a dependency changes, so listing the relevant prop limits work to actual changes. Module-level state and render-time state updates introduce bugs and do not target the dependency.
Question 26Software Development Fundamentals
In the context of the software development life cycle, what does the term 'technical debt' most precisely describe?
- The total budget allocated to buying development tools, licenses, and cloud infrastructure
- The time a developer spends learning a new programming language before starting a project
- The extra cost of future rework caused by choosing an expedient implementation now instead of a better design Correct answer.
- The number of unresolved bug tickets currently assigned to a development team
Explanation
Technical debt is a metaphor for the future cost incurred when a shortcut or suboptimal design is chosen to deliver quickly. Like financial debt, it accrues 'interest' in the form of harder maintenance and slower changes until it is repaid through refactoring. It is not a monetary budget, a bug count, or a learning cost.
Question 27Software Development Fundamentals
A development team adopts an Agile process. Which artifact is intended to hold the ordered list of everything that might be built into the product?
- The product backlog Correct answer.
- The burn-down chart
- The definition of done
- The sprint retrospective notes
Explanation
The product backlog is the single ordered list of desired work, features, and fixes maintained by the product owner. Items near the top are refined for near-term delivery, while lower items may be vague. The other artifacts track process health, quality criteria, or progress rather than the scope of potential work.
Question 28Software Development Fundamentals
A developer needs to record the evolution of a codebase so that any prior version can be restored and changes traced to an author. Which tool category provides this capability?
- A dependency package manager
- A continuous integration server
- A static code analysis tool
- A distributed version control system Correct answer.
Explanation
Version control systems such as Git record a history of snapshots, allow restoring earlier states, and attribute changes to authors. Static analyzers inspect code quality, package managers fetch dependencies, and CI servers automate builds and tests; none of them maintains the revision history itself.
Question 29Software Development Fundamentals
Which characteristic is the defining feature of an object-oriented class compared with a plain data structure such as a struct?
- It can only store primitive numeric values
- It guarantees constant-time access to every field
- It bundles state with the operations that act on that state Correct answer.
- It is always serialized to JSON automatically
Explanation
A class encapsulates data (fields) together with behavior (methods), letting it enforce invariants through its own operations. A plain struct typically exposes fields without associated behavior. Classes do not restrict field types, guarantee constant-time access, or auto-serialize.
Question 30Software Development Fundamentals
A team must deliver a small feature and get feedback quickly, so they plan work in short fixed-length iterations with a demo at the end. Which practice does this describe?
- Iterative, incremental development using time-boxed sprints Correct answer.
- Big-bang integration at the end of the project
- Waterfall development with a single final release
- Feature freeze followed by a long stabilization phase
Explanation
Short fixed-length iterations that each produce a demonstrable increment are the hallmark of iterative, incremental delivery such as Scrum sprints. Waterfall, big-bang integration, and long stabilization phases all defer feedback, which is the opposite of the stated goal.
Question 31Software Development Fundamentals
A developer reviews a pull request and focuses on whether the change is understandable to future maintainers. Which code quality attribute is being assessed?
- Fault tolerance
- Throughput
- Scalability
- Readability Correct answer.
Explanation
Readability concerns how easily a person can understand and reason about code, which directly affects maintainability. Throughput, fault tolerance, and scalability are runtime characteristics of a running system rather than properties of source clarity.
Question 32Software Development Fundamentals
A developer wants to run the same application on a colleague's laptop and on a staging server without dependency conflicts. Which practice most directly addresses this?
- Adding more logging statements to the application
- Writing additional integration tests for the application
- Increasing the memory allocated to the staging server
- Pinning dependency versions in a lockfile committed with the project Correct answer.
Explanation
A committed lockfile records exact resolved versions so that installs are reproducible across machines, eliminating drift from floating version ranges. Logging, memory allocation, and extra tests improve observability or confidence but do not make dependency resolution identical across environments.
Question 33Software Development Fundamentals
In a code review, a colleague suggests extracting a repeated block of validation logic into a single reusable function. Which software design principle does this most directly support?
- KISS, preferring the simplest solution
- YAGNI, avoiding speculative features
- DRY, avoiding duplicated logic Correct answer.
- Separation of concerns across layers
Explanation
DRY (Don't Repeat Yourself) states that each piece of knowledge should have a single authoritative representation, so consolidating duplicated validation into one function follows it. YAGNI concerns not building unneeded features, KISS favors simplicity, and separation of concerns divides responsibilities by layer; none directly targets duplication of the same logic.
Question 34Software Development Fundamentals
A developer writes a function that returns a value when given valid input but throws an exception when given invalid input. Which statement best describes the contract callers must handle?
- Callers must either catch the exception or let it propagate to their own caller Correct answer.
- Callers must retry the call until it stops throwing
- Callers can ignore the exception because the function returns a default value instead
- Callers must check a global error flag before using the return value
Explanation
When a function signals failure by throwing, the exception unwinds the stack unless a caller catches it, so each call site must handle it or declare that it propagates. The function does not return a default on the failing path, exceptions are not retried automatically, and error flags are a different error-handling style.
Question 35Software Development Fundamentals
A team uses Git with a feature-branch workflow. A developer finishes work on a long-lived branch while others have merged changes to main. Which action best keeps history reviewable and avoids a messy merge commit?
- Force-push the feature branch directly over main
- Delete main and recreate it from the feature branch
- Rebase the feature branch onto the updated main, resolve conflicts, then open the pull request Correct answer.
- Merge main into the feature branch repeatedly and never squash
Explanation
Rebasing replays the feature commits on top of the latest main, producing a linear, easy-to-review history and surfacing conflicts before review. Force-pushing over main destroys others' work, repeated unsquashed merges clutter history, and deleting main is destructive.
Question 36Software Development Fundamentals
A developer writes a recursive function to compute Fibonacci numbers and finds it extremely slow for larger inputs because the same subproblems are recomputed. Which technique most directly fixes this?
- Sorting the inputs before recursing
- Increasing the recursion depth limit
- Converting recursion to an infinite loop
- Memoization, caching results of subproblems already computed Correct answer.
Explanation
Memoization stores each subproblem's result so it is computed once, reducing exponential recomputation to roughly linear work. Raising the recursion limit only allows deeper calls, an infinite loop does not terminate, and sorting inputs does not change the overlapping-subproblem structure.
Question 37Software Development Fundamentals
A developer must choose a data structure to check quickly whether a username already exists among millions of records, accepting a small false-positive rate but never a false negative. Which structure fits best?
- A doubly linked list
- A binary search tree
- A stack
- A Bloom filter Correct answer.
Explanation
A Bloom filter answers set membership in constant space and time, may report false positives, but never false negatives, which matches the stated tolerance. A binary search tree is exact but requires ordered storage and log-time lookups, while a linked list and a stack require linear scans and offer no probabilistic guarantee.
Question 38Software Development Fundamentals
A developer must document a public function so other teams can use it without reading its body. Which documentation element is most important to include?
- A copy of the project's entire changelog
- The author's personal coding preferences
- The full source of every private helper it calls
- Its parameters, return value, thrown errors, and any side effects Correct answer.
Explanation
An API contract documents what callers need: inputs, outputs, failure modes, and side effects such as I/O or mutation. Private helper source, personal preferences, and the whole changelog are unrelated to how a caller should invoke the function.
Question 39Software Development Fundamentals
A developer is asked to add a feature that touches authentication, billing, and notifications. Which design approach best limits the blast radius of the change?
- Copy the relevant code from each area into a new shared file
- Introduce clear module boundaries with explicit interfaces between the three areas Correct answer.
- Remove tests around the three areas to speed up the change
- Put all new logic in one large function to keep it in a single place
Explanation
Explicit module boundaries and interfaces confine changes and let each area evolve or fail independently, reducing the chance that a billing edit breaks authentication. A single large function couples concerns, copying code duplicates logic and drifts, and removing tests increases risk rather than limiting it.
Question 40Software Development Fundamentals
A developer writes a class with a private field and exposes it only through a getter that validates the new value in a setter. Which benefit does this provide?
- The class can no longer be instantiated more than once
- The class can enforce invariants and change internal representation without breaking callers Correct answer.
- The field becomes accessible from any other class without restriction
- The field is automatically persisted to a database
Explanation
Encapsulating a field behind accessors lets the class reject invalid values and later change how the value is stored while keeping the public interface stable. It does not make the field globally accessible, restrict instantiation, or add persistence, which are separate concerns.
Question 41Software Development Fundamentals
A developer is told a function must be idempotent because a message queue may deliver the same message more than once. What must the function guarantee?
- Processing the same message repeatedly produces the same end state as processing it once Correct answer.
- The function never writes to any external system
- The function always completes within a fixed time limit
- The function returns the same object reference on every call
Explanation
Idempotence means repeated application of the same operation yields the same result as a single application, which makes at-least-once delivery safe. It says nothing about execution time, forbidding external writes, or returning identical object references.
Question 42Software Development Fundamentals
A codebase has grown and a developer wants automated checks to catch style violations and likely bugs before review. Which tooling combination best achieves this?
- A debugger attached during code review
- A linter plus a formatter run in a pre-commit hook and in CI Correct answer.
- A profiler run only in production
- A database migration tool run on every commit
Explanation
Linters flag likely bugs and style issues, formatters enforce consistent layout, and running both in a pre-commit hook and in CI catches problems early and consistently. A debugger, a production profiler, and migration tooling address different problems and do not provide static checks.
Question 43Software Development Fundamentals
A developer must choose between a compiled language and an interpreted language for a latency-sensitive service. Which statement is the most accurate basis for the decision?
- Interpreted languages cannot call native libraries
- Interpreted code can never be optimized by a just-in-time compiler
- Compiled code is typically translated ahead of time to machine code, which can reduce startup and per-call overhead Correct answer.
- Compiled languages cannot use garbage collection
Explanation
Ahead-of-time compilation produces machine code before execution, which often lowers per-call overhead compared with interpreting source at runtime. Interpreted languages frequently use JIT compilation, many compiled languages use garbage collection, and interpreted languages routinely call native libraries through foreign-function interfaces.
Question 44Software Development Fundamentals
A developer is asked to design a function that returns the largest value in a list of integers. Which input must the design explicitly handle to avoid an error?
- A list containing only positive numbers
- A list with a single element
- A list already sorted in ascending order
- An empty list, where no maximum exists Correct answer.
Explanation
An empty list has no element to return, so the function must define behavior such as throwing or returning a sentinel. Lists of positive numbers, single-element lists, and sorted lists all contain at least one value and are handled by the normal comparison logic.
Question 45Software Development Fundamentals
A developer must store a set of unique tags for an article and frequently test whether a tag is present. Which data structure provides the best average-case membership test?
- An array sorted by insertion time
- A queue
- A binary heap
- A hash set Correct answer.
Explanation
A hash set stores unique elements and tests membership in constant average time while preventing duplicates. An array sorted by insertion time requires a linear scan, a queue is for ordered processing, and a binary heap is optimized for retrieving the minimum or maximum, not membership.
Question 46Software Development Fundamentals
A developer must choose a data format for a configuration file that humans will edit by hand and that supports comments and nested sections. Which choice best fits?
- A comma-separated values file
- A binary serialization format
- A compiled bytecode file
- YAML Correct answer.
Explanation
YAML supports nested mappings, comments, and readable indentation, which suits hand-edited configuration. Binary formats are not human-friendly, CSV cannot represent nested structure or comments cleanly, and bytecode is an execution artifact rather than an editable config format.
Question 47Software Development Fundamentals
A developer notices that a function mutates its array argument, surprising callers who reuse the array afterward. Which change best follows the principle of least surprise?
- Document the mutation in a comment and keep the behavior
- Rename the function to include the word 'mutate'
- Return a new array and leave the input unchanged Correct answer.
- Add a boolean flag that sometimes mutates the input
Explanation
Returning a new value and leaving the caller's array untouched prevents hidden side effects, which is the principle of least surprise. A comment does not prevent the bug, renaming alone does not change behavior, and a flag that sometimes mutates makes the function even harder to reason about.
Question 48Software Development Fundamentals
A developer must refactor a legacy module with no tests before changing its behavior. Which sequence best reduces risk?
- Change the behavior and tests together without capturing the original
- Delete the module and restore it only if production breaks
- Rewrite the entire module from scratch in one commit
- Add characterization tests that capture current behavior, then refactor in small steps Correct answer.
Explanation
Characterization tests lock in the existing observable behavior so that refactoring steps can be verified against it, enabling safe incremental change. A single-commit rewrite, untracked behavior changes, and deleting the module all discard the safety net and make regressions hard to detect.
Question 49Software Development Fundamentals
A team debates whether to use a monorepo or one repository per service. Which consideration most directly favors a monorepo for tightly coupled services?
- Each service can choose an entirely different version control system
- Atomic cross-service changes can be made and tested in a single commit Correct answer.
- Repository size automatically shrinks as services grow
- Access control can be enforced per file without any tooling
Explanation
A monorepo lets a change spanning several services land atomically with one review and one CI run, which suits tightly coupled services. It does not allow different version control systems, fine-grained access control typically requires extra tooling, and repository size grows rather than shrinks.
Question 50Software Development Fundamentals
A developer must guarantee that a critical section is not executed by two threads simultaneously in a shared-memory program. Which primitive is designed for this purpose?
- A semaphore that only counts available buffer slots
- A mutex lock acquired before and released after the critical section Correct answer.
- A thread pool sized to one worker
- A read-only shared variable
Explanation
A mutex provides mutual exclusion so only one thread enters the critical section at a time. A counting semaphore for buffer slots manages capacity rather than exclusive entry, a read-only variable cannot protect writes, and a single-worker pool serializes tasks but does not protect code that other threads also run.