D4: Prompt Examples & Context Techniques
GH-300 GitHub Copilot exam practice questions · 10 flashcards
Question
Weak prompt example?
1 / 10
Tip: Space flips the card, ← / → navigate.
Show all 10 Prompt Examples & Context Techniques practice questions and answers
- Weak prompt example?'Write code for users.'
- Stronger prompt example?'Create a Python function validate_email(email: str) -> bool using regex; return False for empty strings; include 5 pytest tests.'
- Few-shot example in code?Show two example test cases, then ask Copilot to write more in the same style.
- Context via open tabs?Keep related files open; close irrelevant ones.
- Context via #file?Explicitly reference files in chat.
- Context via selection?Highlight code before asking.
- Context via instructions files?Persistent project conventions.
- Iterating prompts?Refine: 'Use async/await', 'add error handling'.
- Asking for plan first?'Outline steps before writing code' improves complex tasks.
- Scenario: Copilot uses wrong framework. Fix?State framework explicitly and reference existing file examples.