A white-box tester examines the following routine. The input xxx may be any integer, arithmetic is exact, and every execution reaches all three conditions.
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 xxx lies from through , inclusive. After both updates, the largest possible value of yyy is . Therefore, the route true, true, true is . Considering all possible outcomes of the first two conditions, the routine has feasible complete routes.
Unlock full course notes by signing up
Count Distinct Items Across a Suite
A packing service calculates a handling charge in Canadian dollars using the function below. For each separate test suite, enter the number of distinct labelled statements executed and distinct decision outcomes exercised. Give exact integer counts, not percentages.
Only S1–S4 are statement items. The true and false exits of D1 and D2 are the four branch items. Inputs are ordered as (items, fragile).
Suite A contains only (2, False).
Structural Complexity and Complete Paths
A shipping routine uses three Boolean inputs: priority shipment, fragile contents, and international destination. Every combination of these inputs is permitted, and no action changes any input. The flowchart shows the complete routine; assume there are no exceptions or hidden exits.
The cyclomatic complexity of this single connected control-flow graph is the structural measure
Prove the Minimum Test Addition
A delivery service returns a promised delivery time in days using the function below. The zone is either "local" or "remote", and express is Boolean. Its current suite contains ("local", True) and ("remote", False).
Count only the true and false exits of D1, D2, and D3 as branch items. Each test calls the function once.
Find both quantities:
Full Branch Coverage with a Missed Qualifying Route
A shop’s rule awards a 12 CAD discount to every member and to any non-member spending at least 120 CAD. Other customers receive no discount. The following Python function implements that rule.
Python uses short-circuit evaluation for or. The suite contains (True, 150) with expected result 12 and (False, 80) with expected result 0. Count only the full if decision’s true and false exits as branch items.
Which statements about this suite are true? Select all that apply.