Question 370
A team reports: An eight-year-old Java service uses repeated null-check blocks and must be refactored without changing request semantics. They observe: A helper refactor changes the order of error codes returned for missing fields. Which ONE technical decision most directly corrects the cause?
- Use Copilot to propose one incremental behavior-preserving refactor of the duplicated validation logic.
- Ask Copilot for a scoped async conversion with unchanged HTTP codes and retry semantics.
- Use Copilot to propose a typed docstring, examples, and an error-case note based on source behavior.
- Use Copilot to propose deterministic fake fixtures that match the public order schema and privacy constraints.
Explanation
Correct Answer
A:A cosmetic cleanup modified a relied-upon observable behavior.
Incorrect Answers
B:Asking Copilot for a scoped async conversion with unchanged HTTP codes and retry semantics would not meet the need for Copilot to propose one incremental behavior-preserving refactor of the duplicated validation logic.
C:Using Copilot to propose a typed docstring, examples, and an error-case note based on source behavior would not meet the need for Copilot to propose one incremental behavior-preserving refactor of the duplicated validation logic.
D:Using Copilot to propose deterministic fake fixtures that match the public order schema and privacy constraints would not meet the need for Copilot to propose one incremental behavior-preserving refactor of the duplicated validation logic.
Question 371
A team has implemented the following change: Use Copilot to propose one incremental behavior-preserving refactor of the duplicated validation logic. The original requirement was: An eight-year-old Java service uses repeated null-check blocks and must be refactored without changing request semantics. Which ONE validation test best demonstrates the intended behavior?
- Check generated records for schema validity, reproducibility and absence of real identifiers.
- Run negative cases and compare endpoint contract tests with the old version.
- Run existing regression fixtures and compare public method results before and after.
- Execute the documented examples and check default and invalid timeout behavior.
Explanation
Correct Answer
C:Run existing regression fixtures and compare public method results before and after.
Incorrect Answers
A:Schema-driven tests enforce the expected wire-format contract across generated serialization code. It does not run existing regression fixtures and compare public method results before and after.
B:Generated code requires independently defined acceptance tests and review against the real program contract. It does not run existing regression fixtures and compare public method results before and after.
D:Execute the documented examples and check default and invalid timeout behavior. It does not run existing regression fixtures and compare public method results before and after.
Question 372
A GitHub Copilot task needs TWO complementary actions: the immediate fix and a preventive practice. Context: An eight-year-old Java service uses repeated null-check blocks and must be refactored without changing request semantics. Observed failure: A helper refactor changes the order of error codes returned for missing fields. Select exactly TWO decisions that together address these needs.
- Scan fixtures for secrets and personal data and seed reproducible generators.
- Require characterization tests around legacy behavior before generated refactors.
- Use Copilot to propose one incremental behavior-preserving refactor of the duplicated validation logic.
- Use Copilot to propose a typed docstring, examples, and an error-case note based on source behavior.
- Ask Copilot for a scoped async conversion with unchanged HTTP codes and retry semantics.
Explanation
Correct Answers
B:A cosmetic cleanup modified a relied-upon observable behavior. Require characterization tests around legacy behavior before generated refactors.
C:A cosmetic cleanup modified a relied-upon observable behavior. The necessary intervention is to require characterization tests around legacy behavior before generated refactors.
Incorrect Answers
A:Synthetic fixtures preserve a usable test schema without exposing identifiable patient records to AI prompts. The missing change involves requiring characterization tests around legacy behavior before generated refactors.
D:A docstring clarifies the expected interface, but it does not establish characterization tests that preserve this legacy service’s behavior.
E:Converting code to async could change observable timing and retry behavior; it is not the requested small behavior-preserving null-check refactor.
Question 373
The current design is: Use Copilot to propose one incremental behavior-preserving refactor of the duplicated validation logic. The prior failure was: A helper refactor changes the order of error codes returned for missing fields. Which ONE ongoing control best protects against recurrence of that specific failure?
- Run documentation examples as tests for maintained libraries.
- Require characterization tests around legacy behavior before generated refactors.
- Scan fixtures for secrets and personal data and seed reproducible generators.
- Preserve endpoint contract tests and negative async-failure cases.
Explanation
Correct Answer
B:A cosmetic cleanup modified a relied-upon observable behavior. Require characterization tests around legacy behavior before generated refactors. Preventing this failure involves requiring characterization tests around legacy behavior before generated refactors.
Incorrect Answers
A:Generated code requires independently defined acceptance tests and review against the real program contract. Preventing this failure involves requiring characterization tests around legacy behavior before generated refactors.
C:Synthetic fixtures preserve a usable test schema without exposing identifiable patient records to AI prompts. Preventing this failure involves requiring characterization tests around legacy behavior before generated refactors.
D:Generated code requires independently defined acceptance tests and review against the real program contract. Preventing this failure involves requiring characterization tests around legacy behavior before generated refactors. The observed condition is use Copilot to propose one incremental behavior-preserving refactor of the duplicated validation logic. The prior failure was: A helper refactor changes the order.
Question 374
A team reports: A library's `parse_amount` function handles normal values but lacks unit tests for currency precision boundaries. They observe: A float-based implementation rounds 0.1+0.2 incorrectly. Which ONE technical decision most directly corrects the cause?
- Use Copilot to draft integration tests against an ephemeral test database and real schema migrations.
- Ask Copilot to add an idempotency regression test plus a minimal deduplication implementation.
- Model rate limits and retry-after headers in mocks using the provider's real contract.
- Ask Copilot to propose parameterized tests with zero, negative, huge and fractional-precision inputs tied to the contract.
Explanation
Correct Answer
D:Tests based only on happy-path integers missed precision behavior.
Incorrect Answers
A:Using Copilot to draft integration tests against an ephemeral test database and real schema migrations would not ask Copilot to propose parameterized tests with zero, negative, huge and fractional-precision inputs tied to the contract.
B:Asking Copilot to add an idempotency regression test plus a minimal deduplication implementation would not ask Copilot to propose parameterized tests with zero, negative, huge and fractional-precision inputs tied to the contract.
C:Model rate limits and retry-after headers in mocks using the provider's real contract would not ask Copilot to propose parameterized tests with zero, negative, huge and fractional-precision inputs tied to the contract.
Question 375
A GitHub Copilot workflow needs THREE distinct decisions: a direct implementation, a way to validate it, and a recurring protection. Situation: A library's `parse_amount` function handles normal values but lacks unit tests for currency precision boundaries. Failure: A float-based implementation rounds 0.1+0.2 incorrectly. Select exactly THREE options covering those responsibilities; a choice about another situation does not qualify.
- Run generated tests and confirm exact decimal arithmetic outcomes and exceptions.
- Keep independent decimal boundary fixtures to validate AI-generated tests.
- Audit mock fidelity against provider contracts and adverse responses.
- Ask Copilot to add an idempotency regression test plus a minimal deduplication implementation.
- Ask Copilot to propose parameterized tests with zero, negative, huge and fractional-precision inputs tied to the contract.
- Use Copilot to draft integration tests against an ephemeral test database and real schema migrations.
Explanation
Correct Answers
A:Run generated tests and confirm exact decimal arithmetic outcomes and exceptions.
B:Tests based only on happy-path integers missed precision behavior. Keep independent decimal boundary fixtures to validate AI-generated tests.
E:Tests based only on happy-path integers missed precision behavior. The necessary intervention is to run generated tests and confirm exact decimal arithmetic outcomes and exceptions.
Incorrect Answers
C:Audit mock fidelity against provider contracts and adverse responses. It would leave tested AI-assisted changes that preserve stated requirements without the specified safeguard.
D:An idempotency test addresses duplicate request processing, not floating-point precision at currency boundaries.
F:Database integration and schema migration checks do not validate exact decimal arithmetic in `parse_amount`.
Question 376
During troubleshooting, investigators observe: A float-based implementation rounds 0.1+0.2 incorrectly. The system context is: A library's `parse_amount` function handles normal values but lacks unit tests for currency precision boundaries. Which ONE cause most directly explains the observed failure?
- The test suite did not cover duplicate delivery under race conditions.
- Unrealistic positive-only mocks hid throttling behavior.
- Unit isolation did not validate integration across schema and data layers.
- Tests based only on happy-path integers missed precision behavior.
Explanation
Correct Answer
D:The remedy should therefore be: Ask Copilot to propose parameterized tests with zero, negative, huge and fractional-precision inputs tied to the contract.
Incorrect Answers
A:The remedy should therefore be: Ask Copilot to add an idempotency regression test plus a minimal deduplication implementation.
B:Unrealistic positive-only mocks hid throttling behavior would not address the need for tests based only on happy-path integers missed precision behavior.
C:Unit isolation did not validate integration across schema and data layers would not address the need for tests based only on happy-path integers missed precision behavior.
Question 377
The current design is: Ask Copilot to propose parameterized tests with zero, negative, huge and fractional-precision inputs tied to the contract. The prior failure was: A float-based implementation rounds 0.1+0.2 incorrectly. Which ONE ongoing control best protects against recurrence of that specific failure?
- Keep independent decimal boundary fixtures to validate AI-generated tests.
- Maintain a repeatable integration test environment and migration checkpoints.
- Retain concurrency and duplicate-event tests on every billing release.
- Audit mock fidelity against provider contracts and adverse responses.
Explanation
Correct Answer
A:Tests based only on happy-path integers missed precision behavior. Keep independent decimal boundary fixtures to validate AI-generated tests. Preventing this failure involves keep independent decimal boundary fixtures to validate AI-generated tests.
Incorrect Answers
B:Generated code requires independently defined acceptance tests and review against the real program contract. Preventing this failure involves keep independent decimal boundary fixtures to validate AI-generated tests.
C:Generated code requires independently defined acceptance tests and review against the real program contract. Preventing this failure involves keep independent decimal boundary fixtures to validate AI-generated tests. The observed condition is ask Copilot to propose parameterized tests with zero, negative, huge and fractional-precision inputs tied to the contract. The prior failure was: A float-based.
D:Audit mock fidelity against provider contracts and adverse responses. It would leave verified package identity and dependency provenance without the specified safeguard.
Question 378
A team reports: An HTTP service has unit tests with mocked database calls, but the team needs confidence the live SQL migrations work together. They observe: Mocks pass even though the real insert fails on a missing column. Which ONE technical decision most directly corrects the cause?
- Use Copilot to draft integration tests against an ephemeral test database and real schema migrations.
- Model rate limits and retry-after headers in mocks using the provider's real contract.
- Ask Copilot to add an idempotency regression test plus a minimal deduplication implementation.
- Ask Copilot to propose parameterized tests with zero, negative, huge and fractional-precision inputs tied to the contract.
Explanation
Correct Answer
A:Unit isolation did not validate integration across schema and data layers.
Incorrect Answers
B:Model rate limits and retry-after headers in mocks using the provider's real contract would not meet the need for Copilot to draft integration tests against an ephemeral test database and real schema migrations.
C:Asking Copilot to add an idempotency regression test plus a minimal deduplication implementation would not meet the need for Copilot to draft integration tests against an ephemeral test database and real schema migrations.
D:Asking Copilot to propose parameterized tests with zero, negative, huge and fractional-precision inputs tied to the contract would not meet the need for Copilot to draft integration tests against an ephemeral test database and real schema migrations.
Question 379
A team has implemented the following change: Use Copilot to draft integration tests against an ephemeral test database and real schema migrations. The original requirement was: An HTTP service has unit tests with mocked database calls, but the team needs confidence the live SQL migrations work together. Which ONE validation test best demonstrates the intended behavior?
- Run the migration and create/read/delete workflow in CI with an isolated database.
- Run backoff tests and confirm bounded exponential retry behavior on 429 responses.
- Run generated tests and confirm exact decimal arithmetic outcomes and exceptions.
- Deliver the same event concurrently and verify one invoice record and one downstream send.
Explanation
Correct Answer
A:Run the migration and create/read/delete workflow in CI with an isolated database.
Incorrect Answers
B:Generated code requires independently defined acceptance tests and review against the real program contract. It does not run the migration and create/read/delete workflow in CI with an isolated database.
C:Generated code requires independently defined acceptance tests and review against the real program contract. Verification of this result involves running the migration and create/read/delete workflow in CI with an isolated database.
D:Deliver the same event concurrently and verify one invoice record and one downstream send. It does not run the migration and create/read/delete workflow in CI with an isolated database.
Question 380
During troubleshooting, investigators observe: Mocks pass even though the real insert fails on a missing column. The system context is: An HTTP service has unit tests with mocked database calls, but the team needs confidence the live SQL migrations work together. Which ONE cause most directly explains the observed failure?
- Unit isolation did not validate integration across schema and data layers.
- Unrealistic positive-only mocks hid throttling behavior.
- Tests based only on happy-path integers missed precision behavior.
- The test suite did not cover duplicate delivery under race conditions.
Explanation
Correct Answer
A:The remedy should therefore be: Use Copilot to draft integration tests against an ephemeral test database and real schema migrations.
Incorrect Answers
B:Unrealistic positive-only mocks hid throttling behavior would not address the need for unit isolation did not validate integration across schema and data layers.
C:Tests based only on happy-path integers missed precision behavior would not address the need for unit isolation did not validate integration across schema and data layers.
D:The remedy should therefore be: Ask Copilot to add an idempotency regression test plus a minimal deduplication implementation. That does not establish conformance to the documented serialized payload format.
GitHub Copilot (GH-300) Practice Tests