All Microsoft exams
Free GH-300 practice test: 30 questions with answers
30 original questions for GitHub Copilot, drawn from every topic area. Answer each one to see whether you got it right and why. No sign-up.
- Free questions
- 30
- Full bank
- 100 questions
All 30 GH-300 questions with answers
The same questions as the test above, grouped by exam topic. Open any question to see the answer and explanation.
GitHub Copilot fundamentals (8 questions)
Question 1
A developer types a function signature and a docstring in the editor, and Copilot suggests the function body as grey text. What feature is this?
- ACopilot code review
- BDependabot version updates
- CInline code completion
- DCopilot Workspace planning
Show answer and explanationHide answer
Correct answer: CInline suggestions that appear as the developer types are code completions. Code review, workspace planning and Dependabot updates are separate capabilities.
Question 2
Which Copilot experience lets a developer ask natural-language questions about code in the IDE and receive explanations or proposed edits?
- ACopilot licensing dashboard
- BGitHub Pages
- CDependabot alerts
- DCopilot Chat
Show answer and explanationHide answer
Correct answer: DCopilot Chat provides a conversational interface in the IDE for explanations, questions and edit suggestions. The licensing dashboard manages seats, Dependabot alerts dependencies and Pages hosts sites.
Question 3
A team wants Copilot to suggest changes that address an issue and open a draft pull request from the issue. Which feature supports this?
- ACopilot inline completions only
- BSecret scanning
- CCopilot coding agent
- DGitHub Pages
Show answer and explanationHide answer
Correct answer: CThe Copilot coding agent can work on an assigned issue and propose changes in a pull request for review. Inline completions only suggest code while typing, secret scanning detects credentials, and Pages publishes websites.
Question 4
Why do Copilot suggestions sometimes differ between two developers working on the same file?
- ACopilot pulls a separate code sample from each developer's personal repository history per suggestion
- BSuggestions depend on the surrounding context, the file's open tabs and the model's probabilistic output
- CCopilot is licensed per device, so a seat activated on one computer cannot be used on a second workstation
- DEach developer's editor uses a different color theme for the file, which changes the syntax highlighting shown on screen
Show answer and explanationHide answer
Correct answer: BSuggestions depend on context such as surrounding code and open files, and the model generates probabilistically. Availability, other users' code and themes are not the reasons.
Question 5
A developer wants Copilot to consider a specific file that is not open in the editor when answering a question in Copilot Chat. Which technique is appropriate?
- ACopying the file into the chat as an image, which yields unreliable context because OCR drops code structure
- BReferencing the file explicitly in the chat prompt, such as with a file reference
- CRenaming the file to include the word Copilot so the assistant prioritizes it
- DTurning off context so Copilot ignores the rest of the workspace
Show answer and explanationHide answer
Correct answer: BExplicit file references add the file to the context for the chat. Renaming and images do not provide reliable context, and turning off context removes information the answer needs.
Question 6
Which IDE capability lets Copilot propose multi-line edits or changes across several files based on a natural language request?
- AA file explorer that lists folders
- BA font changer for editor typography
- CA spell checker that flags typos in comments
- DCopilot edits or agent mode in the IDE
Show answer and explanationHide answer
Correct answer: DCopilot edits and agent mode propose multi-file changes from a natural language request. Spell checkers, file explorers and font changers do not perform code changes.
Question 7
A developer wants Copilot to run a terminal command as part of an agent task. Which consideration is most important before approving it?
- ARunning commands on production hosts without staging checks
- BIgnoring the command output and exit code so failures go unnoticed in build logs
- CApproving each shell command without reading it to save time
- DReviewing the command for safety and scope before allowing it to run
Show answer and explanationHide answer
Correct answer: DReviewing commands for safety and scope prevents unintended changes or data exposure. Approving blindly, using production servers and ignoring output all increase risk.
Question 8
Which two Copilot features are available in the IDE? (Choose two.)
- AChat for questions and proposed edits
- BA payroll calculator
- CA calendar sync
- DA mailbox rules manager
- EInline code suggestions
Show answer and explanationHide answer
Correct answer: A, EInline suggestions and chat for questions and edits are core IDE capabilities. Payroll, calendar sync and mailbox rules are unrelated to Copilot.
Prompt engineering for GitHub Copilot (8 questions)
Question 9
A developer wants a Python function that validates an email address and returns a boolean, with a docstring and unit tests. Which prompt is most likely to produce a useful result?
- AWrite some code for the email part of the project and keep it looking properly clean, adding whatever else the application needs
- BJust produce something that runs without errors, however it is structured, and do not worry about the details or the expected inputs
- CMake it good overall, clean and polished, and tidy up the naming so it reads nicely to whoever opens it later
- DA specific request that states the language, expected inputs and outputs, edge cases, and that tests should be included
Show answer and explanationHide answer
Correct answer: DSpecific prompts with language, inputs, outputs, edge cases and deliverables give Copilot clear targets. Vague prompts produce unpredictable results.
Question 10
Which practice improves the quality of inline suggestions most directly when writing code?
- ATyping random characters to see what suggestion appears on screen
- BDeleting the comments from the file so that Copilot has much less natural text to read
- CWriting clear function names, comments, and type hints that describe intent
- DUsing very long variable names with no real meaning behind them
Show answer and explanationHide answer
Correct answer: CClear names, comments and type hints give Copilot the intent it needs to suggest correct code. Random input, deleting comments and meaningless names reduce suggestion quality.
Question 11
In Copilot Chat, which slash command is designed to generate unit tests for selected code?
- A/tests
- B/license
- C/explain only
- D/pr
Show answer and explanationHide answer
Correct answer: AThe /tests command generates unit tests for the selected code in Copilot Chat. The /explain command explains code, /pr relates to pull requests and /license is not a test generator.
Question 12
A developer needs Copilot Chat to explain an error message from a failing build log that is included in the chat. Which command is most useful?
- A/explain
- B/clear
- C/tests
- D/new
Show answer and explanationHide answer
Correct answer: A/explain asks Copilot to explain code or error context in plain language. /tests generates tests, /new starts a new project, and /clear resets the conversation.
Question 13
A developer wants Copilot Chat to search the entire workspace for where a function is used before suggesting a refactor. Which chat context reference fits this need?
- A@tests only
- B@workspace
- C#selection of a single line
- DNo reference at all
Show answer and explanationHide answer
Correct answer: B@workspace provides workspace-wide context so answers can consider code across files. A single-line selection limits context and no reference restricts the search.
Question 14
Which practice helps when Copilot's first suggestion is not what the developer needs?
- ARefining the prompt or comments and cycling through alternative suggestions
- BClosing the editor and restarting the machine to reset Copilot's cached state permanently
- CAccepting the first suggestion without reviewing its logic or edge cases before committing
- DReporting the file to GitHub Support for a manual model review
Show answer and explanationHide answer
Correct answer: ARefining the prompt and reviewing alternative suggestions improves results efficiently. Accepting poor suggestions, closing the editor and reporting files are not effective steps.
Question 15
Which two practices help Copilot Chat give more accurate answers about a codebase? (Choose two.)
- AAsking a very broad question with no detail about the codebase
- BChanging the chat's font size
- CAsking the same question repeatedly without changes
- DIncluding the relevant file or code selection as context
- EStating the programming language and framework in the prompt
Show answer and explanationHide answer
Correct answer: D, ERelevant context and explicit language or framework details narrow the answer to the code that matters. Broad, detail-free questions and repeated identical prompts do not add information.
Question 16
Which pattern in a code comment helps Copilot generate a function that matches the team's conventions?
- AWriting the comment in a language nobody on the team reads, so reviewers cannot follow it
- BUsing emoji as the sole content of the comment and no descriptive text
- CLeaving the comment blank above the function signature in the first draft
- DDescribing the expected behavior and including an example of the input and output
Show answer and explanationHide answer
Correct answer: DDescribing behavior and giving an example input and output communicates intent clearly. Unreadable language, emoji-only comments and blank comments give Copilot little to work with.
Responsible use of GitHub Copilot (7 questions)
Question 17
A developer accepts a Copilot suggestion that uses a library the team has never reviewed. What should happen before merging?
- AThe library should be installed in production and its version pinned without a security or licensing review by the team
- BThe dependency should be reviewed for licensing, security, and maintenance like any other new dependency
- CThe suggestion should be merged immediately because Copilot selected it for this file
- DThe dependency should be removed from the lock file so it no longer appears in the audit report or the dependency graph
Show answer and explanationHide answer
Correct answer: BSuggested dependencies must be vetted like any other dependency, including licensing and security. Merging immediately, installing without review and hiding dependencies all bypass governance.
Question 18
Which practice helps reduce the risk of accepting insecure code suggested by Copilot?
- AReviewing suggestions and running tests and code scanning before merging
- BIgnoring security alerts for AI-generated code flagged by tools
- CAccepting each suggestion unchanged to speed up sprint delivery
- DDisabling code review for pull requests because Copilot generated the entire change
Show answer and explanationHide answer
Correct answer: AHuman review, tests and code scanning catch insecure or incorrect suggestions before they reach production. Blanket acceptance, disabled review and ignored alerts all remove safeguards.
Question 19
A developer wants to know whether suggestions that match public code are allowed in a commercial product. Which control helps address this concern?
- AAssuming public code matching a suggestion is free to reuse in a commercial product without attribution or review
- BRemoving the license files and copyright headers from the repository so the code appears unlicensed to downstream reviewers
- CHiding the source file name from the reviewers so the suggestion origin stays undisclosed during the pull request review
- DEnabling the duplicate detection and public code filter setting, and reviewing licensing for matched code
Show answer and explanationHide answer
Correct answer: DDuplicate detection and public code filters reduce the chance of matching public code, and licensing review addresses remaining concerns. Assuming free use, hiding names and removing license files are not appropriate controls.
Question 20
Why should developers avoid pasting secrets or confidential data into Copilot prompts?
- ACopilot does not transmit prompts to a remote service, since each request is handled on the developer's own workstation
- BSecrets become publicly readable when the file is a Markdown file that is rendered in a preview pane on GitHub
- CPrompts may contain sensitive information that should be protected, so only data that is appropriate to share should be included
- DPrompts are automatically deleted from Copilot's servers once the response has been returned to the editor
Show answer and explanationHide answer
Correct answer: CSensitive data in prompts must be handled under organizational policy, so only appropriate data should be shared. The other statements are incorrect or unsupported.
Question 21
Which two actions help teams use Copilot-generated code responsibly? (Choose two.)
- AWriting or running tests that validate the behavior of suggested code
- BDocumenting when AI assistance was used and reviewing it like any other contribution
- CMerging generated code without reading it
- DDisabling all linting so that suggestions are not flagged
- EHiding Copilot usage from reviewers
Show answer and explanationHide answer
Correct answer: A, BTests validate behavior, and reviewing and documenting AI assistance keeps accountability clear. Merging unread code, disabling linting and hiding usage all reduce quality and transparency.
Question 22
A team is concerned that Copilot might suggest code with a known security weakness. Which combined control is most effective?
- AReviewing generated code for style and formatting alone while the diff logic is left unexamined
- BTrusting the model because it is from a large provider and its output is pre-approved for merging
- CSecret scanning and code scanning run on pull requests along with human review
- DTurning off the security tools to avoid false alarms in the CI pipeline during the sprint
Show answer and explanationHide answer
Correct answer: CCode scanning and human review catch insecure patterns in generated code, and secret scanning catches exposed credentials. Disabling tools, style-only review and trusting the provider leave vulnerabilities undetected.
Question 23
Which policy on AI-generated content best supports transparency for a regulated project?
- AAllowing AI use without keeping a record of which files or commits it touched in the pull requests
- BUsing AI for documentation that is not reviewed before it is posted
- CHiding AI use in the commit history so auditors do not ask questions
- DRecording where AI assistance was used and keeping review evidence for audits
Show answer and explanationHide answer
Correct answer: DRecording where AI assistance was used and keeping review evidence supports audits and accountability. Hiding use, keeping no records and skipping review undermine compliance.
GitHub Copilot for business administration (7 questions)
Question 24
An organization wants to allow Copilot only for approved repositories. Which setting controls this?
- AContent exclusion and policy controls for Copilot in the organization settings
- BThe user's profile picture and the avatar displayed beside their commits in the activity feed
- CThe repository's star count and fork count shown on its landing page
- DThe organization's logo, its brand colors, and the favicon used on the public homepage banner
Show answer and explanationHide answer
Correct answer: AContent exclusion and organization policies control which code and users are covered by Copilot. Stars, logos and profile pictures do not control Copilot access.
Question 25
A security team wants to prevent Copilot from using certain sensitive files as context. Which feature supports this?
- AAdding the sensitive files to the README so they are listed as fully supported context
- BMaking the files public in the repository so their content can be indexed freely
- CContent exclusion rules that specify files or paths Copilot should not use
- DRenaming the files to add a prefix such as x_ so the filter skips them during indexing
Show answer and explanationHide answer
Correct answer: CContent exclusion rules define files or paths that Copilot should not use for context or suggestions. README entries, renaming and public visibility do not restrict Copilot.
Question 26
An organization needs to assign Copilot seats to specific teams and track usage. Which tool provides this?
- AThe release notes page that lists each Copilot feature change
- BThe Copilot seat management and usage metrics in the organization settings
- CThe repository's wiki, which documents the seat policy but cannot assign licenses
- DThe organization's discussions page, where members ask many questions about Copilot
Show answer and explanationHide answer
Correct answer: BSeat management and usage metrics in the organization settings allow assignment and tracking by team. Release notes, wikis and discussions do not manage seats.
Question 27
A company wants to know whether developers find Copilot useful and where it helps most. Which measure is most informative?
- AUsage and acceptance metrics collected by the organization, combined with developer feedback
- BThe number of emojis used in chat threads during code reviews and pull request discussions
- CThe total number of Copilot seats purchased during the most recent billing cycle
- DThe age of the company's logo and the font used in the old marketing deck
Show answer and explanationHide answer
Correct answer: AAcceptance and usage metrics with feedback show how Copilot is used and its value. Seat counts alone do not show usefulness, and emojis and logos are irrelevant.
Question 28
Which two statements about Copilot policies for organizations are accurate? (Choose two.)
- APolicies must be configured separately in every developer's IDE only
- BPolicies cannot be changed once set
- COrganization owners can manage which features are enabled for members
- DPolicies can restrict Copilot features based on the organization's requirements
- EPolicies apply automatically to personal accounts outside the organization
Show answer and explanationHide answer
Correct answer: C, DOrganization owners manage Copilot feature availability for members through policies that match requirements. Policies do not automatically govern personal accounts, they are managed centrally, and they can be changed.
Question 29
Which Copilot business control determines whether members can use Copilot features that send code snippets to external models?
- AThe repository's topics shown on the homepage
- BOrganization policies for model and feature availability
- CThe user's avatar and profile photo displayed
- DThe organization's Discussions categories list
Show answer and explanationHide answer
Correct answer: BOrganization policies control which Copilot features and model options are available to members. Topics, avatars and discussion categories do not govern feature access.
Question 30
A company must keep its code out of Copilot's suggestions for a specific project folder with proprietary algorithms. Which setting should be configured?
- AMaking the folder public
- BAdding the folder to a public gist
- CContent exclusion for that path
- DChanging the folder name to a random string only
Show answer and explanationHide answer
Correct answer: CContent exclusion keeps specified paths out of Copilot context and suggestions. Public exposure, public gists and random renaming do not exclude the code.
Want more GH-300 questions?
The full bank has 100 questions with answers and explanations, as a PDF, an online practice exam, or both.
Both formats together. The best value.
Instant access after payment, with 90 days of updates. Checkout is on our store, AIExamCerts.