Limited-Time Offer: Enjoy 50% Savings! Coupon code: 50OFF Use it at checkout
Skip to content

Free Microsoft GitHub Copilot Exam GH-300 Exam Questions

Last updated: · 15 practice questions with answers and explanations

Page: 1 / 13 Total 129 questions

Want more questions? Get Premium Access.

Question 1

New Single answer

Topic: Use GitHub Copilot responsibly

Skill tested: Validate generated code for security, correctness, and suitability before adoption.

A team uses Copilot to draft an endpoint that accepts a customer-supplied file path and reads a file from disk. The generated implementation passes its happy-path unit test, but the service runs with access to several directories containing sensitive data. The release deadline is close, and the team has not yet reviewed how the path is normalized or constrained. What is the BEST next step before merging the generated code?

Correct Answer: B. Review the implementation, add tests for traversal and unauthorized paths, and verify that access is restricted to an approved directory.
Explanation:

Generated code must be reviewed for security and suitability; a happy-path test does not establish that untrusted paths cannot escape the intended directory. The team should inspect the actual path handling, enforce an approved boundary, and test malicious and unauthorized inputs. A passing test is too narrow, Copilot Chat cannot certify security, and switching models does not remove the need for validation.

Question 2

New Multiple answers

Topic: Use GitHub Copilot responsibly

Skill tested: Recognize limitations of AI-generated code and validate behavior before production use.

A developer asks Copilot to implement a date-range calculation for a billing system. The suggestion compiles and matches two examples in the prompt, but the organization operates in multiple time zones and customers can have daylight-saving transitions within a billing period. The developer wants to reuse the implementation in production and needs an appropriately responsible review plan. Which TWO actions are most appropriate? Select two.

Correct Answer: B. Add representative boundary tests for relevant time zones and daylight-saving transitions, then inspect any failures.; D. Review the date and time assumptions against the billing requirements, including time-zone and daylight-saving behavior.
Explanation:

The implementation must be judged against the real billing semantics, not merely whether it compiles or matches a small sample. Reviewing assumptions and adding boundary tests for time zones and daylight-saving transitions directly address the scenario's risk. Type checking cannot prove date logic, comments do not establish behavior, and two examples are insufficient evidence for a production calculation.

Question 3

New Single answer

Topic: Use GitHub Copilot features

Skill tested: Use inline suggestions effectively while controlling the code accepted into a change.

A developer is editing a mature payment module in an IDE with Copilot enabled. Copilot offers a multi-line inline suggestion that appears to implement a requested retry behavior, but the module has strict conventions for idempotency and error handling. The developer wants to use the suggestion without accidentally accepting unrelated code or bypassing review. Which workflow is MOST appropriate?

Correct Answer: A. Inspect the proposed completion, accept only the needed portion when possible, and review and test the resulting changes.
Explanation:

Inline suggestions are proposals, not verified changes. Inspecting the code and accepting only the useful portion keeps the developer in control, while subsequent review and tests verify idempotency, error handling, and consistency with the module. Immediate commits or broad unreviewed edits bypass necessary validation; disabling diagnostics removes useful feedback rather than improving the implementation.

Question 4

New Multiple answers

Topic: Use GitHub Copilot features

Skill tested: Use Copilot Chat context and repository instructions to improve targeted code changes.

A repository has a documented convention that public methods require XML documentation and that new tests use a particular fixture. A developer asks Copilot Chat to refactor one method, but the response uses a different test pattern and changes nearby code that was not part of the request. The developer needs a narrower, convention-aligned result without expanding the change. Which TWO actions are most appropriate? Select two.

Correct Answer: D. Use repository-level custom instructions to describe applicable documentation and test conventions for future Copilot interactions.; E. Provide the relevant method and nearby tests as context, and explicitly limit the requested changes to that method.
Explanation:

Focused context and explicit scope help Copilot Chat produce a targeted answer; repository custom instructions can communicate recurring conventions. Together they address both the immediate refactor and future interactions. Rewriting the repository is unnecessarily broad, removing useful examples makes context worse, and Copilot does not automatically guarantee compliance with local conventions.

Question 5

New Single answer

Topic: Use GitHub Copilot features

Skill tested: Apply Copilot CLI assistance while verifying commands before execution.

An administrator is in a terminal session on a production-support workstation and wants help constructing a shell command to list changed files between two Git references. The command must not modify repository state, and the administrator intends to use Copilot CLI for assistance. Which approach best balances the feature's usefulness with operational safety?

Correct Answer: A. Ask Copilot CLI for a command, inspect the proposed command and its scope, then run it only after confirming that it is read-only and uses the intended references.
Explanation:

Copilot CLI can assist with command construction, but its output still requires review before execution. Confirming that the command is read-only and references the intended Git revisions addresses the production-support constraint. The natural-language request does not guarantee that a generated command is harmless, and cleanup or credential disclosure is unnecessary and unsafe.

Question 6

New Single answer

Topic: Use GitHub Copilot features

Skill tested: Evaluate Copilot coding agent changes through pull request review and testing.

A product team has enabled a Copilot coding agent workflow to address a small issue. The agent opens a pull request with changes and a summary, but the project requires human approval for every change and automated tests must pass before merge. What should the maintainer do next?

Correct Answer: A. Review the diff against the issue, run or inspect required checks, request corrections if needed, and merge only after normal approval requirements are met.
Explanation:

An agent-generated pull request is still a proposed change and remains subject to the repository's review and testing controls. Reviewing the diff and required checks verifies that the implementation matches the issue and does not introduce regressions. An agent's authorship or summary does not replace human approval, and post-deployment review violates the stated process.

Question 7

New Multiple answers

Topic: Use GitHub Copilot features

Skill tested: Apply organization-level Copilot controls to manage access and permitted capabilities.

A company is rolling out Copilot to two engineering teams. One team is permitted to use Copilot Chat in its IDE, while the other is not approved to use Copilot features yet. Organization administrators want the first team to use only capabilities permitted by their policy and need to avoid granting access to the unapproved team. Which TWO administrative actions best meet these requirements? Select two.

Correct Answer: C. Assign Copilot access to the approved team rather than enabling it for every organization member.; D. Configure the available Copilot policies and feature controls to restrict capabilities to those approved for the rollout.
Explanation:

Team-scoped assignment limits who receives Copilot access, while administrative policy and feature controls constrain what enabled users can use. This matches the staged rollout and the approved capability set. A written rule alone does not implement an access restriction, account sharing undermines identity controls, and removing repository access is not the appropriate way to govern Copilot features.

Question 8

New Single answer

Topic: Understand GitHub Copilot data and architecture

Skill tested: Explain how prompt context influences generated Copilot suggestions.

A developer asks why Copilot's completion changes after opening a nearby source file, even though the current line has not changed. The developer assumes that the model sees only the text immediately before the cursor and wants to explain the behavior accurately to a security reviewer. Which explanation is MOST appropriate?

Correct Answer: B. Copilot can use relevant contextual information, such as nearby code and other available editor context, when constructing the input for a suggestion; the exact context is not limited to the preceding line.
Explanation:

Copilot suggestions are generated from a prompt that can include relevant context beyond the immediate preceding line, so changes to available surrounding context can affect the result. This does not mean the model is permanently trained on each opened file or that it indiscriminately reads every file on the computer. The cursor remains important, but it is not the sole possible input.

Question 9

New Single answer

Topic: Understand GitHub Copilot data and architecture

Skill tested: Account for probabilistic model limitations when validating generated code.

A developer asks Copilot for a function that parses a configuration format. Copilot produces a plausible implementation and claims in a nearby comment that it handles every valid input. The format has edge cases that were not included in the prompt, and correctness matters more than speed. What conclusion should the developer draw about the generated result?

Correct Answer: A. A plausible completion can still be incorrect or incomplete, so the developer must validate it against authoritative requirements and representative tests.
Explanation:

Language-model output can be plausible while missing edge cases, and generated comments are not proof of conformance. The developer should compare behavior with the format requirements and test relevant valid and invalid inputs. A lack of generation error or compiler failure says little about semantic correctness, especially for a parser with unprompted edge cases.

Question 10

New Single answer

Topic: Apply prompt engineering and context crafting

Skill tested: Choose zero-shot or few-shot prompting based on the need to convey a pattern.

A team wants Copilot Chat to generate validation functions that follow a project-specific pattern: each function returns a structured result, uses the same error identifiers, and handles missing values consistently. The convention is not common in the language ecosystem, and there is no repository instruction file yet. Which prompt approach is MOST likely to produce output aligned with the pattern?

Correct Answer: A. Provide a concise instruction plus representative examples of the desired input, output, and error handling, then request the new function.
Explanation:

Representative examples make a project-specific pattern explicit and give Copilot concrete demonstrations to follow; the accompanying instruction states the task and constraints. A zero-shot request may be adequate for common conventions but is less reliable when the desired pattern is unusual and undocumented. Asking the model to invent a replacement or relying on language choice does not convey the team's requirements.

Question 11

New Multiple answers

Topic: Apply prompt engineering and context crafting

Skill tested: Refine prompts with relevant context, constraints, and examples for controlled output.

An engineer asks Copilot Chat to write a migration utility. The first response assumes that all records have a valid identifier and emits an unbounded query, while the production system contains legacy records and requires processing in fixed-size batches. The engineer wants a revised prompt that improves relevance without exposing unrelated repository data. Which TWO changes should the engineer make? Select two.

Correct Answer: A. Include the relevant schema and a small example of expected input and output, while keeping unrelated files out of the provided context.; E. State the legacy-record behavior and batch-size requirement explicitly in the prompt.
Explanation:

Explicitly stating how to handle legacy records and requiring bounded batches gives Copilot the missing constraints. Relevant schema and a small input/output example further clarify the expected transformation without supplying unnecessary data. Broadly scanning unrelated files is not needed, removing constraints invites the same unsuitable assumptions, and repetition alone does not add information or guarantee deterministic results.

Question 12

New Single answer

Topic: Improve developer productivity with GitHub Copilot

Skill tested: Use Copilot to create focused tests and verify behavior against requirements.

A developer has completed a small function that converts user-supplied values into normalized identifiers. Copilot can draft tests, but the team's main concern is avoiding regressions for empty values, mixed case, and punctuation. The function's implementation is not yet covered by tests, and the team requires review before merging. What is the MOST productive and responsible next action?

Correct Answer: C. Ask Copilot to generate focused tests for the specified edge cases, review the tests for meaningful assertions, and run them against the implementation.
Explanation:

Copilot can accelerate test creation, while the developer remains responsible for checking that the assertions actually cover the required behaviors. Running the reviewed tests against the implementation provides evidence of behavior and supports the team's merge process. Unreviewed rewrites can introduce defects, and documentation or generated explanations do not replace executable regression tests.

Question 13

New Single answer

Topic: Improve developer productivity with GitHub Copilot

Skill tested: Review and test Copilot-assisted refactoring to preserve existing behavior.

A maintenance team asks Copilot to refactor a complex method into smaller helpers while preserving its public behavior. The suggested refactor is shorter and easier to read, but it changes how a boundary value is handled in one branch. The team has a regression suite and does not want to silently alter the API contract. What should the developer do?

Correct Answer: A. Compare the refactored behavior with the existing contract, retain or correct the boundary behavior, and run relevant regression tests before merging.
Explanation:

A refactor should preserve the established contract; a shorter implementation does not justify a behavior change. The developer should determine whether the boundary case is intentional, correct the implementation accordingly, and run relevant regression tests. Deleting a revealing test conceals a possible regression, while a comment cannot substitute for behavioral evidence.

Question 14

New Single answer

Topic: Configure privacy, content exclusions, and safeguards

Skill tested: Configure repository content exclusions to reduce Copilot use of sensitive files.

An organization wants Copilot to remain available for developers, but a repository contains a file with sensitive internal configuration that should not be used as Copilot context or suggestions where supported. Administrators have configured a content exclusion for the file. A developer reports that the file still appears in the IDE and assumes the exclusion should hide it completely. What is the MOST accurate response?

Correct Answer: B. Content exclusion is intended to control Copilot's use of matching content, not to remove or hide the file from the developer's workspace.
Explanation:

A content exclusion governs whether specified content is used by supported Copilot features; it is not a file visibility or access-control mechanism. Developers may still see the file through normal repository access. The setting should not be treated as a guarantee that related information can never be inferred or returned, nor does it delete files or require uninstalling Copilot.

Question 15

New Multiple answers

Topic: Configure privacy, content exclusions, and safeguards

Skill tested: Manage public-code matching policy and verify how suggestions are handled.

A company's policy requires Copilot suggestions that match public code to be blocked for its managed users. An administrator discovers that the relevant public-code matching control is configured differently than policy requires. The company wants to correct behavior without implying that the control is a substitute for code review. Which TWO actions should the administrator take? Select two.

Correct Answer: B. Set the applicable Copilot public-code matching policy to block matching suggestions for the managed users.; E. Verify that the policy is applied to the intended users and check that the affected client or feature honors the configured control.
Explanation:

The administrator should configure the policy to block public-code matches as required and verify that its scope reaches the managed users and relevant Copilot experience. Controls can vary in applicability by product or feature, so confirming effective configuration matters. The setting does not establish that all generated code is original or safe, and it does not replace review. Version control is unrelated to the matching policy.