ACM-SW study materials
ACM-SW study resources

ACM-SW practice questions

One question at a time. Build your ACM-SW understanding.

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 Requirements

Which document primarily defines what the system must do from the user's perspective, without prescribing how it is built?

  1. Software requirements specification Correct answer.
  2. Detailed design document
  3. Deployment runbook
  4. Source code repository

Explanation

A software requirements specification captures what the system must do and the constraints it must satisfy, expressed independently of implementation. Design and deployment artifacts describe how the solution is realized rather than what is required.

Question 2Software Requirements

A team writes: 'The system shall let a registered user reset a forgotten password by email verification.' Which type of requirement is this?

  1. Business policy
  2. Functional requirement Correct answer.
  3. Design constraint
  4. Non-functional requirement

Explanation

Functional requirements describe specific behaviors or services the system must provide. Password reset via email verification is a behavior the system must perform, so it is functional.

Question 3Software Requirements

Which requirement is best classified as non-functional?

  1. The system shall allow an administrator to deactivate an account.
  2. The system shall log every failed login attempt.
  3. The system shall respond to search queries within two seconds for 95 percent of requests. Correct answer.
  4. The system shall email a receipt after each purchase.

Explanation

Non-functional requirements state quality attributes or constraints such as performance, availability, or usability. A response-time target is a performance quality attribute, whereas the other options describe specific behaviors.

Question 4Software Requirements

In requirements engineering, what is a stakeholder?

  1. Any external auditor who reviews the code
  2. Any person or group with an interest in the system and its requirements Correct answer.
  3. Only the customer who pays for the system
  4. Only the engineers who will implement the system

Explanation

A stakeholder is any individual or group affected by or having an interest in the system, including users, sponsors, operators, and regulators. Limiting the definition to a single role ignores many legitimate sources of requirements.

Question 5Software Requirements

Which statement best describes a use case?

  1. A list of quality attributes ranked by priority
  2. A diagram showing the physical deployment of servers
  3. A sequence of interactions between an actor and a system that yields an observable result of value Correct answer.
  4. A schedule of tasks for the development team

Explanation

A use case describes goal-oriented interactions between external actors and the system that produce a result of value to an actor. It focuses on behavior from the actor's viewpoint rather than on internal structure or scheduling.

Question 6Software Requirements

What is the main purpose of requirements elicitation?

  1. To generate the final user manual
  2. To verify that code matches the design
  3. To discover the needs and constraints of stakeholders Correct answer.
  4. To estimate the cost of testing

Explanation

Elicitation is the activity of gathering requirements from stakeholders and other sources. Verification, estimation, and documentation come later and serve different purposes.

Question 7Software Requirements

A requirement states: 'The system shall allow users to export reports.' Which quality problem does this requirement most clearly exhibit?

  1. It is ambiguous about format and scope Correct answer.
  2. It is not testable because it mentions users
  3. It is a non-functional requirement in disguise
  4. It contradicts the export feature

Explanation

The requirement does not specify which reports, what formats, or under what conditions, leaving room for multiple interpretations. Ambiguity about scope and format makes it hard to verify.

Question 8Software Requirements

In a requirements document, what does traceability primarily provide?

  1. A link from each requirement to its source and to related design, code, and tests Correct answer.
  2. A summary of the project budget
  3. A list of rejected change requests
  4. A ranking of requirements by development cost

Explanation

Traceability links requirements backward to their origins and forward to design elements, code, and test cases. This supports impact analysis and coverage checking, not cost ranking or budgeting.

Question 9Software Requirements

A team is choosing between interviewing users and observing them at work. Which situation most favors observation?

  1. Users perform complex tasks they find hard to describe verbally Correct answer.
  2. The requirements are already fully documented
  3. Users are unavailable for any scheduled meeting
  4. The project has a very tight budget

Explanation

Observation is valuable when work practices are tacit or hard to articulate, because it reveals actual behavior rather than reported behavior. Interviews rely on users' ability to describe their own work accurately.

Question 10Software Requirements

Which pair correctly distinguishes validation from verification of requirements?

  1. Validation checks the schedule; verification checks the budget
  2. Validation checks performance; verification checks security
  3. Validation checks code coverage; verification checks test results
  4. Validation checks that we built the right system; verification checks that the requirements are correctly specified and consistent Correct answer.

Explanation

Requirements validation asks whether the requirements reflect what stakeholders actually need, while verification checks internal correctness such as consistency, completeness, and testability. The two address different failure risks.

Question 11Software Requirements

Which technique is most appropriate for resolving conflicting requirements from two stakeholder groups?

  1. Averaging the two requirements numerically
  2. Silently removing one group's requirements
  3. Negotiation to reach an agreed, documented resolution Correct answer.
  4. Escalating directly to code implementation

Explanation

Conflicting requirements are resolved through structured negotiation that documents the agreed outcome and its rationale. Unilateral removal or numeric averaging does not address the underlying conflict.

Question 12Software Requirements

What is the primary role of a prototype during requirements engineering?

  1. To serve as the final production system without further work
  2. To measure developer productivity
  3. To help stakeholders discover and refine requirements through concrete feedback Correct answer.
  4. To replace all written requirements documentation

Explanation

Prototypes make requirements tangible so stakeholders can react to concrete behavior and refine their needs. They are a discovery aid, not necessarily the final product or a substitute for all documentation.

Question 13Software Requirements

A requirement states: 'The checkout page shall load quickly.' Which revision makes it verifiable?

  1. The checkout page shall load quickly for most users
  2. The checkout page shall load as fast as reasonably possible
  3. The checkout page shall load with acceptable speed
  4. The checkout page shall load within 2 seconds for 95 percent of requests on a defined reference environment Correct answer.

Explanation

Verifiability requires measurable criteria, including a metric, a target, and the conditions under which it is measured. Specifying a time threshold, a percentile, and a reference environment makes the requirement objectively testable.

Question 14Software Requirements

Which is an example of an external constraint on a software system?

  1. A regulatory rule mandating data retention for seven years Correct answer.
  2. An internal decision to use a particular text editor
  3. A preference by one developer for a coding style
  4. A team habit of daily stand-up meetings

Explanation

External constraints originate outside the development team and cannot be freely changed, such as laws, standards, or mandated interfaces. Internal preferences and team habits are not external constraints.

Question 15Software Requirements

A requirements engineer writes user stories with acceptance criteria. What is the main benefit of the acceptance criteria?

  1. They specify the internal class structure to be used
  2. They replace the need for stakeholder involvement
  3. They define concrete conditions for judging when the story is complete Correct answer.
  4. They record the project's risk register

Explanation

Acceptance criteria state the conditions a story must satisfy to be accepted, giving a shared, testable definition of done. They do not prescribe internal design or substitute for stakeholder engagement.

Question 16Software Requirements

What does requirements prioritization primarily help a project do?

  1. Eliminate the need for testing low-priority items
  2. Decide the order and scope in which requirements are delivered under constraints Correct answer.
  3. Guarantee that no requirement will ever change
  4. Assign blame for schedule delays

Explanation

Prioritization orders requirements so that limited time and resources go first to the most valuable or necessary items. It does not freeze requirements or remove the need to test what is delivered.

Question 17Software Requirements

A team uses a model that specifies required behavior as states and transitions. Which requirement concern does this model best address?

  1. Ordering and allowed sequences of events over the system's lifetime Correct answer.
  2. The cost of each feature
  3. The physical location of servers
  4. The team's staffing plan

Explanation

State-based models capture the valid states of an entity and the events that trigger transitions, making sequencing rules explicit. They do not address deployment, cost, or staffing.

Question 18Software Requirements

In a requirements review, which defect should be flagged as an internal inconsistency?

  1. A requirement states a measurable performance target
  2. A requirement references a stakeholder by role
  3. One requirement mandates passwords of at least twelve characters while another forbids passwords longer than eight Correct answer.
  4. A requirement uses a term defined in the glossary

Explanation

Internal inconsistency occurs when two requirements cannot both be satisfied, as with contradictory password length limits. Glossary use, role references, and measurable targets are signs of good requirements.

Question 19Software Requirements

A mobile app must work offline and later sync. Which requirement pair best captures the necessary behavior?

  1. The app shall be user friendly and shall be reliable
  2. The app shall be fast and shall be secure
  3. The app shall allow data entry while offline and shall synchronize queued changes when connectivity returns Correct answer.
  4. The app shall use a specific database vendor and shall use a specific framework

Explanation

The requirement must describe the observable behaviors that make offline operation possible: capturing data without connectivity and reconciling it once connected. Vague qualities or implementation choices do not specify this behavior.

Question 20Software Requirements

A project adopts incremental delivery. How should the requirements set be structured to support this?

  1. As a set of undated wishes with no ordering
  2. As prioritized, independently deliverable slices with dependencies noted Correct answer.
  3. As implementation tasks with no user-facing description
  4. As one monolithic specification delivered only at the end

Explanation

Incremental delivery needs requirements grouped into slices that each deliver value and can be built and verified separately, with dependencies made explicit. A single end-loaded specification or unordered wishes undermines incremental planning.

Question 21Software Requirements

A stakeholder insists on a requirement whose cost greatly exceeds its value, and the budget is fixed. What is the most defensible requirements-engineering response?

  1. Implement a hidden approximation and label it as meeting the requirement
  2. Reject it without informing the stakeholder
  3. Document the trade-off and negotiate scope or value with the stakeholder before committing Correct answer.
  4. Accept it silently to avoid conflict

Explanation

When cost and value conflict under a fixed budget, the trade-off should be made explicit and resolved through negotiation with the stakeholder. Silent acceptance, unilateral rejection, or misrepresentation all hide the decision.

Question 22Software Requirements

Two requirements each pass review individually, but together they make a mandatory response time unachievable. Which analysis activity would most directly surface this?

  1. Cross-checking non-functional targets against the combined functional load Correct answer.
  2. Reordering the requirements alphabetically
  3. Renaming the requirements for consistency
  4. Converting the requirements into user stories

Explanation

Emergent conflicts arise from interactions among requirements, so analysis must consider combined effects such as aggregate load against performance targets. Renaming, reordering, or reformatting does not reveal interaction effects.

Question 23Software Requirements

A regulated system must demonstrate that every mandatory legal requirement is satisfied by at least one test. Which requirements practice most directly supports this demonstration?

  1. Writing the legal requirements in prose only
  2. Estimating story points for each legal requirement
  3. Holding a single kickoff meeting with regulators
  4. Bidirectional traceability from legal requirements to test cases with coverage reporting Correct answer.

Explanation

Demonstrating satisfaction of mandatory requirements requires links from each requirement forward to verifying tests and a report showing coverage. Estimation, one-time meetings, or unstructured prose do not provide auditable evidence.

Question 24Software Requirements

During elicitation, stakeholders describe a workflow differently from how it is actually performed. Which approach best reduces the risk of capturing the wrong requirement?

  1. Combine interviews with observation of real work and reconcile discrepancies with stakeholders Correct answer.
  2. Average the descriptions into a single statement
  3. Rely solely on the most senior stakeholder's account
  4. Defer all clarification until after release

Explanation

Discrepancies between stated and actual practice are best resolved by triangulating methods such as interviews and observation, then confirming findings with stakeholders. Relying on one account or deferring clarification leaves the mismatch unresolved.

Question 25Software Design

Which SOLID principle states that a class should have only one reason to change?

  1. Interface Segregation Principle
  2. Single Responsibility Principle Correct answer.
  3. Open/Closed Principle
  4. Liskov Substitution Principle

Explanation

The Single Responsibility Principle holds that a module should be responsible to one, and only one, actor, so it has a single reason to change. The other principles address extension without modification, substitutability of subtypes, and interface granularity.

Question 26Software Design

A developer adds a new payment provider to a checkout system by writing a new class that implements an existing PaymentProcessor interface, without editing any existing classes. Which design principle does this best illustrate?

  1. Open/Closed Principle Correct answer.
  2. Law of Demeter
  3. Single Responsibility Principle
  4. Dependency Inversion Principle

Explanation

The Open/Closed Principle states that software entities should be open for extension but closed for modification. Adding a new implementation of an existing abstraction extends behavior without changing existing code.

Question 27Software Design

In the context of the Liskov Substitution Principle, which situation most clearly signals a violation?

  1. A parent class declares a protected helper method
  2. A subclass adds a new public method not present in the parent
  3. A subclass overrides a method with an identical contract
  4. A subclass method throws an exception for input its parent accepts Correct answer.

Explanation

LSP requires that objects of a subtype be usable wherever the supertype is expected without breaking correctness. Throwing for inputs the parent accepts strengthens preconditions and breaks substitutability.

Question 28Software Design

Which code smell is most directly addressed by extracting a large conditional block into a Strategy implementation?

  1. Speculative generality in unused parameters
  2. Duplicate code across unrelated modules
  3. Long method with switch-like branching on type Correct answer.
  4. Inappropriate intimacy between two classes

Explanation

A long method that branches on a type code often mixes many algorithms in one place. Replacing the conditional with polymorphic Strategy objects distributes the behavior and removes the branching.

Question 29Software Design

Which statement best describes the Dependency Inversion Principle?

  1. Dependencies should be created inside the class that uses them
  2. Every class should depend on at most one other class
  3. High-level modules should depend on abstractions, not on concrete low-level modules Correct answer.
  4. Interfaces should be as broad as possible to allow reuse

Explanation

DIP states that high-level policy should not depend on low-level detail; both should depend on abstractions. This inverts the usual direction of source-code dependency.

Question 30Software Design

A system must support several interchangeable sorting algorithms selected at runtime. Which pattern fits best?

  1. Singleton
  2. Strategy Correct answer.
  3. Facade
  4. Adapter

Explanation

Strategy encapsulates a family of interchangeable algorithms behind a common interface so the client can select one at runtime. The other patterns address instance control, subsystem simplification, and interface conversion.

Question 31Software Design

Which pattern is most appropriate when an object must notify an unknown number of dependents whenever its state changes?

  1. Composite
  2. Decorator
  3. Observer Correct answer.
  4. Command

Explanation

Observer defines a one-to-many dependency so that when the subject changes state, all registered observers are notified automatically. This supports an open-ended set of dependents.

Question 32Software Design

A legacy class exposes a method named sendMail(String) while a new subsystem expects notify(String). Which pattern bridges the mismatch with the least coupling?

  1. Mediator
  2. Bridge
  3. Adapter Correct answer.
  4. Proxy

Explanation

Adapter converts the interface of an existing class into the interface a client expects, allowing incompatible interfaces to collaborate. Bridge and Mediator address different structural concerns.

Question 33Software Design

Which pattern would you use to add caching behavior to an existing data-access object without modifying that object's class?

  1. Iterator
  2. Template Method
  3. Factory Method
  4. Decorator Correct answer.

Explanation

Decorator wraps an object with the same interface and adds behavior such as caching before or after delegating to the wrapped instance. This avoids modifying the original class.

Question 34Software Design

Which architectural style best supports independently deployable services communicating over well-defined network contracts?

  1. Microservices Correct answer.
  2. Event-sourced single process
  3. Layered monolith
  4. Shared-database monolith

Explanation

Microservices architecture decomposes a system into small, independently deployable services that communicate through explicit interfaces such as APIs or messaging. This enables independent release cycles.

Question 35Software Design

Two services in a microservice system must stay consistent without distributed transactions. Which approach best supports eventual consistency?

  1. Publishing domain events and compensating actions Correct answer.
  2. Two-phase commit across all services
  3. Sharing a single relational schema
  4. Synchronous blocking calls in a single transaction

Explanation

Event-driven coordination with compensating actions (for example, the saga pattern) achieves eventual consistency without locking resources across services. Distributed transactions like two-phase commit are costly and fragile across service boundaries.

Question 36Software Design

In layered architecture, which rule keeps the layers loosely coupled?

  1. Upper layers embed SQL queries against the database
  2. Each layer depends only on the layer directly beneath it Correct answer.
  3. All layers share one global data structure
  4. Each layer may call any layer above or below it

Explanation

Strict layering restricts dependencies so each layer interacts only with its immediate neighbor, which limits ripple effects from changes. Skipping layers or embedding persistence details in upper layers increases coupling.

Question 37Software Design

Which is the primary purpose of the Repository pattern?

  1. To generate SQL migrations automatically
  2. To mediate between domain objects and data mapping, presenting a collection-like interface Correct answer.
  3. To cache all database rows in memory permanently
  4. To enforce referential integrity inside the database engine

Explanation

Repository abstracts persistence behind a collection-like interface so domain code can work with aggregates without knowing storage details. It centralizes query and mapping logic.

Question 38Software Design

A domain model has an Order that owns OrderLine objects whose lifetimes end with the Order. How should these be modeled in Domain-Driven Design?

  1. OrderLine as a separate aggregate root
  2. OrderLine as a value object shared across orders
  3. OrderLine as an entity within the Order aggregate Correct answer.
  4. OrderLine as a domain service

Explanation

An aggregate groups entities that must remain consistent together, with one root controlling access. OrderLine has no independent lifecycle, so it belongs inside the Order aggregate.

Question 39Software Design

Which coupling type is generally the weakest and most desirable between modules?

  1. Data coupling via simple parameters Correct answer.
  2. Common coupling via global variables
  3. Control coupling via passed flags
  4. Content coupling through direct field access

Explanation

Data coupling passes only the simple data a module needs, which minimizes hidden dependencies. Content, common, and control coupling all introduce stronger, less desirable dependencies.

Question 40Software Design

Which change most improves cohesion in a class that both computes invoice totals and sends email receipts?

  1. Make all fields public so other classes can reuse them
  2. Move the email behavior into a separate notifier class Correct answer.
  3. Merge the class with the database access layer
  4. Add more methods to the class to justify its name

Explanation

Cohesion measures how strongly related the responsibilities within a module are. Splitting unrelated responsibilities into focused classes raises cohesion.

Question 41Software Design

Which UML relationship best represents that a Car has-a Engine whose lifetime is tied to the Car?

  1. Composition Correct answer.
  2. Generalization
  3. Realization
  4. Aggregation

Explanation

Composition is a strong whole-part relationship in which the part cannot exist independently of the whole. Aggregation is a weaker has-a relationship without lifetime ownership.

Question 42Software Design

What does an interface segregation violation most commonly look like?

  1. A client is forced to implement methods it does not use Correct answer.
  2. An interface has a single method
  3. A class extends an abstract base class
  4. A class implements two unrelated interfaces

Explanation

The Interface Segregation Principle says clients should not be forced to depend on methods they do not use. Fat interfaces with unused methods are the classic violation.

Question 43Software Design

Which technique helps prevent a subclass from breaking a superclass invariant?

  1. Removing documentation from the superclass
  2. Making all superclass fields protected
  3. Allowing subclasses to override any method freely
  4. Designing the superclass contract with explicit preconditions and postconditions Correct answer.

Explanation

Explicit contracts state the preconditions and postconditions subtypes must honor, guiding correct extension. Documented contracts let subclasses strengthen guarantees only in permitted ways.

Question 44Software Design

Which pattern separates the construction of a complex object from its representation so the same process can create different representations?

  1. Chain of Responsibility
  2. Builder Correct answer.
  3. Prototype
  4. Flyweight

Explanation

Builder encapsulates step-by-step construction, allowing the same construction process to yield different representations. The other patterns address cloning, sharing, and request passing.

Question 45Software Design

In a hexagonal (ports and adapters) architecture, what role do adapters play?

  1. They define the aggregate boundaries
  2. They replace the domain layer with framework code
  3. They store the domain model's business rules
  4. They translate between the application's ports and external technologies Correct answer.

Explanation

Ports define technology-agnostic interfaces, and adapters implement them for specific external systems such as databases or messaging. This keeps the domain isolated from infrastructure.

Question 46Software Design

Which design decision best supports testability of a service that calls an external payment gateway?

  1. Inject the gateway behind an interface that tests can substitute Correct answer.
  2. Hardcode the gateway URL in the service class
  3. Make the gateway a static singleton accessed globally
  4. Instantiate the gateway directly inside each method

Explanation

Depending on an injected abstraction lets tests substitute a fake or stub for the external dependency. Direct instantiation, hardcoded endpoints, and global singletons make substitution difficult.

Question 47Software Design

Which statement about the Template Method pattern is accurate?

  1. A client composes a pipeline of independent handler objects at runtime
  2. A factory decides which concrete class to instantiate
  3. A base class defines an algorithm skeleton and defers some steps to subclasses Correct answer.
  4. An object delegates requests to a wrapped object with the same interface

Explanation

Template Method defines the invariant structure of an algorithm in a superclass and lets subclasses override specific steps. This is inheritance-based reuse of an algorithm skeleton.

Question 48Software Design

A team wants to evolve a shared library interface without breaking existing consumers. Which approach is most appropriate?

  1. Introduce new methods with default implementations and deprecate old ones gradually Correct answer.
  2. Change existing method signatures in place without versioning
  3. Remove the interface entirely and expose concrete classes
  4. Delete old methods immediately to force updates

Explanation

Additive changes with deprecation preserve backward compatibility while consumers migrate. Removing or altering signatures in place breaks existing clients.

Question 49Software Design

Which situation best indicates that a Singleton is being overused?

  1. Many classes reach global state through the singleton, making tests order-dependent Correct answer.
  2. A connection pool is managed by the framework
  3. A configuration object is created once at application startup
  4. A logger is shared across modules

Explanation

Singletons become problematic when they act as mutable global state that couples many classes and makes tests depend on execution order. Intentional single-instance infrastructure at startup is a narrower, acceptable use.

Question 50Software Design

Which SOLID principle states that a module should depend on abstractions rather than on concrete implementations?

  1. Open/Closed Principle
  2. Dependency Inversion Principle Correct answer.
  3. Liskov Substitution Principle
  4. Single Responsibility Principle

Explanation

The Dependency Inversion Principle directs that high-level policy and low-level detail both depend on abstractions, so concrete classes are supplied through interfaces. The other principles address responsibility scope, substitutability, and extension without modification, not the direction of dependencies.