QA engineer: Test Oracles and Coverage
Original QA interviews on exact and partial oracles, output equivalence, numeric tolerances, metamorphic relations, feasible coverage, stateful histories, and mutation evidence. Reason from explicit software contracts and independently checkable finite models.
These prompts are original practice. They are not questions from a named employer or a live hiring loop.
1.A sorter must return an ordered list with exactly the input multiset. For input [4,1,4], a faulty implementation returns []. An oracle checks only that adjacent output elements are nondecreasing. What is missed?
Show answer and explanation
- Every sorter is allowed to remove repetitions even when the contract explicitly preserves them
- The empty list must contain a descending pair even though it has no adjacent elements
- Preservation of the input elements and their multiplicities
- Checking order automatically establishes equal input/output multisets without observing their contents
Answer: Preservation of the input elements and their multiplicities
An empty list has no descending pair, so the ordering predicate can pass. The contract also requires the input multiset {1,4,4}; check content preservation as well as order.
2.A stable sort orders records by numeric key, preserving original order among equal keys. Input is [(R,2),(S,1),(T,2)]. Which output satisfies that exact contract?
Show answer and explanation
- [(S,1),(T,2),(R,2)]
- [(R,2),(T,2),(S,1)]
- [(S,1),(R,2),(T,2)]
- [(S,1),(R,2)]
Answer: [(S,1),(R,2),(T,2)]
S comes first because its key is 1. R and T both have key 2, so stability preserves their input order R before T. The output must also retain all three records.
3.An API returns tags with meaningful repetition but unspecified order. Expected tags are [red,red,blue]; actual tags are [red,blue,blue]. A comparator converts both to sets. What does it fail to detect?
Show answer and explanation
- Different multiplicities despite equal sets
- A schema rule that forbids repeated tags
- A required ordering violation, although order is unspecified
- A difference in the set of distinct tag names
Answer: Different multiplicities despite equal sets
Both distinct-name sets are {red,blue}, but the counts differ. Under this contract use a multiset comparison; a set comparator discards the information the requirement preserves.
4.A response contract treats object-member order as irrelevant and array order as significant. Which comparison should report equality?
Show answer and explanation
- Arrays [1,2] and [2,1]
- Objects {x:1,y:2} and {y:2,x:1}
- Objects {x:1} and {x:"1"}, with strict value types
- Arrays [1,1,2] and [1,2]
Answer: Objects {x:1,y:2} and {y:2,x:1}
Changing object-member order does not change this contract's meaning. Array positions, multiplicity and strict value types remain observable, so the other pairs are unequal.
5.A result uses comma as decimal separator under its declared locale: "2,75" means 2.75. An oracle removes commas, parses the result, and compares with numeric 2.75. What happens to the correct result "2,75"?
Show answer and explanation
- It is interpreted as 0.0275 by removing the comma
- It is falsely rejected after being interpreted as 275
- It passes because removing a decimal separator preserves numeric value
- The stated locale makes every comma-containing string invalid
Answer: It is falsely rejected after being interpreted as 275
The helper changes the numeric meaning by treating the decimal separator as removable decoration. The correct result becomes 275 rather than 2.75, so this oracle can reject compliant output.
6.A numeric implementation must satisfy f(2x)=2f(x). The candidate returns zero for every x. What does passing this relation establish about exact required values by itself?
Show answer and explanation
- Nothing that excludes this constant-zero candidate
- Passing this relation uniquely identifies every numeric value of the intended function
- Every independent exact-value check becomes redundant whenever one relation passes
- A zero output necessarily violates the relation even when both sides are zero
Answer: Nothing that excludes this constant-zero candidate
The zero function satisfies the relation because 0=2×0. A necessary relational property need not uniquely characterize the intended function; independent anchors or other constraints may be needed.
7.A serializer and parser use matching reversible label substitutions. Their round trips recover the records, but the wire contract requires the original labels without substitution. What follows from round-trip success alone?
Show answer and explanation
- Any privately reversible encoding automatically satisfies every external serialization contract
- It does not establish the required external wire representation
- Matching inverses prove that the external labels obey the required wire format
- Successful composition guarantees each component independently obeys the specified representation
Answer: It does not establish the required external wire representation
Two components can agree on a private encoding while violating their external format. Round-trip success checks their composition, not automatically each component's specified representation.
8.An approximate numeric oracle accepts
abs(actual−expected)≤a+r×abs(expected). With a=0.1,r=0.001,expected=1000,actual=1000.5, what follows?Show answer and explanation
- Pass: error 0.5 is within allowance 1.1
- Pass: the error is exactly zero
- Fail: only the absolute term 0.1 may be used
- Fail: the allowance is 0.101
Answer: Pass: error 0.5 is within allowance 1.1
The declared allowance is 0.1+0.001×1000=1.1. The error is 0.5, so it passes this combined absolute/relative rule; another tolerance definition could give a different result.
9.A helper accepts a result when NOT(
abs(actual−expected)>epsilon). Assumeabs(NaN)=NaN and every ordered comparison NaN>x is false. What happens if actual is NaN?Show answer and explanation
- Negating the ordered comparison necessarily rejects NaN under the supplied false-comparison semantics
- The comparison converts NaN into the finite expected result before applying epsilon
- The helper can accept it unless a separate validity check rejects it
- Setting epsilon to zero makes NaN>x true under the explicitly supplied rules
Answer: The helper can accept it unless a separate validity check rejects it
The inner comparison is false under the supplied semantics, so NOT(false) is true. Validate nonfinite results explicitly when the contract requires finite output instead of relying on this comparison pattern.
10.An exact decimal contract rounds to one decimal place, breaking halfway ties toward an even retained digit. What is the expected rounding of 1.25?
Show answer and explanation
- 1.0
- 1.2
- 1.25
- 1.3
Answer: 1.2
The value is halfway between 1.2 and 1.3. The retained tenths digit 2 is even, so the specified tie rule selects 1.2. The premise uses exact decimals, avoiding a separate binary-representation issue.
11.Define approximate equality by
abs(a−b)≤0.1. Values are a=0,b=0.08,c=0.16. Which inference is invalid?Show answer and explanation
- Since a≈b and b≈c, a≈c must hold
- b≈c under the stated relation
- a≈b under the stated relation
- a and c differ by 0.16
Answer: Since a≈b and b≈c, a≈c must hold
The first two differences are 0.08, but abs(0−0.16)=0.16>0.1. This tolerance relation is not transitive, so it cannot automatically be used as an equivalence relation for grouping results.
12.A text comparator's contract normalizes both inputs to NFC before comparison. Two inputs have different code-point sequences but are stated to normalize to the same NFC sequence. What should the comparator report?
Show answer and explanation
- Equal only if their original bytes were identical
- An error for every string containing more than one code point
- Equal under this normalization contract
- Unequal solely because their original code-point counts differ
Answer: Equal under this normalization contract
The declared comparison is on normalized sequences. Different raw encodings do not imply inequality after the explicitly required normalization, though a raw-byte identity contract would be different.
13.A schema permits a field to be absent or contain null or an integer. If present, strings are forbidden, including numeric strings. Which returned value violates the field rule?
Show answer and explanation
- The integer 7
- null
- An absent field
- The string "7"
Answer: The string "7"
The schema distinguishes value type from displayed digits. "7" is a string and is forbidden; an integer, explicit null and omission are each allowed by the stated contract.
14.A result checksum is the XOR of its two bytes. Expected bytes are [1,2], but actual bytes are [0,3]. What can a checksum-only equality oracle do?
Show answer and explanation
- A three-valued checksum comparison recovers the missing original byte positions automatically
- Equal XOR checksums uniquely determine the entire two-byte sequence
- The expected bytes have checksum 1 while the actual bytes have checksum 0
- Accept both because each checksum is 3
Answer: Accept both because each checksum is 3
1 XOR 2=3 and 0 XOR 3=3. This weak checksum loses information; equal checksums are insufficient to establish exact output equality in the declared two-byte domain.
15.An exact reference returns 0.75 seconds. The implementation reports 750 milliseconds. The oracle permits 0.01 seconds absolute error. How should these observations compare after correct unit conversion?
Show answer and explanation
- Pass with zero difference in seconds
- Fail because values in different original units can never be compared
- Pass only by increasing tolerance to 750 seconds
- Fail with a difference of 749.25 seconds
Answer: Pass with zero difference in seconds
750 ms equals 0.75 s, so the normalized values agree exactly. Unit conversion belongs before applying the tolerance; comparing raw numbers would test a different physical quantity.
16.A vector oracle requires Euclidean error norm≤0.1. Actual minus expected is (0.08,0.08). A helper instead checks each component's absolute error≤0.1. What happens?
Show answer and explanation
- The helper fails, but the Euclidean bound passes
- The Euclidean error is exactly 0.08
- Both pass because componentwise and Euclidean bounds are identical
- The helper passes, but the required norm bound fails
Answer: The helper passes, but the required norm bound fails
Each component is within 0.1, but squared Euclidean error is 0.08²+0.08²=0.0128>0.01. The two oracle definitions have different acceptance regions.
17.A rejected update must leave stored state unchanged. A candidate raises the expected validation error but increments a revision counter first. The test asserts only the error type. What does this test establish?
Show answer and explanation
- Reading the error response automatically asserts the unchanged revision counter
- A state change is outside the contract whenever the update is rejected
- The expected error was observed, but state preservation remains unchecked
- The expected error type proves every earlier state mutation was undone
Answer: The expected error was observed, but state preservation remains unchecked
The output error and state preservation are separate obligations. A correct error type does not establish rollback or absence of side effects; compare the relevant before/after state.
18.A parser test expects InputError for malformed input. Its harness treats any thrown exception as success, and a missing fixture file raises FileError before parsing starts. How should the run be classified?
Show answer and explanation
- Any exception is sufficient evidence for the specific expected InputError rejection
- The parser's output is verified correct because fixture loading never completed
- A setup FileError proves the malformed bytes reached the parser
- It does not establish the expected parser rejection
Answer: It does not establish the expected parser rejection
The observed exception comes from setup and has the wrong type. A useful negative oracle must distinguish the required rejection from unrelated harness or environment failures.
19.A dependency graph has tasks A and B both before C, with no ordering constraint between A and B. Output must contain every task exactly once in a valid order. Which expected-output family is correct?
Show answer and explanation
- {[A,B,C],[B,A,C]}
- Every permutation of A,B,C
- {[A,C,B],[B,C,A]}
- Only [A,B,C]
Answer: {[A,B,C],[B,A,C]}
C must follow both prerequisites, leaving exactly the two listed orders. A single fixed snapshot would falsely reject the other permitted order, while accepting every permutation would admit invalid schedules.
20.A nondeterministic allocator may legally return resource R or S, but never T. The contract does not promise probabilities or one fixed winner. Which oracle matches that output rule?
Show answer and explanation
- Require the first observed resource to recur forever despite the intentionally unfixed winner
- Accept any resource or type merely because some nondeterminism is allowed
- Require exactly one R and one S in every pair without any probability promise
- Accept membership in {R,S}, rejecting T
Answer: Accept membership in {R,S}, rejecting T
Nondeterminism can leave multiple valid outputs while still imposing constraints. The stated rule is set membership; it neither fixes one result nor specifies a sample-frequency guarantee.
21.An exact total-count function sums independent per-file counts, with no deduplication or cross-file rules. What relation is required for lists X and Y?
Show answer and explanation
- The relation holds only when both lists are empty
- The count of a concatenation always equals count(X) only
- Concatenation must halve both counts
- count(X concatenated with Y)=count(X)+count(Y)
Answer: count(X concatenated with Y)=count(X)+count(Y)
The declared total is additive over every file entry, so concatenating lists adds their contributions. The explicit absence of deduplication or cross-file rules is part of why this relation is valid.
22.A service counts distinct document IDs. X={A,B} and Y={B,C}. A proposed relation says
count(X union Y)=count(X)+count(Y)for all sets. What does this case show?Show answer and explanation
- The proposed relation is guaranteed by the word 'distinct'
- The service must be wrong because 3 is less than 4
- The union contains four distinct IDs
- The relation is invalid here: 3≠2+2
Answer: The relation is invalid here: 3≠2+2
The shared ID B belongs to the union once. Additivity of distinct-set cardinality requires disjoint sets or an overlap correction; a false proposed relation can reject a correct implementation.
23.A pure filter keeps all matching records in input order, without limits or deduplication. The predicate evaluates each record independently. Which follow-up relation follows?
Show answer and explanation
- Filtering a concatenation must reverse the accepted records
- Filtering Y can change whether an unchanged record in X matches
- filter(X concatenated with Y)=filter(X) concatenated with filter(Y)
- Each nonempty input must produce the same number of records
Answer: filter(X concatenated with Y)=filter(X) concatenated with filter(Y)
Independent per-record selection and preserved order make filtering distribute over concatenation. Limits or global selection rules could invalidate the relation, but those are explicitly excluded.
24.A search contract returns the first k IDs from one fixed total order, on unchanged data. For k=2 it returns [A,B]; for k=3 it returns [A,C,D]. What contract relation fails?
Show answer and explanation
- Results for different k must always have equal lengths
- Every result must contain all IDs in the dataset
- The smaller result must be a prefix of the larger result
- Increasing k must reverse the fixed order
Answer: The smaller result must be a prefix of the larger result
Under the declared fixed-order prefix contract, [A,B] must equal the first two IDs of the k=3 result. Here those are [A,C], so the observations violate that relation.
25.A permission-filtered listing returns at most two items. Adding a newly permitted high-ranked item can displace a previously returned lower-ranked item. Is 'the old result set is always a subset of the new one' a valid relation from permissions alone?
Show answer and explanation
- The old subset rule holds solely from permission expansion, independently of output selection
- No; the result cap can break that subset relation
- Adding an eligible item cannot displace an earlier result even when the result count is capped
- Every capped ranked output must retain every prior item whenever eligibility expands
Answer: No; the result cap can break that subset relation
Permission expansion may enlarge the eligible set, but a capped ranked output need not contain all previously returned items. A valid metamorphic relation must account for both eligibility and the output-selection rule.
26.Deleting an existing key returns true; deleting an absent key returns false. Repeating deletion must leave the same final stored state. Which repeat-test expectation matches that contract?
Show answer and explanation
- The second deletion must recreate the key
- Equal final states, but first and second return values may differ
- Identical return values are required by final-state idempotence
- A different return value proves the stored state changed
Answer: Equal final states, but first and second return values may differ
The first deletion can return true and the second false while both leave the key absent. A relation about final state must not be silently strengthened into equality of every response field.
27.Operations
set(A,1)andset(B,2)modify different map keys, with no other effects or dependencies. Both run once from the same initial map. Which relation is required?Show answer and explanation
- Changing the order must exchange the key names
- Their final maps agree in either execution order
- Only one of the two writes may remain
- Their diagnostic timestamps must be identical in either order
Answer: Their final maps agree in either execution order
The writes are independent under the premise, so they commute with respect to final map state. Incidental traces or timestamps are not part of that stated equality.
28.From an empty map, one operation sets K to red and another sets K to blue. Each write replaces K's value. What does swapping their order show?
Show answer and explanation
- The first replacement remains final regardless of a later replacement to the same key
- Every pair of replacement writes commutes even when both target the same scalar key
- The final scalar value must contain both colors rather than follow the replacement rule
- The final value changes, so commutativity is not a valid relation here
Answer: The final value changes, so commutativity is not a valid relation here
Last replacement wins: red then blue leaves blue; blue then red leaves red. A relation valid for disjoint keys does not automatically apply to conflicting writes on one key.
29.A timestamp codec stores
floor(t)whole seconds and decodes that stored number exactly. Supported t includes every nonnegative real. Is decode(encode(t))=t a valid required relation for the entire domain?Show answer and explanation
- No; even integer timestamps can never survive this codec
- Yes; floor(3.7) is 3.7 in whole seconds
- Yes; every encoder/decoder pair must preserve all input precision
- No; t=3.7 round-trips to 3 under this lossy contract
Answer: No; t=3.7 round-trips to 3 under this lossy contract
The codec explicitly discards fractional seconds. At 3.7 it returns 3, while integral timestamps can round-trip unchanged. A relational oracle must match the specified lossy behavior and its domain.
30.A byte checksum adds all input bytes modulo 256. For X=[100] and Y=[200], what concatenation relation gives the correct checksum?
Show answer and explanation
- checksum(X concatenated with Y)=(100+200) mod 256=44
- The checksum cannot be related to the two partial sums
- The concatenated checksum must be 100−200=−100
- The concatenated checksum must be 300 without reduction
Answer: checksum(X concatenated with Y)=(100+200) mod 256=44
The modular contract requires reducing 300 modulo 256, yielding 44. Ordinary unbounded addition without the final reduction is not the same output relation.
31.Use binary64 round-to-nearest, ties-to-even. With x=10^16,y=−10^16,z=1, the groupings yield (x+y)+z=1 and x+(y+z)=0. What follows for an oracle demanding exact associativity?
Show answer and explanation
- The observations prove any finite-precision implementation must violate its own declared arithmetic
- Every grouping must yield the same exact result because real-number addition is associative
- The stated arithmetic has no rounding effects at any magnitude
- It would reject permitted behavior of this declared arithmetic model
Answer: It would reject permitted behavior of this declared arithmetic model
Rounding loses the small increment when y+z is formed at this magnitude. A mathematically associative real-number operation need not be exactly associative in the declared finite-precision implementation.
32.A stable sorter uses exact unbounded integer keys. Add the same constant 7 to every key while retaining record IDs and input order. What relation should hold for the sorted ID sequence?
Show answer and explanation
- Every repeated key must be removed
- It remains unchanged
- It must reverse
- The sequence length increases by 7
Answer: It remains unchanged
A uniform translation preserves every key comparison and every tie. The stable sorted ID order therefore stays the same under this explicitly exact, overflow-free transformation.
33.A storage-fit predicate accepts when summed nonnegative demands≤capacity, using exact arithmetic. Every demand and the capacity are multiplied by positive factor 3. What should happen to acceptance?
Show answer and explanation
- Every previously rejected case becomes accepted
- Acceptance must reverse
- Only capacity matters, so scaling demands is irrelevant
- It is unchanged
Answer: It is unchanged
Multiplying both sides of the same inequality by a positive factor preserves it. The relation depends on scaling all relevant quantities and using the stated exact arithmetic.
34.Function f is specified only for integer inputs 0 through 10. A follow-up transformation maps input 8 to 13. No behavior is specified outside the domain. Can an oracle require a relation involving f(13) from this specification alone?
Show answer and explanation
- Any numeric relation on valid source inputs remains justified after moving outside the specified domain
- No; the follow-up input leaves the specified domain
- The follow-up value must be zero because all unspecified inputs have that defined result
- A transformed input is automatically exempt from the function's domain restriction
Answer: No; the follow-up input leaves the specified domain
The transformed input must remain inside the domain where the proposed relation is justified, or have a separately specified rejection contract. Undefined behavior does not supply an expected numeric output.
35.A random-bit API must be unbiased and return only 0 or 1. A test checks only that every sample belongs to {0,1}. What faulty candidate can pass this oracle?
Show answer and explanation
- One that returns the string "0" when the oracle requires the integer bit type
- One that always returns 0
- One that returns −1 whenever it is called
- One that returns 2 in every strictly checked bit sample
Answer: One that always returns 0
Range membership does not test the required distribution. A constant-zero generator stays inside the valid output set while violating unbiasedness.
36.A correct generator returns independent fair bits. An oracle insists that each pair of samples contain one 0 and one 1. With that correct generator, what is this oracle's false-failure probability per pair?
Show answer and explanation
- 0
- 1/2
- 1
- 1/4
Answer: 1/2
The four equally likely pairs are 00,01,10,11. The oracle incorrectly rejects 00 and 11, so it fails a correct generator with probability 2/4=1/2.
37.Resource IDs are case-sensitive, while display labels may be compared case-insensitively. An oracle lowercases every field before comparing records. What identity distinction can it erase?
Show answer and explanation
- Only label differences can be erased because normalization cannot alter an ID field
- Lowercasing all records proves every original case-sensitive ID was identical
- The allowed label rule automatically changes the documented semantics of resource IDs
- IDs Ab and aB, which are distinct under the ID contract
Answer: IDs Ab and aB, which are distinct under the ID contract
Normalization must respect each field's semantics. A comparison rule allowed for labels can collapse distinct IDs if applied indiscriminately to the whole record.
38.filterPositive keeps positive integers; negate changes every sign. For S=[−2,3], compare negate(
filterPositive(S)) with filterPositive(negate(S)). What follows?Show answer and explanation
- They differ: [−3] versus [2], so the operations do not commute here
- Both must equal [−2]
- Both must equal [3]
- They commute because both operations process each item separately
Answer: They differ: [−3] versus [2], so the operations do not commute here
Filtering uses a sign-sensitive predicate, which negation changes. Independent item processing alone does not justify exchanging the order of transformations when selection criteria are affected.
39.An API returns deterministic payload P plus a fresh request ID whose value is intentionally variable. What is an appropriate repeated-call oracle for the deterministic contract?
Show answer and explanation
- Require every response byte to repeat, including the field explicitly specified as fresh
- Compare P semantically and validate the request ID's separate specified properties
- Ignore the entire response because one metadata field is intentionally variable
- Replace the deterministic payload with constants before comparison and call it verified
Answer: Compare P semantically and validate the request ID's separate specified properties
Separate nondeterministic metadata from required payload behavior. Removing every observation is too weak, while requiring a fresh identifier's exact repeat value adds a promise the contract does not make.
40.A raw JSON comparator deletes every whitespace character before comparing. Expected is {"label":"a b"}; actual is {"label":"ab"}. Spaces inside labels are meaningful. What can the comparator do?
Show answer and explanation
- Deleting all whitespace preserves every character inside a quoted string value
- Falsely accept the changed label by deleting meaningful string content
- The two label values are equal under the contract because they share the same object key
- Matching braces establish semantic equality of every enclosed JSON value
Answer: Falsely accept the changed label by deleting meaningful string content
Whitespace outside tokens and whitespace inside quoted strings have different roles. Blind deletion erases the contractually meaningful space, making unequal labels appear equal.
41.Treat D=A OR (B AND C) as a mathematical Boolean function. Tests use only (A,B,C)=000 and 111. Do those two assignments witness each condition's independent effect with every other input held fixed?
Show answer and explanation
- No; the two assignments change all three inputs at once
- Yes; a pair changing three inputs can be treated as holding the other two fixed for each one
- No; both supplied assignments produce the same decision result
- Yes; observing both decision outcomes supplies an independent witness for every condition
Answer: No; the two assignments change all three inputs at once
The decision is false at 000 and true at 111, but those rows differ in three conditions. Independent-effect evidence under the stated rule needs pairs differing only in the condition being demonstrated.
42.For D=(A AND B) OR C, a witness for A must change only A and change D. Which pair of complete (A,B,C) assignments meets that rule?
Show answer and explanation
- 010 and 111
- 000 and 100
- 110 and 100
- 010 and 110
Answer: 010 and 110
010 gives false and 110 gives true, with B=1,C=0 fixed. The other pairs either mask A's effect or change a different/additional condition.
43.For Boolean D=(A AND B) OR C, require an outcome-changing pair for each condition, with other inputs fixed. Which listed set supplies all three witnesses?
Show answer and explanation
- {001,011,101,111}
- {010,110,100,101}
- {000,001,110,111}
- {000,100,010,110}
Answer: {010,110,100,101}
In the first set, 010↔110 witnesses A, 110↔100 witnesses B, and 100↔101 witnesses C. Each pair changes only its target condition and changes the decision result.
44.A language short-circuits A AND B from left to right. Tests supply (A,B)=false/true,true/true,true/false. How many times is B actually evaluated?
Show answer and explanation
- 2
- 3
- 0
- 1
Answer: 2
B is skipped when A is false. It is evaluated in the two tests with A=true, once true and once false. Supplied input values and actual condition evaluations are different coverage observations.
45.A function returns R if mode=fast; otherwise Q if size>0; otherwise Z. Tests use (fast,0) and (slow,1). Which additional input executes the missing terminal outcome?
Show answer and explanation
- mode=slow,size=0
- mode=slow,size=2
- mode=fast,size=−1
- mode=fast,size=1
Answer: mode=slow,size=0
The existing tests produce R and Q. Reaching Z requires failing both earlier conditions: mode must not be fast and size must not be positive.
46.A helper's declared valid-input domain is n≥0. Inside it, one branch checks n<0. Can a test obeying that precondition take the true branch?
Show answer and explanation
- The impossible true branch proves every other helper path is also impossible
- Use n=−1 and still claim the test obeyed the n≥0 precondition
- No; the branch is infeasible within the declared domain
- Repeat n=0 until its unchanged value satisfies n<0
Answer: No; the branch is infeasible within the declared domain
No value can satisfy n≥0 and n<0 simultaneously. Report the domain and infeasibility rather than manufacture a valid-input coverage claim using an input that violates the precondition.
47.In one unchanged execution, x is an integer. A path requires x>5 and later x<2, with no mutation of x between checks. What is true about that combined path?
Show answer and explanation
- It is feasible because both conditions are individually testable
- It is guaranteed whenever both branch outcomes appear somewhere in the suite
- It requires only x=5
- It is infeasible even though each condition can be true on separate inputs
Answer: It is infeasible even though each condition can be true on separate inputs
No unchanged integer satisfies both inequalities. Individual branch feasibility and branch coverage do not imply every concatenated path of those branches is feasible.
48.A loop executes exactly n times, and supported n is {0,1,2}. Tests use n=0 and n=1. Which supported iteration-count path remains unexecuted?
Show answer and explanation
- No path, because both loop-condition outcomes were observed
- The one-iteration path
- The two-iteration path
- The zero-iteration path
Answer: The two-iteration path
The two tests may cover both true and false loop-condition outcomes while omitting the n=2 execution path. The explicitly bounded domain has three iteration-count cases.
49.A loop can execute any nonnegative number of iterations under the supported contract. Distinct iteration counts are distinct paths. Can a finite set of finite executions cover all those paths?
Show answer and explanation
- No; the allowed iteration-count path set is unbounded
- The longest tested finite run automatically becomes a maximum allowed by the unbounded contract
- Two chosen finite runs cover every nonnegative iteration count by definition
- A true and false loop-condition observation exhausts every possible iteration-count path
Answer: No; the allowed iteration-count path set is unbounded
A finite set of finite traces contains only finitely many iteration counts. It can exercise useful paths and branch outcomes without exhausting this unbounded path family.
50.A resource contract requires release after both success and failure. Which observed trace violates that cleanup rule?
Show answer and explanation
- acquire,operation_error,propagate_error with no release
- No acquire because input validation rejected the request first
- acquire,operation_success,release,return
- acquire,operation_error,release,propagate_error
Answer: acquire,operation_error,propagate_error with no release
The first trace acquires the resource but propagates the operation error without releasing it. A rejection before acquisition has no acquired resource to release under this contract.
51.Coverage is defined as covered executable items divided by all executable items. Module A covers 80 of 100; module B covers 10 of 10. What is combined item-weighted coverage?
Show answer and explanation
- 95%, the average of 80% and 100%
- 90/110, about 81.8%
- 90%, using only A's denominator
- 100%, because one module is fully covered
Answer: 90/110, about 81.8%
Combine the counts before dividing: (80+10)/(100+10)=90/110. Averaging module percentages equally gives different weights from the explicitly item-weighted definition.
52.A function has statement IDs {1,2,3,4}. Test X visits {1,2}; Y visits {2,3}. Repeating X 100 times visits no new IDs. What statement coverage does the combined suite have?
Show answer and explanation
- 102/4
- 4/4
- 3/4
- 2/4
Answer: 3/4
The union of visited IDs is {1,2,3}. Repeated executions of the same IDs do not increase this unique-item coverage measure or cover statement 4.
53.Two coverage profiles use numeric region IDs from different builds, and the ID-to-source mappings changed. What is needed before safely combining their covered-region sets?
Show answer and explanation
- A valid common mapping or separate build-specific interpretation
- Numeric region-ID equality alone proves that two changed mappings refer to the same executed source
- Every source region retains the same meaning under its old numeric ID after the mapping changes
- Adding the profile file sizes yields valid covered-region counts across unrelated builds
Answer: A valid common mapping or separate build-specific interpretation
A region identifier is meaningful within its mapping. Unioning unrelated IDs can claim coverage for code never executed; establish compatible identity before aggregating evidence across builds.
54.A report lists 100 total items, excludes 20 from its denominator, and claims 85 distinct eligible items were covered. Counts are exact and the same scope is intended. What follows?
Show answer and explanation
- Every excluded item must have been tested
- The exclusions create five new eligible items
- The counts are inconsistent because only 80 items are eligible
- Coverage is valid at 106.25%
Answer: The counts are inconsistent because only 80 items are eligible
The eligible denominator is 100−20=80. Covering 85 distinct items within that same 80-item scope is impossible; reconcile mappings, exclusions or counts rather than accept a percentage above 100.
55.Supported configurations combine 2 clients,3 parsers,4 operating systems. One client cannot use one particular parser on any OS; all other combinations are valid. How many supported complete configurations exist?
Show answer and explanation
- 16
- 24
- 20
- 23
Answer: 20
The unrestricted product has 2×3×4=24 configurations. The forbidden client/parser pair removes four OS combinations, leaving 20. Feasibility constraints belong in the coverage domain.
56.Two binary features must satisfy A implies B. Tests execute 00,01,11. Coverage counts only feasible complete feature assignments. What coverage follows?
Show answer and explanation
- 3/4
- 3/3
- 1/3
- 2/3
Answer: 3/3
Assignment 10 is forbidden by the implication. The three tests cover all three feasible assignments under the stated domain; a raw four-row denominator would answer a different question.
57.A criterion requires changing only condition A while holding B fixed. The valid domain enforces A=B, both binary. Can any two valid assignments supply that witness for A?
Show answer and explanation
- Neither 00 nor 11 satisfies the stated equality constraint
- No; changing A while keeping B fixed leaves the valid domain
- A decision change proves a valid single-input witness even when both coupled inputs changed
- Use 00 and 11 while claiming that B did not change
Answer: No; changing A while keeping B fixed leaves the valid domain
The valid assignments are 00 and 11, which change both conditions together. This independent-effect witness is infeasible under the domain constraint; do not invent a valid witness from prohibited input combinations.
58.A function returns A if integer n≥0; otherwise B if n>10; otherwise C. Can any integer reach B?
Show answer and explanation
- Yes; n=0 bypasses the first condition
- Yes; n=11 reaches B before A
- No; C is also unreachable
- No; n>10 would already satisfy the earlier n≥0 branch
Answer: No; n>10 would already satisfy the earlier n≥0 branch
To reach the second test, n must be negative. It cannot then be greater than 10. Ordered conditions can make a branch unreachable even when its own predicate is satisfiable in isolation.
59.Required capability set is {read,write,share}. Each of T1,T2,T3 costs 4 units and covers a different pair; T4 covers all three and costs 9. Any two of T1,T2,T3 cover all three. Under budget 8, what minimum-cost complete selection exists?
Show answer and explanation
- T4 alone costing 9 within the budget
- One pair-covering test costing 4 with complete coverage
- No complete selection fits
- Two pair-covering tests costing 8
Answer: Two pair-covering tests costing 8
One pair-covering test omits one capability. Two cover the whole declared set for 8; T4 also covers it but exceeds the budget. This proves coverage of that set, not detection of every possible fault.
60.A parser's behavior depends on 8 input classes and either warm or cold cache state, with every combination supported. Tests execute all 8 classes only in warm state. What joint-domain gap remains?
Show answer and explanation
- The sixteen joint cases were all executed by eight warm-only observations
- Exactly one cold-state case covers all eight distinct input/state combinations by definition
- All joint cases are covered because every explicit input class appeared in some warm-state test
- 8 cold-state combinations
Answer: 8 cold-state combinations
The joint domain has 8×2=16 cases, and the eight cold combinations were not exercised. Coverage claims must include relevant state as well as explicit input-class labels.
61.A state graph has edges S0→S1,S1→S2,S2→S0. One trace executes S0→S1→S2. What coverage distinction follows?
Show answer and explanation
- Only two states were visited
- All three states were visited, but one required transition was not executed
- No state or transition evidence was collected
- Every edge was executed because every state was visited
Answer: All three states were visited, but one required transition was not executed
The trace visits S0,S1,S2 and takes the first two edges. It does not take S2→S0; state coverage and transition coverage count different objects.
62.A criterion requires executing transition pair a then b consecutively in one trace. Test 1 executes a then resets; Test 2 starts from a fixture state and executes b. Is the transition-pair criterion met?
Show answer and explanation
- Neither a nor b was executed, contrary to the supplied individual traces
- No; the required adjacent pair was not executed in one trace
- A fixture reset must be counted as transition b regardless of its implementation
- Separate coverage of a and b proves their required adjacency in one execution
Answer: No; the required adjacent pair was not executed in one trace
Separate transition coverage does not execute the combined sequence. A fixture can enable b without exercising the state/history produced by a immediately beforehand.
63.A request accepts nonnegative integer demands x,y only when x+y≤10. Existing tests are axis-only. Which additional pair crosses the joint boundary while both demands remain positive?
Show answer and explanation
- x=0,y=0 repeated twice
- x=4,y=6 versus x=4,y=7
- Any case with a negative demand, without checking the sum boundary
- x=10,y=0 versus x=0,y=10 only
Answer: x=4,y=6 versus x=4,y=7
The first pair crosses the sloped joint boundary from total 10 to 11 while keeping both demands positive. Axis-only tests do not directly exercise that mixed-demand boundary neighborhood.
64.Two internal states both display Ready. One has quota 0 and rejects Submit; the other has quota 1 and accepts Submit. What is lost by modeling state only as the displayed Ready label?
Show answer and explanation
- Behaviorally relevant quota state and its distinct next-action behavior
- The fact that any UI label can be observed
- Nothing, because equal labels imply equal future behavior
- A guarantee that every Submit must be rejected
Answer: Behaviorally relevant quota state and its distinct next-action behavior
An abstraction that merges states with different required responses can hide defects or produce wrong expectations. The model needs the state distinctions relevant to its tested actions, not just the displayed tag.
65.A job model makes Cancelled absorbing: later Complete events are ignored. Starting Pending, trace Cancel then Complete occurs. What state should the oracle expect?
Show answer and explanation
- Pending
- Both Succeeded and Cancelled simultaneously
- Cancelled
- Succeeded
Answer: Cancelled
Cancel first enters the absorbing Cancelled state. The declared late-event rule leaves it unchanged when Complete arrives; this conclusion is specific to the stated model.
66.A map model starts empty. Operations are
set(A,2),set(B,4),remove(A),set(A,7). Writes replace a key's value and removal deletes it. What final state is expected?Show answer and explanation
- {A:7}
- {A:7,B:4}
- {A:2,B:4}
- {B:4}
Answer: {A:7,B:4}
Replay the operations against the model: A is first 2, then removed, then recreated as 7. B remains 4. The final oracle needs the sequence's state, not only the first or last operation in isolation.
67.A register starts at 0. Legal histories must admit a sequential order respecting nonoverlapping real-time operations. H1:
write(1)finishes at t=2, then a read starts at t=3 and returns 0. H2:write(1)spans [0,5], a read spans [2,3] and returns 0. Which is possible under that rule?Show answer and explanation
- H2 can be legal; H1 cannot
- Both must be legal
- H1 can be legal; H2 cannot
- Neither can be legal
Answer: H2 can be legal; H1 cannot
H1's read must follow the completed write, so it cannot return the initial value. H2 overlaps the write and can be ordered before it, returning 0. Overlap and real-time precedence impose different constraints.
68.Two atomic appends A and B overlap from an empty list. The contract permits either serialization order and requires both items exactly once. Which classification of [A,A],[A,B],[B,A] matches that contract?
Show answer and explanation
- Only [B,A] is permitted; [A,B] must fail despite the allowed serialization order
- Only [A,B] is permitted; [B,A] must fail despite the allowed serialization order
- All three listed arrays satisfy both the ordering and multiplicity contract
- [A,A] is invalid; [A,B] and [B,A] are permitted
Answer: [A,A] is invalid; [A,B] and [B,A] are permitted
Both serialization orders are permitted, but [A,A] duplicates one append and loses B. A nondeterministic order does not remove the content/multiplicity obligations.
69.A job accepted at t=0 must start by t=5 under a bounded-progress contract. A complete observation at t=6 shows it has never started. What finding follows?
Show answer and explanation
- No finite observation can refute any time-bounded rule
- The job certainly can never start in the future
- The bounded-progress requirement was violated
- The job must be considered successful because it may start later
Answer: The bounded-progress requirement was violated
The deadline has passed without the required start, so the bounded property has a finite counterexample. That does not prove the stronger claim that no future start is possible.
70.A queue's only checked property is that records are never corrupted. A candidate never processes or changes any record. What required delivery property can remain unchecked?
Show answer and explanation
- A no-corruption assertion automatically checks the unobserved progress requirement
- The delivery contract disappears when the implementation chooses not to process work
- Progress of accepted work toward completion
- Never changing a record proves that every accepted job eventually completes
Answer: Progress of accepted work toward completion
A no-corruption safety property can hold for a system making no progress. Include the specified progress/termination behavior when it is part of the contract rather than assuming one property implies the other.
71.An atomic move must expose only states (source,destination)=(1,0) before or (0,1) after. A test observes intermediate (0,0), then final (0,1). What follows?
Show answer and explanation
- The observed intermediate state violates the atomic visibility contract
- The intermediate state is permitted because its sum is zero
- The final correct state erases every earlier violation
- Only the final state can ever be observable under the premise
Answer: The observed intermediate state violates the atomic visibility contract
The contract constrains intermediate observations as well as the final result. A later correct outcome does not undo the supplied visibility violation at (0,0).
72.A stack's pop operation is specified only when the stack is nonempty. No empty-stack behavior is defined. A test demands null from
pop(empty). What is the oracle problem?Show answer and explanation
- The nonempty-stack contract proves all empty-stack tests must pass
- It invents an expected result outside the specified domain
- Null is necessarily the only possible empty-stack result
- A missing precondition always means every input is valid
Answer: It invents an expected result outside the specified domain
An unsupported precondition violation supplies no required null outcome. Clarify the rejection or behavior contract before using that assertion to classify the implementation.
73.A reducer shrinks a failing parser case until a missing fixture file causes an unrelated setup exception. Its predicate accepts any exception as 'same bug'. What has gone wrong?
Show answer and explanation
- A reducer needs no checked failure predicate because removing input always preserves the target bug
- The smallest failing setup is automatically a reproduction of the original parser mechanism
- Any exception establishes the original parser failure even when parsing never starts
- The reduction predicate no longer preserves the target failure
Answer: The reduction predicate no longer preserves the target failure
A useful minimized reproducer must retain the failure being investigated. Replacing a parser defect with setup failure can yield a small but irrelevant case if the predicate checks only that something threw.
74.A reference counter model starts at 0, but the actual test fixture starts at 5. One increment returns model value 1 and implementation value 6. What should be resolved before treating the mismatch as an increment defect?
Show answer and explanation
- The mismatch uniquely proves an increment defect without reconciling the supplied starting states
- The model is authoritative even when its relevant initial state differs from the implementation
- The inconsistent initial states of model and implementation
- Change increment so a fixture starting at 5 returns 1, regardless of the required arithmetic
Answer: The inconsistent initial states of model and implementation
Model-based comparison requires aligned relevant starting conditions. This mismatch is explained by the supplied different states and does not alone identify a defect in the increment operation.
75.A state model has nonnegative integer queued and running counts, constrained by queued+running≤2. Every such pair is reachable. How many states belong in that declared state-coverage domain?
Show answer and explanation
- 9
- 3
- 6
- 4
Answer: 6
The pairs are (0,0),(0,1),(0,2),(1,0),(1,1),(2,0). Counting an unrestricted 3×3 grid would include impossible states whose total exceeds two.
76.A queue model rejects Remove on an empty queue without changing state. The test starts empty and sends Remove. Which expected observation matches this negative-transition contract?
Show answer and explanation
- A rejection that also inserts a placeholder item
- A successful removal of an invented item
- A rejection and an empty queue afterward
- Any state because the request was invalid
Answer: A rejection and an empty queue afterward
The invalid event has specified behavior: rejection plus unchanged empty state. Invalid input is not automatically unconstrained when the contract explicitly defines its handling.
77.An oracle returns Unknown when a case is outside its annotated reference set. The harness converts Unknown to Pass. What conclusion follows?
Show answer and explanation
- Those converted results do not establish correctness of the unclassified cases
- Every unannotated case is necessarily correct
- Unknown proves the implementation failed every such case
- Abstention is equivalent to a positive correctness classification
Answer: Those converted results do not establish correctness of the unclassified cases
An unavailable classification is neither a verified success nor necessarily a defect. Preserve the distinction so evidence does not claim judgments the oracle did not make.
78.A function is defined only on {0,1,2}. An oracle verifies f(0)=0 and f(x+1)=f(x)+1 for x=0 and x=1. What values are forced on this entire declared domain?
Show answer and explanation
- Only f(0) is constrained
- f(0)=0,f(1)=0,f(2)=0
- Any three values because relational checks never constrain outputs
- f(0)=0,f(1)=1,f(2)=2
Answer: f(0)=0,f(1)=1,f(2)=2
The anchor gives f(0)=0; the two checked recurrences then force f(1)=1 and f(2)=2. Unlike a loose necessary property alone, this complete finite set characterizes the values on the stated domain.
79.A metamorphic relation requires an unchanged catalog. The catalog revision changes between source and follow-up runs, and the relation fails. What conclusion is justified?
Show answer and explanation
- Follow-up executions are exempt from every unchanged-state assumption of their relation
- The test must ignore its observed data revision and treat the catalog as unchanged
- The mismatch is inconclusive for the intended unchanged-catalog relation
- The relational mismatch uniquely proves a query defect despite the changed required state
Answer: The mismatch is inconclusive for the intended unchanged-catalog relation
A sound relation is conditional on its domain and execution assumptions. When relevant state changes, a mismatch can come from a broken test precondition rather than the target behavior under the intended relation.
80.For one output domain, the contract allows exactly {A,B}. The oracle accepts exactly {A,C}. Which classification is correct?
Show answer and explanation
- It can only reject incorrectly, never accept incorrectly
- It falsely accepts B and falsely rejects C
- It is correct because each set has two members
- It falsely accepts C and falsely rejects B
Answer: It falsely accepts C and falsely rejects B
C is accepted outside the valid set, while valid B is rejected. Equal acceptance-set size does not establish sound or complete classification.
81.For supported n∈{0,1,2}, required f(n)=n². A mutant returns n. Existing tests use 0 and 1. Which additional supported test distinguishes the mutant?
Show answer and explanation
- Test n=2
- No supported input distinguishes it
- Repeat n=0
- Repeat n=1
Answer: Test n=2
The original and mutant agree at 0 and 1. At 2 the required value is 4 but the mutant gives 2, so that input supplies a distinguishing observation.
82.The only observable result is an exact unbounded-integer value. A mutation replaces 2×n with n+n. What can output-based tests distinguish over that domain?
Show answer and explanation
- No difference; these expressions are equivalent under the stated model
- A longer test always makes equivalent expressions return different values
- They differ only when n=0
- They differ for every negative integer
Answer: No difference; these expressions are equivalent under the stated model
Exact integer arithmetic gives 2n=n+n for every n. With no other observables or finite-overflow effects in the contract, no output-based test can distinguish this mutation.
83.Define mutation score as killed/eligible, excluding invalid and proven-equivalent mutants. Forty mutants are partitioned into 6 invalid,4 equivalent,20 killed and10 surviving. What score follows?
Show answer and explanation
- 30/40=3/4
- 40/40=1
- 20/30=2/3
- 20/40=1/2
Answer: 20/30=2/3
Eligible mutants are 40−6−4=30, comprising twenty killed and ten surviving. The answer follows the explicitly stated denominator rather than a tool-specific reporting convention.
84.A function computes temp=n+1, then overwrites temp with 0 and returns it. Arithmetic is exact, with no exceptions or other observable effects. A mutant changes the first assignment to n−1. What is true?
Show answer and explanation
- The return value becomes −1 for all inputs
- Executing the changed line alone guarantees a test failure
- Every input must expose a different return value
- It has no observable effect under this return-value contract
Answer: It has no observable effect under this return-value contract
Both versions overwrite the intermediate value with zero before any observable use. Reaching a mutation is not enough to distinguish it when no effect propagates to a contracted observation.
85.Original output is {count:2,status:ok}; a mutant produces {count:3,status:ok}. The test reads both fields but asserts only status=ok. Why can the mutant survive?
Show answer and explanation
- The mutation never affects any observable output
- A test must fail whenever any output byte differs, regardless of its assertions
- The differing observable count is not checked by the asserted predicate
- Reading a field automatically asserts its correct value
Answer: The differing observable count is not checked by the asserted predicate
The changed value reaches the response, but the oracle is insensitive to it. Reading or storing output does not establish that the test actually compares the affected contractual value.
86.Known mutant set is {M1,M2,M3}. Test A kills {M1,M2} at cost3, B kills {M2,M3} at cost3, C kills {M3} at cost1. Which listed selection has the lowest cost while killing all three?
Show answer and explanation
- A and C, cost4
- A and B, cost6
- B and C, cost4
- A alone, cost3
Answer: A and C, cost4
A+C covers M1,M2,M3 for 4. A+B also covers them but costs 6; B+C misses M1 and A alone misses M3. The result concerns the specified known-mutant set.
87.A score is defined as killed/eligible mutants. After justified exclusions, eligible=0. What can this ratio alone provide?
Show answer and explanation
- No defined numeric ratio without a separate zero-denominator convention
- An automatic proof of 100% behavioral correctness
- A necessary value of 1 because no eligible mutant survived
- A count of undiscovered production defects
Answer: No defined numeric ratio without a separate zero-denominator convention
The specified arithmetic is 0/0, which is undefined without an additional convention. Even a reporting convention would not turn an empty eligible set into proof of comprehensive behavior testing.
88.Removing test T preserves all observed kills for the known mutant set. T was also the only test of a documented encoding rule not targeted by those mutants. What follows?
Show answer and explanation
- Known kill coverage is retained, but the encoding check is lost
- Retained kills prove every removed test was redundant for every purpose
- The encoding rule becomes irrelevant because no current mutant targets it
- All contractual checks are necessarily preserved by equal mutation score
Answer: Known kill coverage is retained, but the encoding check is lost
A finite mutation set and a contract-check inventory are different measures. Preserve the encoding evidence or replace it explicitly rather than infer full test redundancy from unchanged known kills alone.
89.The original program already fails a test because its fixture is missing. Running a mutant yields that same setup failure. Can this alone be credited as detection caused by the mutation?
Show answer and explanation
- No; the failure also occurs without the mutation
- No mutation test can ever use fixtures
- Yes; every failing mutant run proves mutation sensitivity
- Yes; setup failures uniquely identify the mutated behavior
Answer: No; the failure also occurs without the mutation
Mutation attribution needs a valid baseline and relevant failing observation. An unchanged preexisting setup error does not show the mutation caused the test to fail.
90.A supported operation may legitimately finish in up to 100 ms. A test rejects anything above 80 ms. An otherwise correct run finishes in 90 ms. What is this oracle outcome?
Show answer and explanation
- A valid product deadline violation
- Proof that the operation can never meet 100 ms
- A false rejection caused by a stricter-than-contract threshold
- A false acceptance
Answer: A false rejection caused by a stricter-than-contract threshold
Ninety milliseconds meets the specified bound but fails the test's added eighty-millisecond rule. An oracle can be too restrictive as well as too permissive.
91.A snapshot normalizer replaces every numeric field with zero to hide a variable request ID. Expected deterministic itemCount=3 becomes actual itemCount=5. What can this normalization conceal?
Show answer and explanation
- The incorrect deterministic count as well as the intended variable ID
- Only the request ID, because numeric payload fields cannot be normalized
- A guaranteed count comparison even after both values become zero
- A requirement that every count change is acceptable
Answer: The incorrect deterministic count as well as the intended variable ID
Masking should follow the actual nondeterministic field's semantics. Replacing all numbers erases required payload distinctions and can turn a real count mismatch into a passing comparison.
92.On every snapshot mismatch, a harness overwrites expected output with actual output and then declares success, without review. What distinguishing check remains for changed output semantics?
Show answer and explanation
- None from that mismatch path, because it adopts whatever was observed
- A guarantee that every observed change was intended
- A proof that the old expected result was wrong
- A complete independent expected-output check
Answer: None from that mismatch path, because it adopts whatever was observed
Automatically redefining the expectation to equal the observation removes the independent comparison at the moment it matters. Expected-output changes need an applicable specification and review process.
93.An approved requirement revision allows quantities up to 10; an old oracle rejects anything above 8. A supported input 9 is accepted correctly by the candidate but the old test fails. What must the oracle review consider?
Show answer and explanation
- A previous oracle can never become outdated
- The test's expectation is stale relative to the approved contract
- The candidate must reject 9 to satisfy the current requirement
- Every failed assertion uniquely proves a candidate defect
Answer: The test's expectation is stale relative to the approved contract
A test is evidence against the expectation it encodes. Here the approved requirement changed, so the old bound must be reconciled with that current contract rather than silently redefine compliant behavior as a defect.
94.A required function satisfies f(1)=2. Two implementations both return 0 at input1, and a differential oracle passes whenever they agree. What does this supplied case establish?
Show answer and explanation
- The requirement cannot be used once two programs agree
- Only the first implementation is wrong
- Both are correct because independent agreement overrides the requirement
- Both violate the stated requirement despite passing the agreement oracle
Answer: Both violate the stated requirement despite passing the agreement oracle
Agreement is not an external correctness standard. The explicit required value is 2, so both observed zeros are wrong in this case, even though they match each other.
95.Two implementations of pop are compared by running them sequentially against one shared queue [A,B]. The first returns A and removes it; the second then returns B. What must be addressed before treating the mismatch as an implementation difference?
Show answer and explanation
- Both must be faulty because different outputs always mean different algorithms
- Changing the call order guarantees a correct differential oracle without controlling state
- Their relevant starting states were different because the first call consumed A
- The second call observed the same initial queue by definition
Answer: Their relevant starting states were different because the first call consumed A
Differential comparison requires appropriately aligned inputs and state. The second implementation sees [B], not the first one's [A,B], so this harness can create disagreement even between equivalent implementations.
96.A return-value contract permits different implementations. A test never calls the function; it fails whenever the implementation file's bytes change. A mutant is reported killed by that test. What is established?
Show answer and explanation
- A verified wrong return value from executing the mutant
- A guarantee that equivalent refactorings always preserve file bytes
- A proof that every byte change violates the behavioral contract
- Source-file difference detection, not semantic sensitivity to the return-value contract
Answer: Source-file difference detection, not semantic sensitivity to the return-value contract
The test observes file identity rather than executing or checking the promised return values. It can fail on behavior-preserving changes, so this result does not establish the claimed behavioral fault detection.
97.A parser mode supports negative integers only when extended=true. Original f(n)=
abs(n); a mutant returns n. Tests use only extended=false and nonnegative n. Which supported case distinguishes them?Show answer and explanation
- extended=false,n=2
- extended=true,n=−2
- No supported case can distinguish them
- extended=false,n=0
Answer: extended=true,n=−2
The existing subdomain makes abs(n)=n. Extended mode permits −2, for which the required absolute value is 2 and the mutant returns −2. Equivalence on one tested mode is not equivalence over the whole supported domain.
98.A result contract explicitly permits any real value in [9,11]. An oracle demands exactly the midpoint 10. What happens to a permitted result of 9?
Show answer and explanation
- It must be invalid because every interval requires its midpoint
- It proves the interval has no valid endpoints
- It is falsely rejected by an overly narrow oracle
- It passes an exact-equality-to-10 assertion
Answer: It is falsely rejected by an overly narrow oracle
The contract's allowed-output set includes both endpoints. Requiring one representative value adds an unpromised restriction and rejects permitted behavior.
99.A test visits every branch outcome but then fails its final content assertion. What can the full branch-coverage result establish about test success?
Show answer and explanation
- It makes the content requirement optional
- It proves all assertions passed
- It invalidates every recorded execution observation
- It does not turn the failed assertion into a passing result
Answer: It does not turn the failed assertion into a passing result
Coverage records execution, while assertions evaluate behavior. The branch observations can be real even though the test correctly reports a failing content check.
100.Required f(n)=n for n∈{0,1,2}. The candidate returns 0,1,99 respectively. Tests use only 0 and 1 and kill all generated mutants, which alter only those two outputs. What follows?
Show answer and explanation
- The known mutant set must contain every possible defect
- The failing value 99 becomes valid because no mutant targets it
- All known mutants can be killed while the candidate still violates f(2)=2
- Killing that mutant set proves the candidate is correct at 2
Answer: All known mutants can be killed while the candidate still violates f(2)=2
The suite's known-fault evidence does not cover the supplied original defect at untested input2. Mutation adequacy remains conditional on the operators, observations and cases represented.
101.Supported input may contain duplicates. An oracle simultaneously requires output to be strictly increasing and preserve the exact input multiset. For input [2,2], what is the issue?
Show answer and explanation
- Dropping one copy of 2 preserves the exact required multiset
- The oracle requirements conflict on this supported input
- More tests can make these two conflicting properties simultaneously satisfiable for the same input
- Keeping [2,2] satisfies strict increase as well as exact preservation
Answer: The oracle requirements conflict on this supported input
Preservation requires two copies of 2, but strict increase forbids adjacent equal values in a sorted two-item output. Resolve the inconsistent oracle/contract, rather than label every implementation faulty for an impossible combination.