A sensor application defines the value domain of a type as the set of values that type permits. It uses these three types:
No automatic conversions or wrapping occur. Enter Yes or No in each cell to indicate whether the candidate value belongs to the column's type.
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.
Read the guarantees precisely
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.
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.