GH-300 - Improve developer productivity with GitHub Copilot (14% of the exam) - Section 5.1

Use Copilot for code generation, refactoring, documentation, and modernising legacy code.

Use GitHub Copilot to generate code, refactor existing code, write documentation and comments, generate sample data, and modernise legacy code. Match a development task to the Copilot capability that accelerates it without sacrificing review.

Code generationRefactoringDocumentationLegacy modernisation

Practice question for this objective

Free sampleImprove developer productivity with GitHub Copiloteasy

A developer has finished a public utility function and wants Copilot to draft a documentation comment describing its parameters and return value directly above the function in the editor. Which Copilot capability is the most direct fit for this task?

  • APull request summaries, which Copilot writes on GitHub to describe the overall changes in a branch rather than documenting one function inside the editor.
  • BAsking Copilot to generate a documentation comment for the function, which it drafts inline or in Chat covering the parameters and the return value. Correct
  • CContent exclusions, which restrict which files Copilot may read as context and therefore cannot author a documentation comment above the function for the developer.
  • DSeat administration in Copilot Business, which lets an admin assign licences through the REST API but does not draft any documentation for a function.
Use Copilot to generate documentation comments describing a function's parameters and return value, distinct from pull request summaries. Copilot can read a selected function and draft a documentation comment covering its parameters and return value, inline or through Chat. Pull request summaries describe a whole branch on GitHub, while content exclusions and seat administration are unrelated controls that do not author documentation.

Why A is wrong: Tempting because summaries are documentation, but they describe a whole pull request on GitHub, not a single function's parameters and return value in the file.

Why B is correct: Correct: Copilot can generate a doc comment for the selected function, describing its parameters and return value, which is exactly the task described.

Why C is wrong: Content exclusions only limit context sources; they perform no authoring and so cannot produce a documentation comment for the function.

Why D is wrong: Seat administration manages licences for an organisation; it has nothing to do with writing a documentation comment for a function in the editor.

See more GH-300 practice questions, answers explained.

Exam traps in Improve developer productivity with GitHub Copilot

Answers that look right on this material and are not. Each one is a distractor from a different question in the GH-300 bank for this domain.

  • Use inline ghost-text completions for job one, accepting the greyed test body that appears beneath the cursor, since inline completions also hold a back-and-forth conversation about missed cases.

    Why it is wrong: Inline completions offer a single in-place suggestion with no dialogue, so they cannot discuss missed scenarios, which is the conversational requirement of job one.

  • Expect Copilot to migrate the entire repository automatically in one command, with no need for developers to read, test, or adjust the translated modules afterwards.

    Why it is wrong: Tempting as a shortcut, but Copilot does not perform a guaranteed whole-repository migration, and skipping review and testing would leave the translation unverified.

  • Type only the keyword def on a blank line with no name or parameters, so Copilot is free to invent the whole function from scratch without constraints.

    Why it is wrong: Tempting as minimal effort, but with no name, parameters, or intent Copilot lacks context and is far more likely to produce an irrelevant or generic body.

Examworthy is not affiliated with or endorsed by GitHub. Original, blueprint-aligned practice material only.