Prove Which Routes Can Execute

A white-box tester examines the following routine. The input xx may be any integer, arithmetic is exact, and every execution reaches all three conditions.


Python
def classify(x):
    y = x
    if x >= 10:
        y = x - 4
    if y < 8:
        y = y + 3
    if y >= 12:
        return "hold"
    return "pass"


A complete route records the true or false outcome of each condition in execution order. Although three binary conditions suggest eight possible outcome sequences, some sequences may contradict the values calculated along the route. Evaluate each condition using the current value of its variable.


Complete this feasibility argument with exact integers and the word feasible or infeasible:


If the first two conditions are both true, the original input xx lies from through , inclusive. After both updates, the largest possible value of yy is . Therefore, the route true, true, true is . Considering all possible outcomes of the first two conditions, the routine has feasible complete routes.

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More White-Box (Glass-Box) Testing Questions: