GH-300

Free GH-300 practice questions

10 questions from our GH-300 practice tests, each with the correct answer and a written explanation. Read them with the answers shown, or switch to quiz mode and answer first.

Back to the GH-300 practice exams

Question 1 of 10, Use GitHub Copilot responsibly

A team uses Copilot Chat to generate a function that ranks job applicants by parsing resumes. Which mitigation BEST addresses the risk of the generated logic treating candidates unfairly?

  1. ASwitch Copilot Chat to a different model in the model picker so that the answer is generated without training data
  2. BAdd the resume parser source folder to content exclusions so Copilot cannot read the candidate data
  3. CSet the public code filter to Block so that the ranking logic cannot match any open-source implementation
  4. DReview the ranking criteria for proxies of protected attributes and test outcomes across diverse sample profiles Correct answer

Answer and explanation: Bias in AI-generated logic is mitigated by human review of the criteria and by testing outcomes across varied inputs to detect unfair treatment. The public code filter addresses license and duplication concerns, not fairness; every model is trained on data so switching models does not remove bias; and content exclusions control what context Copilot reads, not whether the generated ranking is fair.

Question 2 of 10, Use GitHub Copilot responsibly. Choose 2.

Your organization adopts the Microsoft Responsible AI principles for its Copilot rollout. A policy states that developers must be able to explain how AI-assisted changes were produced and that a named engineer signs off on every merge. Which TWO principles does this policy primarily address? (Choose two.)

  1. AFairness
  2. BReliability and safety
  3. CInclusiveness
  4. DTransparency Correct answer
  5. EAccountability Correct answer

Answer and explanation: Requiring a named engineer to own each merge reflects accountability, and requiring developers to explain how AI-assisted changes were produced reflects transparency. Inclusiveness concerns empowering people of all abilities, fairness concerns avoiding biased treatment of groups, and reliability and safety concerns consistent, safe operation; none of these is the main focus of the stated policy.

Question 3 of 10, Use GitHub Copilot features

A team runs Copilot CLI in a script and wants it to be able to run git commands without prompting, while never being allowed to run rm. Which configuration meets this requirement with the LEAST privilege?

  1. AAdd the project folder to the trusted folders list, which auto-approves git commands but nothing else
  2. BPass --deny-tool 'shell(git)' and approve rm manually at the first prompt
  3. CPass --allow-all-tools and rely on the trusted-folder prompt to block rm
  4. DStart the CLI with the options --allow-tool 'shell(git)' and --deny-tool 'shell(rm)' Correct answer

Answer and explanation: The --allow-tool and --deny-tool options let you pre-approve specific tools such as shell(git) and explicitly block others such as shell(rm), giving narrow permissions. --allow-all-tools grants everything, the trusted-folder prompt controls which directories Copilot can work in rather than which commands run, and denying git is the opposite of the requirement.

Question 4 of 10, Use GitHub Copilot features

A team wants every Copilot Chat response in their repository to assume TypeScript strict mode, the team's logging library, and Vitest for tests, without each developer repeating this in prompts. What should they add?

  1. AA CODEOWNERS entry that assigns the Copilot bot to the source folder
  2. BA .github/prompts/conventions.prompt.md file that developers run manually
  3. CA .copilotignore file listing the files that use other conventions
  4. DA .github/copilot-instructions.md file describing these conventions Correct answer

Answer and explanation: Repository custom instructions in .github/copilot-instructions.md are automatically added to chat requests in that repository, giving consistent context. A prompt file must be invoked explicitly, so it would not apply automatically; .copilotignore is not a supported Copilot mechanism; and CODEOWNERS controls review assignment, not Copilot context.

Question 5 of 10, Use GitHub Copilot features

A developer uses Copilot CLI and wants it to run a single prompt non-interactively in a CI script and print the result. Which approach should they use?

  1. ARun copilot with the -p option followed by the prompt text Correct answer
  2. BRun gh copilot explain with the prompt in quotes
  3. CRun copilot --resume and paste the prompt when asked
  4. DRun copilot and type /delegate followed by the prompt text

Answer and explanation: Copilot CLI supports a programmatic mode where copilot -p "prompt" executes one prompt and exits, suitable for scripts. /delegate hands work to Copilot coding agent from an interactive session, gh copilot explain was part of the retired GitHub CLI extension, and --resume reopens a previous interactive session.

Question 6 of 10, Understand GitHub Copilot data and architecture

Arrange the general flow of a Copilot inline suggestion. Which sequence is correct?

  1. AProxy filters prompt; IDE gathers context; post-processing filters; model generates; suggestion shown
  2. BIDE gathers context and builds prompt; proxy filters prompt; model generates; post-processing filters; suggestion shown Correct answer
  3. CModel generates; IDE gathers context and builds prompt; proxy filters prompt; suggestion shown; post-processing filters
  4. DIDE gathers context; model generates; suggestion shown; proxy filters prompt; post-processing filters

Answer and explanation: The client first gathers context and constructs a prompt, the proxy screens it, the model generates a completion, post-processing applies filters such as toxicity and public code matching, and then the suggestion is displayed. The other sequences place generation before context gathering or filtering after display, which does not match the pipeline.

Question 7 of 10, Understand GitHub Copilot data and architecture

A developer wonders why Copilot suggested a variable name that appears only in another open tab and not in the current file. Which part of the prompt-building process explains this?

  1. AThe proxy service rewrites suggestions to reuse identifiers found in recent commits
  2. BThe model was retrained overnight on the developer's local workspace and memorized the variable name
  3. CThe public code filter substitutes local identifiers for matching public identifiers
  4. DSnippets from neighboring open files are ranked by similarity and included as context Correct answer

Answer and explanation: The client looks at other open files, ranks snippets by relevance to the code at the cursor, and includes the best ones in the prompt, which is how identifiers from other tabs appear. There is no overnight retraining, the proxy does not rewrite identifiers from commits, and the public code filter suppresses matches rather than substituting names.

Question 8 of 10, Apply prompt engineering and context crafting

A developer builds a multi-turn conversation: first asking Copilot to design a schema, then to generate a repository layer, then tests. On the fourth turn Copilot forgets a field defined in turn one. What is the MOST likely cause and fix?

  1. AOlder turns may be trimmed as history grows; restate key details or reference the schema file Correct answer
  2. BCopilot only keeps the very first message of a conversation; delete the later turns and ask again
  3. CChat history is sent only for slash commands; prefix every message with /explain to keep context
  4. DThe model's knowledge cutoff hides newly defined fields; wait for the next model update to include it

Answer and explanation: As conversations grow, older history can be trimmed or condensed to fit the context window, so restating key facts or referencing the schema file restores them. Copilot does not keep only the first message, knowledge cutoff is unrelated to fields defined in the chat, and history is not limited to slash commands.

Question 9 of 10, Improve developer productivity with GitHub Copilot

Copilot generated tests for a function that parses currency strings, and all tests pass. A reviewer suspects the tests only mirror the implementation. What should the developer do?

  1. ADelete the tests, since tests written by Copilot cannot ever detect any real defect
  2. BWrite assertions from the specification with known expected values, including invalid formats Correct answer
  3. CIncrease the code coverage target to 100 percent and keep all of the existing assertions unchanged
  4. DAsk Copilot to regenerate the implementation so that it matches the passing tests

Answer and explanation: Tests derived from the implementation can encode its bugs; assertions based on the specification with known expected values, including invalid input, test real behavior. Generated tests can be valuable, coverage alone does not validate correctness, and changing the code to fit the tests reverses the purpose of testing.

Question 10 of 10, Configure privacy, content exclusions, and safeguards

Copilot suggestions stop working for all developers behind a corporate proxy after a firewall change, while GitHub.com browsing still works. What is the MOST likely fix?

  1. AReassign every developer's Copilot seat so that their licenses are refreshed after the change
  2. BAllow the Copilot endpoints through the firewall and set the IDE proxy and certificates Correct answer
  3. CTurn on the public code filter so that suggestions are served from GitHub's public cache
  4. DRemove all content exclusion rules, because exclusions block Copilot requests sent through corporate proxies

Answer and explanation: Copilot needs network access to specific service domains, so a firewall change must allow them, and IDEs may need proxy and custom certificate settings. Seat reassignment does not fix network blocks, content exclusions are unrelated to proxies, and the public code filter does not change where suggestions come from.