Try each one before opening the answer. Every option is explained, with the GitHub documentation page that proves it.
Question 1 · choose 1
A developer asks Copilot Chat for a date-parsing function and pastes six differently formatted dates with the output each one should produce. Which prompting technique is this?
AZero-shot prompting
BRole prompting
CFew-shot prompting
DChain prompting
Show the answer and why
AZero-shot prompting
Incorrect
Examples were supplied here, so the prompt isn't zero-shot.
BRole prompting
Incorrect
No expert role was assigned in the prompt.
CFew-shot prompting
Correct
Presenting several examples is few-shot prompting, which sits between zero-shot unpredictability and the precision of fine-tuning.
DChain prompting
Incorrect
Everything was given in a single prompt, not built up over several turns.
Few-shot prompting gives several examples so that Copilot understands the patterns expected, which helps with sophisticated implementations and edge cases. GitHub's prompt engineering guide also recommends giving examples of input data and output.
A developer writes a long Copilot Chat prompt: three paragraphs of edge-case rules come first, the actual goal ("build a CSV importer") is buried in the middle, and the critical rule "never load the whole file into memory" is in the middle too. How should the prompt be restructured?
AKeep the order but repeat each rule twice so that Copilot cannot miss any of them
BMove the goal to the end, because Copilot reads the last sentence as the task
CSplit it into one message per rule and send them all before stating the goal
DOpen with the goal, then list requirements with the memory rule first
Show the answer and why
AKeep the order but repeat each rule twice so that Copilot cannot miss any of them
Incorrect
Repetition is not the guidance; ordering and clarity are.
BMove the goal to the end, because Copilot reads the last sentence as the task
Incorrect
The guidance is to start with the broad goal, not end with it.
CSplit it into one message per rule and send them all before stating the goal
Incorrect
Breaking down a task helps, but stating the goal after the rules keeps the ambiguity.
DOpen with the goal, then list requirements with the memory rule first
Correct
Start general, then get specific, and put the most important requirements first; Copilot gives extra weight to the beginning and end of a prompt.
GitHub's prompt engineering guidance says to first give a broad description of the goal or scenario, then list specific requirements with the most important ones first. Copilot gives extra weight to instructions at the beginning and end of a prompt, so a critical rule buried in the middle is easier to lose.
A developer has thirty unrelated files open from earlier work while writing a new repository class. Copilot keeps suggesting patterns from an old prototype. What context change does GitHub suggest for code completions?
AOpen the files relevant to the new class and close the unrelated ones
BPin the prototype files so that Copilot treats them as lower priority
CRestart the IDE so that Copilot forgets the project's existing code
DTurn on next edit suggestions so that only the current file is used
Show the answer and why
AOpen the files relevant to the new class and close the unrelated ones
Correct
For code completions, GitHub advises opening relevant files and closing irrelevant ones, because Copilot uses open files as context.
BPin the prototype files so that Copilot treats them as lower priority
Incorrect
Pinning is not a documented way to weight context.
CRestart the IDE so that Copilot forgets the project's existing code
Incorrect
A restart does not change how Copilot uses open files.
DTurn on next edit suggestions so that only the current file is used
Incorrect
Next edit suggestions predict edits; they don't narrow context to one file.
Copilot uses the context available to it. For code completions in your IDE, open any relevant files and close irrelevant ones, because Copilot uses your open files to understand your request. In chat, highlight code and attach context with @ or variables.
A developer writes only the comment "convert Celsius to Fahrenheit" and lets Copilot generate the function, without giving any example. What is this approach called?
AZero-shot prompting
BOne-shot prompting
CFew-shot prompting
DRole prompting
Show the answer and why
AZero-shot prompting
Correct
Zero-shot means Copilot generates code without specific examples, relying on its foundational training.
BOne-shot prompting
Incorrect
No example was given in the comment.
CFew-shot prompting
Incorrect
No examples were given in the comment.
DRole prompting
Incorrect
No expert role was assigned.
In zero-shot prompting, Copilot generates code without any specific examples, relying solely on its foundational training, which suits common patterns such as a temperature conversion.
After several exchanges in Copilot Chat, a developer asks "what does this do?" and gets an explanation of the wrong code block. How should the question be rewritten?
AAsk the same question again until the right block is explained
BAdd "please" and "thank you" so the request is clearer
CName it: "What does the createUser function do?"
DAsk Copilot to explain every code block in the conversation
Show the answer and why
AAsk the same question again until the right block is explained
Incorrect
Repeating the ambiguous question doesn't remove the ambiguity.
BAdd "please" and "thank you" so the request is clearer
Incorrect
Politeness doesn't identify which code is meant.
CName it: "What does the createUser function do?"
Correct
GitHub's guidance is to avoid ambiguous terms like "this" and name the function or response you mean.
DAsk Copilot to explain every code block in the conversation
Incorrect
That avoids the question instead of making it specific.
Avoid ambiguous terms. "What does this do" could mean the current file, the last Copilot response or a specific code block. Be specific instead, for example "What does the createUser function do?" or "What does the code in your last response do?"
A developer asks Copilot to parse files with a little-known in-house library, and the suggestions keep using a popular open-source parser instead. What does GitHub suggest?
ASwitch to a premium model, which knows every library
BDescribe the library, or put its imports at the top of the file
CBlock suggestions matching public code so that the popular parser can't be used
DDelete the popular parser from node_modules so Copilot can't see it
Show the answer and why
ASwitch to a premium model, which knows every library
Incorrect
No model knows every library; the guidance is to give context.
BDescribe the library, or put its imports at the top of the file
Correct
If you use an uncommon library, describe it; if you want a specific library, set the import statements or say which library to use.
CBlock suggestions matching public code so that the popular parser can't be used
Incorrect
The public code filter doesn't steer library choice.
DDelete the popular parser from node_modules so Copilot can't see it
Incorrect
Copilot's suggestions aren't driven by installed packages in this way; context is.
Ambiguity also applies to libraries. If you are using an uncommon library, describe what it does. If you want to use a specific library, set the import statements at the top of the file or specify which library to use.
In VS Code Copilot Chat, a developer wants to make sure only the lines she has highlighted are included as context for her question. Which chat variable does that?
A#project
B#file
C@terminal
D#selection
Show the answer and why
A#project
Incorrect
#project includes the project context.
B#file
Incorrect
#file includes the current file's content.
C@terminal
Incorrect
@ introduces a chat participant; @terminal knows about the terminal, not your selection.
D#selection
Correct
#selection includes the currently selected text in the prompt.
Chat variables include specific context in a prompt; type # followed by the variable. In VS Code, #selection includes the selected text, #file the current file, #function the current function, #block the current block and #project the project context. Chat participants are introduced with @.