Improve developer productivity with GitHub Copilot
Drill 20 practice questions focused entirely on Improve developer productivity with GitHub Copilot for the GitHub GH-300 exam. Tap an answer for instant feedback and a full explanation — no sign-up, always free.
A developer inherits a Python module containing a dense, undocumented regular expression that validates internal SKU codes. They select the regex line and ask Copilot Chat to explain it and add a maintainable comment. Which action gives the team the most durable long-term benefit while keeping the developer in their editor?
A developer joins a team and is assigned to fix a bug in a 400-line data-processing module written by a former employee. The code has no comments, uses unfamiliar domain abbreviations, and the developer needs to understand the overall flow before making changes. Which use of GitHub Copilot best reduces the context switching and time needed to comprehend the module before editing?
A developer has written a `calculateShippingCost(weightKg)` function that charges different rates across weight tiers: 0–5 kg, 5.01–20 kg, and above 20 kg. They select the function and ask Copilot Chat to generate unit tests. Copilot returns tests that check one typical value in each tier (e.g., 2 kg, 10 kg, 30 kg) but the developer wants stronger coverage. What is the most effective follow-up prompt to improve the test suite's ability to catch tier-boundary defects?
A developer is preparing a release and needs to produce a human-readable CHANGELOG entry summarizing the changes since the last tag. The repository has dozens of commits with terse messages, and the developer wants to reduce context switching between the terminal, the diff viewer, and the documentation file. Which approach best uses GitHub Copilot to accomplish this within the developer's workflow while keeping the summary accurate?
A developer inherits a Python module with 15 undocumented functions. They want Copilot Chat to generate consistent, accurate docstrings that describe each function's parameters, return values, and raised exceptions based on the actual implementation. Which approach will produce the most accurate and maintainable documentation?
A backend developer needs realistic sample data to seed a dashboard's local database before demoing an analytics feature. They need roughly 500 rows of hourly server CPU metrics that show believable daily peaks and troughs (higher during business hours, lower overnight) rather than uniformly random values. What is the most effective way to use GitHub Copilot Chat to accomplish this?
A developer maintains a Java class `HttpRequestConfig` that currently has a single constructor with 11 parameters, several of which are optional booleans and timeouts. New teammates keep passing arguments in the wrong order, causing hard-to-diagnose bugs. The developer wants Copilot to help make object creation safer and more readable without changing the field set. Which approach best uses GitHub Copilot to improve productivity here while addressing the root problem?
A backend developer is asked to add integration tests for a REST endpoint that reads and writes to a PostgreSQL database. They want Copilot Chat to generate tests that exercise the real persistence layer rather than mocked repositories. Which approach will most reliably produce useful integration tests with Copilot?
A backend developer receives a large, deeply nested JSON payload from a third-party webhook but has no formal contract or schema for it. They want to use GitHub Copilot Chat to produce a validation artifact so the team can reject malformed payloads at ingestion. Which approach best leverages Copilot to reduce context switching while producing a reliable, reusable validation artifact?
A developer is writing a unit test for a service method that calls an external payment gateway over HTTPS. They want Copilot Chat to help isolate the unit under test so the test does not make real network calls, runs deterministically, and can simulate both a successful charge and a gateway timeout. What is the most effective way to prompt Copilot for this test?
A platform engineer maintains a Python service with a complex deployment script that has no documentation. The on-call team keeps paging the engineer because they don't understand the manual recovery steps embedded in the script's error-handling branches. The engineer wants to use GitHub Copilot to reduce this repeated interruption. Which approach best uses Copilot to address the root cause of the context switching?
A developer has written a `calculateShippingCost(weight, zone, isExpress)` function with several conditional branches. They want Copilot Chat to generate unit tests that cover many input combinations without writing a separate test method for each case. Which approach should the developer prompt Copilot to use so the tests remain concise and maintainable as new cases are added?
A developer is testing a `serialize(order)` / `deserialize(bytes)` pair for an order object. Example-based unit tests keep passing, but production occasionally corrupts orders with unusual field combinations the developer never thought to write cases for. They want Copilot to help generate tests that catch these unforeseen combinations without hand-authoring each input. Which prompt approach best leverages Copilot for this need?
You maintain a repository with three loosely related service modules, each in its own subdirectory with distinct build steps and environment variables. Leadership wants a top-level README that explains the overall architecture and how the modules interact. You open Copilot Chat and type '/doc' with only the root package.json in the active editor. The generated README describes the root project generically but says nothing about how the three services communicate or their individual setup steps. What is the most effective way to improve the result?
A developer needs a realistic dataset to demo a customer-analytics dashboard. They have a production `customers` table schema (name, email, phone, signup_date, lifetime_value) but company policy forbids copying real production records into non-production environments. They open the schema file and ask Copilot Chat to generate 200 sample rows. Which approach best satisfies both the demo need and the policy?
You are building a payment-processing module that must be tested against customers in Germany, Japan, and Brazil. You ask GitHub Copilot Chat to generate a sample dataset of 50 customer records. Which prompt approach will most reliably produce test data that exercises locale-specific formatting (addresses, phone numbers, postal codes, and currency) rather than generic US-style values?
You are seeding a staging database for a customer analytics dashboard and ask Copilot Chat to generate 500 sample customer records. The first output uses evenly spaced ages, identical purchase counts, and sequential email addresses like user1@test.com through user500@test.com. Your team needs the data to exercise the dashboard's percentile charts, outlier detection, and cohort grouping in a way that resembles production. What is the most effective way to refine your prompt?
You are building a demo environment and need Copilot to generate 200 rows of realistic seed data for a relational database with three tables: `customers`, `orders` (which references `customers.id` via a foreign key), and `order_items` (which references `orders.id`). Which approach is most likely to produce sample data that actually loads without foreign-key constraint violations?
A developer maintains a Python service with dozens of functions that build SQL queries by concatenating raw strings. The team wants to modernize this code to use SQLAlchemy ORM models while preserving the exact query behavior. The developer opens one representative data-access module and asks Copilot Chat to convert it. What is the most effective way to use Copilot for this modernization task while minimizing the risk of introducing behavioral changes?
A backend developer is adding Copilot-generated unit tests for a service class whose methods all depend on an in-memory cache that must be initialized before each test and cleared afterward. Copilot's first draft duplicates the cache setup and teardown code inside every individual test method. What is the most effective way to prompt Copilot to improve the generated test suite while keeping the tests correct?
More GH-300 practice
Keep going with the other GitHub Copilot domains, or take a full timed mock exam.
← Back to GH-300 overview