Microsoft certification · Exam GH-300

GH-300 Mock Exam Page 4

GitHub Copilot Exam

Free GH-300 mock exam questions 31–35, each with the answer and an explanation.

20 questions · 30 minutes · free, no sign-up

Free GH-300 questions

31–35 of 35 free
Question 31 Choose 2
What types of prompts or code snippets might be flagged by the GitHub Copilot toxicity filter? (Each correct answer presents part of the solution. Choose two.)
Show answerHide answer

Correct answer: A, B Hate speech or discriminatory language (e.g., racial slurs, offensive stereotypes)Sexually suggestive or explicit content

Explanation

Summary:
The GitHub Copilot toxicity filter is a safety mechanism designed to prevent the AI from generating or being prompted to generate harmful, abusive, or unsafe content. Its purpose is to maintain a professional and respectful environment within the development tool. It specifically targets content that is widely recognized as toxic or offensive, not technical inaccuracies or strong opinions.

Correct Option:

A. Hate speech or discriminatory language (e.g., racial slurs, offensive stereotypes):
This is a primary target for the toxicity filter. The system is trained to detect and block language that attacks or demeans a group based on race, religion, ethnicity, gender, or other protected attributes.

B. Sexually suggestive or explicit content:
This type of content is also flagged by the filter. The tool is intended for professional coding environments, and such material is considered inappropriate and unsafe, falling under the definition of toxic content.

Incorrect Option:

C. Code that contains logical errors or produces unexpected results:
The toxicity filter is concerned with the safety and offensiveness of language, not the correctness of code. Bugs, logical errors, and unexpected outputs are a normal part of development and are not flagged as "toxic."

D. Code comments containing strong opinions or criticisms:
While strong opinions might be contentious, they are not inherently toxic. The filter is designed to catch genuinely harmful language, not subjective critiques or debates about coding styles, frameworks, or architectures, as long as they are professionally expressed.

Reference:
GitHub Copilot Documentation: GitHub Copilot and responsible AI - This official resource discusses GitHub's commitment to responsible AI, which includes implementing safety systems like filters to block the generation of offensive or harmful content, aligning with the purpose of a toxicity filter.
Question 32 Choose 2
When using an IDE with a supported GitHub Copilot plug-in, which Chat features can be accessed from within the IDE? (Each correct answer presents part of the solution. Choose two.)
Show answerHide answer

Correct answer: A, B Explain code and suggest improvementsGenerate unit tests

Explanation

Summary:
GitHub Copilot Chat is integrated directly into the IDE to act as a contextual coding assistant. Its features are centered around interacting with and generating code within the current project. This includes explaining existing code to improve understanding and automatically generating test cases to verify functionality, both of which are core tasks in the daily workflow of a developer within their coding environment.

Correct Option:

A. Explain code and suggest improvements:
This is a fundamental feature. Using commands like /explain, developers can get a plain-English summary of what a selected block of code does. Copilot Chat can also proactively suggest refactors or optimizations to make the code more efficient or readable.

B. Generate unit tests:
This is a primary use case. Developers can use commands like /tests or write a prompt asking to "generate unit tests for this function" to quickly create a test suite. Copilot uses the context of the function's code and signature to build relevant test cases.

Incorrect Option:

C. Plan coding tasks:
While Copilot Chat can help break down a coding task after it has been defined, it does not perform high-level project planning, which involves resource allocation, timeline estimation, and stakeholder management. This is outside the scope of an in-IDE tool.

D. Find out about releases and commits:
This is the function of version control tools and the GitHub website/CLI. Copilot Chat does not have access to or the ability to query the git history, release notes, or commit log of a repository. Its context is the code in the editor, not the project's version control metadata.

Reference:
GitHub Copilot Documentation: Using GitHub Copilot Chat - This official resource lists the capabilities of Copilot Chat, including explaining code, generating tests, and suggesting fixes, which directly aligns with options A and B.
Question 33 Choose 1
Which principle emphasizes that AI systems should be understandable and provide clear information on how they work?
Show answerHide answer

Correct answer: B Transparency

Explanation

Summary:
In AI ethics, different principles address specific aspects of responsible development. The principle that focuses on demystifying AI operations, making decision-making processes clear, and providing accessible information to users about how the system functions is distinct from those dealing with bias, accessibility, or responsibility for outcomes.

Correct Option:

B. Transparency:
This principle directly emphasizes that AI systems should be understandable. It requires that organizations provide clear information about the AI's capabilities, limitations, and how it arrives at its decisions or suggestions. For tools like GitHub Copilot, this means being open about data usage, the model's nature as a code predictor, and the potential for inaccuracies.

Incorrect Option:

A. Fairness:
This principle focuses on ensuring AI systems do not create or reinforce unfair bias and that they treat all individuals and groups equitably. It is about mitigating discrimination, not primarily about explaining how the system works.

C. Inclusiveness:
This principle involves designing AI systems that are accessible and beneficial to people with a wide range of abilities and backgrounds. It addresses universal design and accessibility, not the explainability of the system's internal mechanisms.

D. Accountability:
This principle deals with establishing clear responsibility for the development, deployment, and outcomes of an AI system. It ensures there are people or organizations answerable for the AI's behavior, but it does not specifically mandate that the system's operations be understandable.

Reference:
GitHub Copilot and responsible AI - This official resource discusses GitHub's commitment to responsible AI, which includes a focus on transparency by being clear about what Copilot is, how it works, and its potential limitations.
Question 34 Choose 1
What is one of the recommended practices when using GitHub Copilot Chat to enhance code quality?
Show answerHide answer

Correct answer: C Regularly review and refactor the code suggested by Copilot.

Explanation

Summary:
GitHub Copilot is a powerful assistant, but it is not a substitute for developer judgment and ownership of the codebase. A core recommended practice is to maintain an active role in the development process by critically evaluating, testing, and refining the code it generates. This ensures the final code is efficient, secure, and adheres to project standards.

Correct Option:

C. Regularly review and refactor the code suggested by Copilot.
This is the fundamental practice for ensuring code quality. Copilot's suggestions are based on statistical patterns and may not always be the most optimal, secure, or clean implementation. The developer's responsibility is to review the code for logic, efficiency, and security, and then refactor it as needed to fit the specific context and maintain high-quality standards.

Incorrect Option:

A. Avoid using Copilot for complex tasks.
This is not a recommended practice. Copilot can be highly useful for complex tasks, such as generating boilerplate for a new framework or explaining a dense algorithm. The guidance is not to avoid it, but to use it as an aid while maintaining rigorous review.

B. Disable Copilot's inline suggestions.
Disabling the core feature defeats the purpose of using the tool. The recommendation is to use the suggestions intelligently, not to turn them off entirely.

D. Rely solely on Copilot's suggestions without reviewing them.
This is a dangerous and explicitly discouraged practice. Blindly accepting all suggestions can introduce bugs, security vulnerabilities, and poorly structured code into the codebase. The official documentation consistently emphasizes the need for human review.

Reference:
GitHub Copilot Documentation: Working with GitHub Copilot suggestions - This resource discusses best practices, emphasizing that you should always review and test suggestions, which inherently includes the need to refactor them for quality.
Question 35 Choose 1
How can the concept of fairness be integrated into the process of operating an AI tool?
Show answerHide answer

Correct answer: D Training AI data and algorithms to be free from biases will ensure fairness.

Explanation

Summary:
Fairness in AI refers to the principle that an AI system should make unbiased and equitable decisions, avoiding harm or disadvantage to any individual or group. Integrating fairness is a proactive and continuous process that starts with the core components of the system—the data and the algorithms—to prevent biases from being learned and amplified in the first place.

Correct Option:

D. Training AI data and algorithms to be free from biases will ensure fairness.
This is the most foundational and direct approach. Fairness must be engineered into the AI from the beginning. This involves:

Data: Curating diverse, representative training datasets to prevent the model from learning societal or historical biases.

Algorithms: Using techniques to detect and mitigate bias during the model's training process itself.

Addressing bias at this fundamental level is the most effective way to ensure the AI's outputs are fair.

Incorrect Option:

A. Focusing on accessibility will ensure fairness.
While accessibility (making tools usable for people with disabilities) is a crucial aspect of inclusiveness, it is a different ethical principle. A tool can be accessible but still produce biased or unfair outcomes.

B. Focusing on collecting large datasets for training will ensure fairness.
Simply having a large volume of data can amplify existing biases if the data itself is not representative of all relevant groups. The focus must be on data quality and diversity, not just quantity.

C. Regularly monitoring the AI tool's performance will ensure fairness in its outputs.
Monitoring is a critical reactive step for detecting unfairness, but it does not ensure fairness by itself. Ensuring fairness requires proactive measures in the training phase (Option D), with monitoring serving as a subsequent verification and maintenance step.

Reference:
GitHub Copilot and responsible AI - This official resource discusses GitHub's commitment to responsible AI, which includes working towards fairness by investing in techniques and datasets designed to reduce bias in the development of models like the one powering Copilot.

That's the last free question

You've seen the free 30% (35 of 117 questions). Full access unlocks every question and full-length GH-300 mock exams, a different mock on every attempt.

Unlock full mock exam
Full mock exam

Sit the GH-300 exam before exam day

Full-length mocks with the same number of questions and the same time limit as the real GH-300 exam. Every attempt draws a new set of questions from the full bank, so you can keep going until you pass comfortably.

Get full GH-300 mock exam
  • —questions per mock
  • —time limit
  • 117questions in the bank
  • Newmock on every attempt