Software Testing MCQs for NSCT
Software testing is the process of evaluating software to find defects and to check that it meets its requirements, using techniques such as black-box and white-box testing at levels from components to acceptance. It is topic 10 of the Software Engineering area, which carries 10% of the NSCT according to HEC's Areas of Competencies. The area's 2026 average was 50.1% accuracy, per the HEC NSCT report and APP.
This page uses ISTQB Foundation Level (CTFL v4.0) terms, which match Sommerville and Pressman on the basics. Start with the vocabulary: a human error (mistake) leaves a defect (fault, bug) in the code, and running that defect can cause a failure, a visible wrong result.
Black box vs white box
Black-box (specification-based) testing designs tests from the requirements without looking at the code. White-box (structure-based) testing designs tests from the code's internal structure.
| Black box | White box | |
|---|---|---|
| Test basis | Specification, user stories | Source code, control flow |
| Techniques | Equivalence partitioning, boundary value analysis, decision tables, state transitions | Statement testing, branch testing, basis path testing |
| Finds | Missing or wrong features | Untested code, dead paths |
Equivalence partitioning (EP) splits inputs into groups the system should treat the same. A field taking 10 to 50 has three partitions: below 10, 10 to 50 and above 50. Boundary value analysis (BVA) tests the edges. 2-value BVA uses 9, 10, 50 and 51. 3-value BVA adds the inner neighbours too, giving 9, 10, 11, 49, 50 and 51.
A decision table with n independent true/false conditions starts with 2^n rules. State transition testing covers every valid transition in a state model.
Exam angle: if a question mentions the code, the technique is white box; if it mentions only inputs and rules, it is black box.
Test levels
CTFL v4.0 names five test levels:
- Component (unit) testing: a single function or class in isolation.
- Component integration testing: interfaces between components. In top-down integration, stubs stand in for called modules. In bottom-up integration, drivers call the module under test.
- System testing: the whole system against its specification, including non-functional qualities such as performance.
- System integration testing: interfaces with external systems, such as a payment gateway.
- Acceptance testing: whether users or customers accept it. This includes alpha testing at the developer's site and beta testing at users' sites.
Older textbooks list four levels (unit, integration, system, acceptance) and fold the two integration levels together. In the V-model, each level is planned against a matching phase: acceptance against user requirements, system tests against the system specification, integration against the architectural design and unit tests against the detailed design.
Two test types cut across levels. Confirmation testing re-runs the failed test after a fix. Regression testing re-runs other tests to catch side effects of the fix.
Exam angle: "stub or driver?" depends on the direction of integration, not the size of the module.
Coverage
Coverage measures how much of the code your tests exercised. Statement coverage = statements executed / executable statements. Branch coverage = decision outcomes exercised / all outcomes, where each if or loop has a True and a False outcome.
def pass_status(score, attempts):
status = "fail"
if score >= 50:
status = "pass"
if attempts > 3:
status += " (late)"
return status
The tests (60, 1) and (40, 5) execute all 6 statements and all 4 branch outcomes, which we checked with a Python line tracer. They still cover only 2 of the 4 paths: the combinations pass + late and fail + on time are never run. 100% branch coverage always gives 100% statement coverage, but neither gives full path coverage.
Cyclomatic complexity, V(G) = E - N + 2P or decisions + 1, is the size of a basis path set. For pass_status, V(G) = 2 + 1 = 3. It is an upper bound on the tests needed for branch coverage, not the exact minimum.
Exam angle: an if without an else is the classic case where statement coverage reaches 100% but branch coverage does not.
Common traps
- Mixing up stubs and drivers. Top-down uses stubs; bottom-up uses drivers.
- Assuming 100% statement coverage means 100% branch coverage. Only the reverse holds.
- Treating V(G) as the minimum number of tests for branch coverage. One test can cover several outcomes.
- Forgetting the invalid partitions in EP, or the outside neighbours in BVA.
- Calling a re-test of a fixed defect "regression testing". It is confirmation testing.
- Believing that passing tests prove there are no defects. Testing shows the presence of defects, not their absence.
Worked examples
1. Understanding. Which integration approach needs drivers? Answer: bottom-up integration. It tests the lowest modules first, so something must call them. A driver plays that role until the real higher-level modules are integrated.
2. Application. A quantity field accepts whole numbers from 10 to 50. Give the EP partitions and the 2-value BVA set. Answer: three partitions (below 10, 10 to 50, above 50); BVA values 9, 10, 50 and 51. The four BVA values also hit every partition, so one set of four tests satisfies both techniques.
3. Analysis. For pass_status above, the tests (60, 1) and (40, 5) reach 100% branch coverage. Is the function fully tested? Answer: no. Only 2 of the 4 paths ran. A defect that appears only when a passing score is also late would slip through. Adding (60, 5) and (40, 1) gives full path coverage for this small function.
Practise
The quiz below has 100 Software Testing questions, filterable by tier and difficulty.
Practise: 100 questions
FAQs
Is software testing the same as debugging?
No. Testing finds failures by running the software, or reviewing it in static testing, and shows that defects exist. Debugging is a development activity: finding the defect behind a failure, fixing it and checking the fix. Testers report failures; developers usually debug them. Confirmation testing then checks that the fix works.
What is the difference between verification and validation in testing?
Verification asks "are we building the product right?" and checks the product against its specification, for example through reviews and system tests. Validation asks "are we building the right product?" and checks it against users' real needs, for example through acceptance testing. Both are covered in more depth under software quality assurance.
Does ISTQB still use the term decision coverage?
CTFL v4.0 uses branch coverage, where a branch is a transfer of control between nodes in the control-flow graph. Older syllabi and many textbooks use decision coverage, which counts the True and False outcomes of each decision. For if-statements and loops the two usually give the same answer, and most exam questions treat them as one idea.
How many test cases does cyclomatic complexity give?
V(G) gives the number of independent paths in a basis set, so basis path testing uses V(G) tests. That is an upper bound for branch coverage: a single test through a loop can cover several branch outcomes, so the true minimum is often lower. Metrics like V(G) are covered under software metrics.
Next step
Continue with Software Maintenance & Evolution MCQs, return to the Software Engineering MCQ hub, or test yourself in an NSCT mock test.