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.


Python
def handling(items, fragile):
    cost = 2             # S1
    if items >= 5:       # D1
        cost = cost + 3  # S2
    if fragile:          # D2
        cost = cost + 4  # S3
    return cost          # S4


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).
  • Suite B contains only (7, True).
  • Suite C contains (2, True) and (7, False).
SuiteDistinct statements executedDistinct decision outcomes exercised
A
B
C

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: