Software Design MCQs for NSCT
Software design turns requirements into a plan for the code: which modules exist, what each one is responsible for, and how they talk to each other. Good design means high cohesion, low coupling and well-chosen patterns. It is topic 6 of the Software Engineering area, which carries 10% of the NSCT according to HEC's Areas of Competencies. In 2026 candidates averaged 50.1% in Software Engineering, per the HEC NSCT report and APP.
Pressman lists the core design concepts as abstraction, modularity, information hiding, functional independence, refinement and refactoring. Functional independence is measured by two things: cohesion and coupling. Large-scale structure (layers, MVC, microservices) is covered under software architecture.
Cohesion
Cohesion is how closely the elements inside one module belong together. The classic scale (from Yourdon and Constantine, repeated by Pressman) runs from worst to best:
| Cohesion | Elements are grouped because… | Example |
|---|---|---|
| Coincidental | No real reason | misc.py with unrelated helpers |
| Logical | They belong to one category, chosen by a flag | handle_input(type) for keyboard, file and network input |
| Temporal | They run at the same time | init() that opens logs and resets counters |
| Procedural | They follow a fixed order of steps | Steps of a checklist that act on different data |
| Communicational | They use the same data | Computing balance and credit score from one customer record |
| Sequential | One element's output is the next one's input | parse → validate → store |
| Functional | All contribute to one task | compute_gpa() |
Exam angle: "one reason to change" (the single responsibility principle) is the modern way of saying functional cohesion.
Coupling
Coupling is how much modules depend on each other. From loosest (best) to tightest (worst):
| Coupling | What is shared | Example |
|---|---|---|
| Data | Only the needed values, as parameters | area(width, height) |
| Stamp | A whole structure when only part is used | print_label(student) uses only roll_no |
| Control | A flag that steers the other module's logic | report(data, mode=2) |
| External | An imposed external format, protocol or device | Two modules bound to one file format |
| Common | Global data | Several modules writing current_user |
| Content | Another module's internals | Changing a private field of another class directly |
Exam angle: to reduce coupling, replace globals and flags with explicit parameters, and depend on interfaces rather than concrete classes.
UML diagrams
UML (Unified Modeling Language) 2 has structural diagrams (class, object, component, deployment, package, composite structure, profile) and behavioural ones (use case, activity, state machine, plus the interaction diagrams: sequence, communication, timing and interaction overview).
In class diagrams, learn the relationship symbols:
| Relationship | Meaning | Notation |
|---|---|---|
| Association | Objects are linked | Solid line, with multiplicities such as 1..* |
| Aggregation | Whole-part; the part can live on its own | Hollow diamond at the whole |
| Composition | Whole-part; the part dies with the whole | Filled diamond at the whole |
| Generalisation | "Is-a" inheritance | Hollow triangle pointing to the parent |
| Dependency | Uses temporarily | Dashed arrow |
Exam angle: multiplicity is read at the far end. Library 1 —— 0..* Book means a library has zero or more books and each book belongs to exactly one library. Full coverage is on the UML diagrams page.
Design patterns
A design pattern is a named, reusable solution to a recurring design problem. The Gang of Four (GoF) book by Gamma, Helm, Johnson and Vlissides catalogues 23, grouped by purpose:
| Category | Purpose | Patterns to know (GoF intent in brief) |
|---|---|---|
| Creational | Object creation | Singleton (one instance, global access), Factory Method (subclasses decide which class to create), Abstract Factory (families of related objects), Builder, Prototype |
| Structural | Composing classes and objects | Adapter (convert an interface), Decorator (add responsibilities dynamically), Facade (simple interface to a subsystem), Composite (part-whole trees), Proxy (control access), Bridge (separate abstraction from implementation) |
| Behavioural | Responsibilities and algorithms | Observer (one-to-many notification), Strategy (interchangeable algorithms), Command (a request as an object), State, Template Method, Iterator |
Exam angle: questions describe a problem and ask for the pattern. Look for the key phrase: "incompatible interface" means Adapter, "notify many" means Observer, "swap algorithm at run time" means Strategy, and "add features without subclass explosion" means Decorator.
Common traps
- Reversing the scales: functional cohesion is best and data coupling is best; coincidental cohesion and content coupling are worst.
- Mixing up Adapter (changes an interface) with Facade (simplifies a subsystem) and Decorator (same interface, extra behaviour).
- Putting the composition diamond at the part's end instead of the whole's end.
- Calling a sequence diagram structural. It is a behavioural (interaction) diagram.
- Thinking Singleton is always good design. It adds global state and hidden dependencies.
Worked examples
Understanding. Which GoF category does Factory Method belong to? Answer: creational. Its intent is to define an interface for creating an object but let subclasses decide which class to instantiate, so it concerns object creation.
Application. A function send(msg, use_sms) checks use_sms to decide whether to send an email or an SMS. Name the coupling, and say how to remove it.
Answer: control coupling. The caller steers the callee's internal logic with a flag. Two functions, or a Notifier interface with EmailNotifier and SmsNotifier classes (Strategy), remove the flag.
Analysis. A stock app must update a chart, a price table and an alert service whenever a price changes. More displays will be added later. Which design keeps the price feed unaware of the displays?
Answer: Observer. The feed (subject) keeps a list of observers and calls update() on each one. New displays just register, so the feed never changes. Direct calls from the feed to each display would tie it to every concrete class.
Practise
The quiz below has 98 Software Design questions, which you can filter by tier and difficulty.
Practise: 98 questions
FAQs
What is the difference between cohesion and coupling?
Cohesion is about the inside of a module: how strongly its elements serve one purpose. Coupling is about the links between modules: how much one depends on another. You want high cohesion and low coupling, and the two often improve together, because a module that does one job usually needs less from others.
How many design patterns are in the GoF book?
The Gang of Four book (1994) describes 23 patterns: 5 creational, 7 structural and 11 behavioural. You do not need all of them in detail. Singleton, Factory Method, Abstract Factory, Adapter, Decorator, Facade, Composite, Observer and Strategy cover most exam questions.
Is MVC a design pattern or an architecture?
Both labels appear. MVC (Model-View-Controller) is usually taught as an architectural pattern because it structures a whole application. The GoF book describes it as a combination of Observer, Composite and Strategy. If a question lists it alongside layered and client-server styles, treat it as an architecture.
What is the difference between aggregation and composition?
Both are whole-part relationships. In composition the whole owns the part and the part's lifetime depends on it, like an order and its order lines; the UML symbol is a filled diamond. In aggregation the part can exist on its own, like a team and its players; the symbol is a hollow diamond.
Next step
Continue with Software Architecture MCQs, go back to the Software Engineering hub, or try a timed NSCT mock test.