GitHub Copilot · Difficulty

Medium GH-300 practice questions

Applied — put a concept to work in a realistic situation. 171 medium questions available — no sign-up, always free.

Question 1 of 25

A developer is using Copilot Chat in the IDE. They first ask, "Write a Python function that validates an email address using regex." Copilot responds with a working function. The developer then types a second message: "Now add support for internationalized domain names." Copilot correctly modifies the previously generated function without the developer re-pasting it. What mechanism allows Copilot to produce the correct modification?

Reviewed for accuracy · Report an issue
Question 2 of 25

A developer on your team wants to prevent Copilot from using a directory of sensitive configuration files as context for suggestions. They ask you where and by whom content exclusions can be configured for your GitHub organization's repositories. Which statement accurately describes how content exclusions are set up?

Reviewed for accuracy · Report an issue
Question 3 of 25

A repository administrator configures a content exclusion rule in the repository settings to block Copilot from accessing a directory containing proprietary licensing logic. A developer who has never touched those files opens the repository in their IDE and begins editing an unrelated module. Which statement correctly describes how the content exclusion rule affects this developer?

Reviewed for accuracy · Report an issue
Question 4 of 25

A developer at a company using Copilot Business reports that when they open `config/prod-secrets.yaml`, which is covered by a repository content exclusion rule, they receive no inline code completions in that file. However, they are surprised that when they manually paste a snippet from that same file into the Copilot Chat panel and ask Copilot to explain it, they still get a response. Which statement best explains this behavior?

Reviewed for accuracy · Report an issue
Question 5 of 25

A platform team adds a content exclusion rule so that files under the `config/secrets/` directory are excluded from Copilot. A developer who normally works across the whole repository reports that Copilot completions have stopped appearing entirely, even in unrelated application source files. What is the MOST likely explanation for this behavior?

Reviewed for accuracy · Report an issue
Question 6 of 25

A developer at Contoso reports that files under a proprietary /vendor directory are still receiving Copilot code completions, even though a repository administrator recently added a content exclusion rule for that directory. When you inspect where content exclusion rules can be defined, which statement correctly describes how Copilot determines which exclusion rules apply to a given file in the IDE?

Reviewed for accuracy · Report an issue
Question 7 of 25

An administrator adds a new content exclusion rule in the repository settings to prevent Copilot from using files in the '/config/credentials' directory. A developer on the team reports that even after the rule was saved, Copilot still generates completions that reference those files while they have the project open in VS Code. What is the most likely reason, and what should the developer do?

Reviewed for accuracy · Report an issue
Question 8 of 25

Your team configured content exclusions so that files under `/config/secrets/` are excluded from Copilot. A developer is editing `app.py` (not excluded), and the code imports and calls functions defined in `/config/secrets/keys.py`. As the developer types in `app.py`, what should they expect regarding Copilot completions?

Reviewed for accuracy · Report an issue
Question 9 of 25

A repository administrator wants to prevent GitHub Copilot from using any files in the repository's `infra/secrets/` directory as context for completions. They open the repository's Copilot content exclusion settings and need to add a path entry. Which entry correctly excludes all files under that directory, including files in nested subdirectories?

Reviewed for accuracy · Report an issue
Question 10 of 25

Your organization has configured content exclusions for a sensitive repository. Some developers use Visual Studio Code, while others use JetBrains IDEs and Neovim. A JetBrains developer reports that content exclusions appear to be respected in their editor, but a teammate insists content exclusions only work in VS Code. Which statement most accurately describes content exclusion support across these editors?

Reviewed for accuracy · Report an issue
Question 11 of 25

A platform administrator adds a new content exclusion rule in the organization settings to block Copilot from accessing a directory containing proprietary configuration files. A developer on the team immediately opens a file in that directory and reports that Copilot is still generating completions based on its contents. What is the most likely explanation the administrator should give?

Reviewed for accuracy · Report an issue
Question 12 of 25

A team lead on the GitHub Copilot Business plan wants to configure content exclusions so that a sensitive configuration directory is never used as context by Copilot. When they navigate to their organization settings, they discover the content exclusion configuration option is not available. What is the most likely reason?

Reviewed for accuracy · Report an issue
Question 13 of 25

A developer at a financial firm reports that Copilot is still suggesting completions inside a sensitive `payment-keys.ts` file, even though an administrator recently added a content exclusion rule targeting that file in the organization's settings. The administrator confirms the YAML rule is syntactically valid and correctly scoped to the file path. What is the MOST likely reason the exclusion is not yet taking effect for this developer?

Reviewed for accuracy · Report an issue
Question 14 of 25

A security engineer at your company wants to prevent GitHub Copilot from ever reading a file named 'secrets.env' that stores API keys. They add it to the repository's content exclusion configuration and ask you whether this now guarantees the file's contents can never appear as context in any Copilot feature. What is the most accurate response about the protection and its limitations?

Reviewed for accuracy · Report an issue
Question 15 of 25

A platform administrator edits the repository's content exclusion settings in the GitHub UI, adding several glob patterns to protect internal configuration directories. A few days later, developers report that files that should have been excluded are still generating inline completions. The administrator confirms the paths are correct but notices the YAML they pasted has inconsistent indentation and a missing colon on one entry. What is the most likely reason the exclusions are not taking effect?

Reviewed for accuracy · Report an issue
Question 16 of 25

An administrator configures a content exclusion in the repository settings to block a directory named `secrets/` from being used by Copilot. A developer on the team reports that Copilot code completions correctly stop referencing files in that directory, but they are worried that Copilot Chat can still surface content from those files through prior indexed context. What should the administrator understand about how content exclusions apply here?

Reviewed for accuracy · Report an issue
Question 17 of 25

A developer uses Copilot agent mode in VS Code to implement a new feature that spans several files. After the agent generates the changes and runs the build task, the compiler reports errors. What does agent mode do next as part of its normal workflow?

Reviewed for accuracy · Report an issue
Question 18 of 25

A developer is using Copilot agent mode in VS Code to implement a feature. As part of completing the task, the agent proposes running a terminal command to install a dependency and run the build. The developer wants to maintain control over what actually executes in their environment. By default, how does agent mode handle terminal commands it generates during a task?

Reviewed for accuracy · Report an issue
Question 19 of 25

A developer needs Copilot to implement a new REST endpoint that requires creating a controller, updating the router, adding a service method, running the test suite, and iterating on failures until the tests pass — all with minimal manual step-by-step direction. Which VS Code Copilot capability is designed to autonomously plan the work, edit multiple files, and run terminal commands within an agentic loop to accomplish this?

Reviewed for accuracy · Report an issue
Question 20 of 25

You are the GitHub Enterprise admin for a company that just enabled GitHub Copilot Business across several organizations. Your compliance team needs to verify, through the enterprise audit log, whenever an administrator changes which repositories or file paths are excluded from Copilot (content exclusion settings). Which approach correctly surfaces these changes?

Reviewed for accuracy · Report an issue
Question 21 of 25

As an organization owner, you need to provide your security team with a machine-readable record of Copilot-related administrative activity—such as when Copilot policies were changed and when seats were assigned or removed—so they can ingest it into their SIEM for long-term retention beyond the default retention window. Which approach best meets this requirement?

Reviewed for accuracy · Report an issue
Question 22 of 25

A developer at a company with the 'Block suggestions matching public code' filter enabled is writing a common data-structure implementation. While typing, they notice Copilot sometimes offers no inline suggestion at all, whereas colleagues in an organization without the filter get suggestions in the same spot. The developer wants to understand what is happening. Which explanation is accurate?

Reviewed for accuracy · Report an issue
Question 23 of 25

Your organization's legal team is concerned that Copilot might surface code completions that match publicly available open-source code. As the Copilot administrator, you want to reduce the likelihood that developers receive suggestions that duplicate public code. Which setting should you enable to address this concern?

Reviewed for accuracy · Report an issue
Question 24 of 25

A backend team wants every developer to be able to trigger a consistent, reusable Copilot Chat prompt that generates a REST endpoint following their internal conventions (naming, error format, logging). They want this prompt versioned in the repository so it stays in sync with their standards and can be invoked directly from the Chat input in VS Code. Which Copilot feature should they use?

Reviewed for accuracy · Report an issue
Question 25 of 25

A developer is working in VS Code and highlights a single method that throws an unexpected exception at runtime. They want to ask Copilot a focused question about just that method and apply a fix directly at the cursor location without leaving the editor context or opening a separate side panel. Which Copilot Chat interface should they use?

Reviewed for accuracy · Report an issue