Microsoft GH-300 Practice Test 37
Question 360
Copilot scaffolds a CRUD endpoint for a documented API, but the release requires both correct access control and conformant responses. Which TWO checks are required? (Select TWO.)
- Validate the endpoint's response schema and status codes through contract tests.
- Return HTTP 200 for every validation error.
- Accept all generated handlers without running tests.
- Log user passwords to simplify investigation.
- Verify per-record authorization and negative access cases.
Explanation
Correct Answers
A:A compilable scaffold may still violate consumer expectations.
E:Authentication alone cannot establish resource ownership permissions.
Incorrect Answers
B:Blanket success codes hide failure semantics.
C:A scaffold is unverified application logic.
D:Credential logging creates avoidable security exposure.
Question 361
A legacy method has nested branching but all external behavior must remain unchanged. How can Copilot help?
- Restore bounded-memory processing for the specified input sizes.
- Search public call sites and preserve compatibility or plan a versioned breaking change.
- Suggest smaller functions and compare behavior with characterization tests.
- Inspect dependency direction and run module import and integration tests.
Explanation
Correct Answer
C:Refactoring should improve structure without changing observable results.
Incorrect Answers
A:A syntactically cleaner refactor can worsen resource use. refactoring should improve structure without changing observable results.
B:Rename safety depends on consumers beyond one module. How can Copilot help. Refactoring should improve structure without changing observable results.
D:Decomposition must respect the language's dependency graph. refactoring should improve structure without changing observable results.
Question 362
A developer asks Copilot to extract repeated error handling into a helper. What must be preserved?
- Inspect dependency direction and run module import and integration tests.
- Search public call sites and preserve compatibility or plan a versioned breaking change.
- Keep exception types, logging semantics, and call-site contracts intact.
- Suggest smaller functions and compare behavior with characterization tests.
Explanation
Correct Answer
C:Deduplication can accidentally alter failure behavior.
Incorrect Answers
A:Decomposition must respect the language's dependency graph. deduplication can accidentally alter failure behavior.
B:Rename safety depends on consumers beyond one module. What must be preserved. Deduplication can accidentally alter failure behavior.
D:Refactoring should improve structure without changing observable results. Deduplication can accidentally alter failure behavior.
Question 363
An AI refactor replaces streaming with loading every file into memory. What should the reviewer catch?
- Restore bounded-memory processing for the specified input sizes.
- Suggest smaller functions and compare behavior with characterization tests.
- Keep exception types, logging semantics, and call-site contracts intact.
- Inspect dependency direction and run module import and integration tests.
Explanation
Correct Answer
A:A syntactically cleaner refactor can worsen resource use.
Incorrect Answers
B:Refactoring should improve structure without changing observable results. A syntactically cleaner refactor can worsen resource use.
C:Deduplication can accidentally alter failure behavior. a syntactically cleaner refactor can worsen resource use.
D:Decomposition must respect the language's dependency graph. a syntactically cleaner refactor can worsen resource use.
Question 364
A code assistant proposes renaming a public library symbol. What check matters?
- Restore bounded-memory processing for the specified input sizes.
- Keep exception types, logging semantics, and call-site contracts intact.
- Search public call sites and preserve compatibility or plan a versioned breaking change.
- Suggest smaller functions and compare behavior with characterization tests.
Explanation
Correct Answer
C:Rename safety depends on consumers beyond one module.
Incorrect Answers
A:A syntactically cleaner refactor can worsen resource use. What check matters. Rename safety depends on consumers beyond one module.
B:Deduplication can accidentally alter failure behavior. rename safety depends on consumers beyond one module.
D:Refactoring should improve structure without changing observable results. Rename safety depends on consumers beyond one module.
Question 365
A class extraction introduces circular module imports. What should the engineer validate?
- Inspect dependency direction and run module import and integration tests.
- Restore bounded-memory processing for the specified input sizes.
- Search public call sites and preserve compatibility or plan a versioned breaking change.
- Keep exception types, logging semantics, and call-site contracts intact.
Explanation
Correct Answer
A:Decomposition must respect the language's dependency graph.
Incorrect Answers
B:A syntactically cleaner refactor can worsen resource use. What should the engineer validate. Decomposition must respect the language's dependency graph.
C:Rename safety depends on consumers beyond one module. decomposition must respect the language's dependency graph.
D:Deduplication can accidentally alter failure behavior. decomposition must respect the language's dependency graph.
Question 366
A new service lacks API documentation but has code and tests. How can Copilot help?
- Replace them with placeholders and use approved credential setup instructions.
- Draft endpoint documentation from implementation and verify examples against tests.
- Draft changes from verified commits and remove unsupported claims before publishing.
- Generate a revised setup guide grounded in current manifests and run it in a clean environment.
Explanation
Correct Answer
B:Code-derived docs still require developer fact checking.
Incorrect Answers
A:Examples should never reveal reusable production secrets. Code-derived docs still require developer fact checking.
C:Generated summaries can miss or misstate user-visible impacts. code-derived docs still require developer fact checking.
D:Documentation correctness must be tested against real installation steps. How can Copilot help. Code-derived docs still require developer fact checking.
Question 367
A complex function has no explanatory comments. What prompt is useful?
- Draft endpoint documentation from implementation and verify examples against tests.
- Replace them with placeholders and use approved credential setup instructions.
- Ask Copilot to describe purpose, invariants, and nonobvious edge cases, then validate claims.
- Draft changes from verified commits and remove unsupported claims before publishing.
Explanation
Correct Answer
C:Comments add value when they explain why rather than repeat syntax.
Incorrect Answers
A:Code-derived docs still require developer fact checking. comments add value when they explain why rather than repeat syntax.
B:Examples should never reveal reusable production secrets. Comments add value when they explain why rather than repeat syntax.
D:Generated summaries can miss or misstate user-visible impacts. comments add value when they explain why rather than repeat syntax.
Question 368
A README setup step uses an obsolete package manager command. What should be done?
- Draft endpoint documentation from implementation and verify examples against tests.
- Ask Copilot to describe purpose, invariants, and nonobvious edge cases, then validate claims.
- Replace them with placeholders and use approved credential setup instructions.
- Generate a revised setup guide grounded in current manifests and run it in a clean environment.
Explanation
Correct Answer
D:Documentation correctness must be tested against real installation steps.
Incorrect Answers
A:Code-derived docs still require developer fact checking. documentation correctness must be tested against real installation steps.
B:Comments add value when they explain why rather than repeat syntax. What should be done. Documentation correctness must be tested against real installation steps.
C:Examples should never reveal reusable production secrets. Documentation correctness must be tested against real installation steps.
Question 369
A developer wants release notes from a merged PR list. What is the prudent workflow?
- Draft endpoint documentation from implementation and verify examples against tests.
- Ask Copilot to describe purpose, invariants, and nonobvious edge cases, then validate claims.
- Generate a revised setup guide grounded in current manifests and run it in a clean environment.
- Draft changes from verified commits and remove unsupported claims before publishing.
Explanation
Correct Answer
D:Generated summaries can miss or misstate user-visible impacts.
Incorrect Answers
A:Code-derived docs still require developer fact checking. generated summaries can miss or misstate user-visible impacts.
B:Comments add value when they explain why rather than repeat syntax. What is the prudent workflow. Generated summaries can miss or misstate user-visible impacts.
C:Documentation correctness must be tested against real installation steps. generated summaries can miss or misstate user-visible impacts.
Question 370
A team uses Copilot to draft API documentation and release notes from a repository. Which TWO validation steps make the artifacts reliable? (Select TWO.)
- Copy a legacy command without checking the current manifest.
- Compare release claims with verified merged commits and tests.
- Execute documentation examples against the current implementation.
- Include live credentials in sample setup commands.
- Publish immediately because the prose reads fluently.
Explanation
Correct Answers
B:Generated summaries may omit or misstate actual changes.
C:Runnable examples detect outdated routes and arguments.
Incorrect Answers
A:Old instructions may fail on the current project.
D:Documentation should never disclose operational secrets.
E:Fluency does not verify source behavior.