Github Copilot Practice Questions
Prepare for GH-300 with more than an answer.
Unlock the full exam and previous versions
- v1Version 1 176 questions Current
- GITHUB-COPILOTLegacy Github Copilot Extended 224 questions Locked
- Exam fee
- $99 USD
- Time limit
- 100 minutes
- Questions on the exam
- 65
- Passing score
- 700 (scale 100-1000)
- Level
- Intermediate
- Valid for
- 2 years
Domains covered on the exam 7
- Responsible AI7%
- GitHub Copilot Plans and Features31%
- How GitHub Copilot Works and Handles Data15%
- Prompt Crafting and Prompt Engineering9%
- Developer Use Cases for AI14%
- Testing with GitHub Copilot9%
- Privacy Fundamentals and Context Exclusions15%
- 1
True or False: The GitHub Copilot Individual plan allows users to disable telemetry data collection.
Show answer details
Correct answer: B
This statement is false. The ability to manage and disable telemetry data collection is a feature of the GitHub Copilot Business and Enterprise plans. Users on the Individual plan cannot opt out of telemetry collection, although their code snippets are still not used to train public models if they have opted out of that specific setting.
- 2
A developer wants to create a regular expression in JavaScript to validate an email address. They type a comment and trigger GitHub Copilot. The following diagram shows the interaction flow. At which stage is the developer's local code context sent to the GitHub Copilot service?
sequenceDiagram participant Dev as Developer's IDE participant Ext as Copilot Extension participant Svc as GitHub Copilot Service participant Model as AI Model Dev->>Ext: User types comment Ext->>Svc: 1. Send prompt and context Svc->>Model: 2. Query model Model-->>Svc: 3. Return suggestion Svc-->>Ext: 4. Send suggestion to extension Ext-->>Dev: 5. Display suggestionShow answer details
Correct answer: A
As shown in the sequence diagram, Stage 1 is when the Copilot Extension in the IDE packages the developer's prompt (the comment) and the surrounding code context (open files, etc.) and sends it over a secure connection to the GitHub Copilot Service for processing.
- 3
A developer asks Copilot Chat, "Explain this code," on a selected function. Copilot provides a high-level summary but misses a critical side effect of the function. To get a more detailed, line-by-line explanation, what is the best follow-up prompt?
Show answer details
Correct answer: C
Effective prompt engineering often involves iterative refinement. When the initial response is insufficient, the best approach is to provide specific, corrective feedback. This prompt clearly states the desired format ('line by line') and the missing information ('describe any side effects'), guiding the model to produce a more accurate and detailed response.
- 4
A software architect is designing a new system and wants to use GitHub Copilot to help generate Infrastructure as Code (IaC) scripts using Terraform. What is a key benefit of using Copilot for this task?
Show answer details
Correct answer: C
One of the primary strengths of GitHub Copilot is its ability to generate boilerplate and repetitive code structures quickly and accurately. For IaC tools like Terraform, this means it can create the basic blocks for defining resources (e.g., a virtual machine, a storage bucket) based on a simple comment, saving significant time and reducing the chance of syntax errors. The developer is still responsible for verifying correctness and security.
- 5
An administrator is configuring GitHub Copilot policies for their organization. They have enabled the 'Suggestions matching public code' policy to be 'Blocked'. What is the expected behavior when a developer using Copilot encounters a situation where the only possible suggestion matches public code?
Show answer details
Correct answer: C
When the policy to block suggestions matching public code is enabled, GitHub Copilot will check its suggestions against its index of public code on GitHub. If a suggestion has a near-match and no alternative suggestions are found, Copilot will simply refrain from providing any suggestion in that instance to comply with the policy. It does not show a warning or a modified version; it withholds the suggestion entirely.
- 6
A financial services company is adopting GitHub Copilot Enterprise. To comply with internal data governance policies, they must prevent any code from their proprietary trading algorithm repositories from ever being used as context for suggestions. The repositories are named
quant-algo-v1,quant-algo-v2, andrisk-model-prod. What is the most effective way to enforce this policy across the organization?Show answer details
Correct answer: D
GitHub Copilot Enterprise allows organization administrators to define content exclusion policies. Specifying repositories by name in the organization's settings is the correct, enforceable, and centralized way to prevent their content from being used by Copilot. Manual developer action is unreliable and doesn't scale. Repository visibility settings (public/private) do not affect Copilot's access for authorized users. A
.githubrepository policy would not be the primary mechanism for this specific task. - 7
A developer is using GitHub Copilot Chat to debug a complex issue in a Python application. They have identified a function that is causing a performance bottleneck but are unsure of the most efficient way to refactor it. Which slash command should the developer use to get a performance-focused rewrite of the selected code block?
Show answer details
Correct answer: D
The
/optimizeslash command is specifically designed to analyze a selected code block and suggest improvements related to performance and efficiency. While/fixaddresses errors and/simplifyimproves readability,/optimizeis the correct command for tackling performance bottlenecks. - 8
True or False: When using GitHub Copilot Business, all code snippets and suggestions are processed ephemerally and are never stored or used to train the underlying public models.
Show answer details
Correct answer: A
This statement is true. For GitHub Copilot Business and Enterprise customers, user prompts and suggestions are not used to train the public models. The data is transmitted securely and processed ephemerally to provide the service, and then discarded. This is a key privacy commitment for business-tier plans.
- 9
A development team lead is tasked with writing a comprehensive test suite for a new microservice. They want to use GitHub Copilot to accelerate this process. Which TWO of the following tasks are well-suited for assistance from GitHub Copilot? (Select TWO)
Show answer details
Correct answer: A, C
- 10
A developer is writing a function to parse a complex configuration file. They provide a comment to GitHub Copilot:
# function to parse user_config.xml. Copilot generates a function that correctly parses an XML structure but fails when given a file with a slightly different schema. What is the most likely cause of the inaccurate suggestion?Show answer details
Correct answer: C
GitHub Copilot's suggestions are heavily influenced by the context provided. A generic comment like
# function to parse user_config.xmlforces Copilot to guess the structure based on common patterns. Providing an example of the XML file's schema within a comment block or as a string variable would give Copilot the specific context needed to generate a more accurate parsing function.
