Software Engineering MCQs - Software Testing and Debugging (Set 5)

Software Engineering MCQs - Software Testing and Debugging (Set 5) - CodingHumans

This set gives practice on software testing concepts that appear in nearly every exam and QA interview. It includes numerical questions on cyclomatic complexity, boundary value analysis and mutation score, plus concepts such as equivalence partitioning, statement and branch coverage, integration strategies with stubs and drivers, alpha and beta testing, regression and smoke testing, and debugging approaches. Ideal for GATE, UGC NET, university exams and placement rounds.

How to practise: read each question and tap the option you think is correct. You will see right away whether you got it, along with a short explanation, and your score is tracked at the bottom of the screen. This set has 18 questions.

Software Engineering MCQ series: Set 1 | Set 2 | Set 3 | Set 4 | Set 5 | Set 6

Topics covered in this set

  • Testing levels: unit, integration, system, acceptance
  • Black-box: boundary value analysis and equivalence partitioning
  • White-box: cyclomatic complexity and coverage criteria
  • Stubs, drivers, alpha and beta testing
  • Regression, smoke and mutation testing
  • Debugging approaches; error, fault and failure

Software Engineering MCQs with answers and explanations

Q1. A program's control flow graph has 10 edges, 8 nodes and is a single connected component. What is its cyclomatic complexity?

a) 4

b) 2

c) 3

d) 5

Q2. What is the cyclomatic complexity of the following pseudocode?

read(x, y)
while (x != y):
    if (x > y):
        x = x - y
    else:
        y = y - x
print(x)

a) 2

b) 4

c) 3

d) 5

Q3. Counting each simple condition of a compound predicate as a separate decision, what is the cyclomatic complexity of this fragment?

for i in 1..n:
    if (a[i] > 0 and a[i] < 100):
        count = count + 1
    elif (a[i] == 0):
        zeros = zeros + 1

a) 3

b) 5

c) 4

d) 6

Q4. Using standard (non-robust) boundary value analysis with the single-fault assumption, how many test cases are needed for a function of 2 independent input variables?

a) 5

b) 13

c) 25

d) 9

Q5. Robust boundary value testing also uses values just outside the valid range. How many test cases does it need for 3 input variables under the single-fault assumption?

a) 13

b) 15

c) 19

d) 27

Q6. A field accepts an age from 18 to 60 inclusive; all other integers are rejected. Using equivalence partitioning on this rule, how many equivalence classes are there?

a) 2

b) 3

c) 4

d) 6

Q7. Which statement about coverage criteria is correct?

a) 100 percent branch coverage guarantees 100 percent statement coverage

b) 100 percent statement coverage guarantees 100 percent branch coverage

c) Statement coverage is stronger than path coverage

d) Branch coverage ignores the false outcome of decisions

Q8. What is the minimum number of test cases needed to achieve 100 percent branch coverage of this code?

if (x > 5):
    y = 1
if (z < 3):
    y = y + 2

a) 1

b) 3

c) 4

d) 2

Q9. In bottom-up integration testing, the temporary components needed to call the modules under test are called

a) Stubs

b) Drivers

c) Mocks of the database only

d) Oracles

Q10. Beta testing is best described as testing performed

a) By real users in their own environment, without developers present

b) By developers on their own machines

c) By an independent team at the developer's site under supervision

d) Automatically by the CI server on each commit

Q11. After fixing a defect in the billing module, the team re-runs earlier tests on related modules to ensure nothing else broke. This is

a) Smoke testing

b) Acceptance testing

c) Load testing

d) Regression testing

Q12. Acceptance testing is typically carried out to

a) Check each function in isolation

b) Verify interfaces between two modules

c) Let the customer decide whether the system meets their requirements and should be accepted

d) Measure code coverage of unit tests

Q13. In mutation testing, 50 mutants are created. 5 of them are equivalent to the original program and 36 of the rest are killed by the test suite. What is the mutation score?

a) 72 percent

b) 90 percent

c) 64 percent

d) 80 percent

Q14. A debugger starts at the statement where the wrong output appears and traces the code in reverse to find where the value first went wrong. This debugging approach is

a) Backtracking

b) Brute force with memory dumps

c) Cause elimination by binary partitioning

d) Program slicing at compile time

Q15. "Are we building the product right?" is the question answered by

a) Validation

b) Certification

c) Verification

d) Benchmarking

Q16. A quick set of tests is run on each new build to check that the most critical functions work before deeper testing begins. This is called

a) Mutation testing

b) Smoke testing

c) Stress testing

d) Exhaustive testing

Q17. A programmer misreads the specification and writes the wrong formula; when the program runs, the user sees an incorrect total. The incorrect total is best termed a

a) Failure

b) Error

c) Fault

d) Mistake in specification

Q18. Which testing approach designs test cases from the internal structure of the code, such as its paths and branches?

a) Black-box testing

b) Acceptance testing

c) Usability testing

d) White-box testing

Quick revision notes

  • Cyclomatic complexity V(G) = E - N + 2P = number of decision points + 1 = number of regions.
  • BVA for n variables: 4n + 1 test cases; robust BVA: 6n + 1.
  • Equivalence partitioning: one representative test from each valid and invalid class.
  • Branch coverage subsumes statement coverage, not the other way round.
  • Top-down integration needs stubs; bottom-up integration needs drivers.
  • Mutation score = killed mutants / (total mutants - equivalent mutants).
  • Verification: building the product right; validation: building the right product.
  • Error (human mistake) -> fault (defect in code) -> failure (observed wrong behaviour).

Frequently asked questions

What does cyclomatic complexity tell us?

It gives the number of linearly independent paths through a program, which is the minimum number of test cases needed for basis path testing. Higher values also indicate code that is harder to understand and maintain.

What is the difference between boundary value analysis and equivalence partitioning?

Equivalence partitioning divides inputs into classes expected to behave the same and tests one value from each. Boundary value analysis focuses on values at and just around the edges of those classes, where defects are most likely.

Why is regression testing needed?

Changes such as bug fixes or new features can unintentionally break parts of the system that previously worked. Re-running relevant tests after each change confirms existing behaviour is still correct.

Comments

Answered 0/0Correct 0