Application S passes its language's static type analysis. Application D uses dynamic typing and completes one test successfully. Neither language promises automatic conversion of text into numbers. No other language rules or test coverage information are supplied. Which statements are justified? Select all that apply.
Application S may still fail on an array access if bounds are checked during execution.
Application D may encounter a type-incompatible operation on an execution path absent from this test.
Application D must convert text into numbers whenever a later addition requires integer operand values.
Application S must contain explicit type labels for every variable because its typing is static.
Unlock full course notes by signing up
Compare rejection with observed failure
A team compares two versions of a teaching language using 40 independent request handlers. Both versions allow addition only between integers and perform no automatic conversion.
26 handlers contain no type-incompatible operations.
9 handlers each contain one text-plus-integer addition that their test input executes.
Separate a value from its wrapper
A sensor application defines the value domain of a type as the set of values that type permits. It uses these three types:
Reading permits exactly the integers from −2 through 2, inclusive.
Flag permits exactly the Boolean values true and false. These values are distinct from integers.
Count paths through a repair branch
A receipt routine uses three Boolean inputs: chooseText, repair, and runAdd. Each can independently be true or false, giving eight distinct input combinations. Indentation identifies the statement controlled by each if.
In the dynamic version, variables may change value types. Addition accepts only two integers, performs no conversion, and stops the routine on a type error. A successful print displays one number.
In the static version, the first line is instead var amount: Int = 10. Integer variables may receive only integers, and analysis rejects an incompatible assignment anywhere in the source before execution, including inside a branch.
Count representable and valid job states
A job tracker currently stores every job as a record containing all four fields below. Each field is an enumeration: its listed names are distinct values with no associated data. Initially, every combination of field values is permitted by the record type.
The application imposes additional business rules:
A proposed replacement is a tagged union, which stores exactly one named alternative together with that alternative's fields. Its alternatives are Ready(stage, worker), Failed(error) and Waiting. In this replacement, Ready uses the four listed stages and three listed workers, Failed uses only Disk, Network or Input, and Waiting has no fields.