D2: Refactoring, Optimizing & Patching with Coding Agents
Google Cloud Professional Agentic Architect exam practice questions · 10 flashcards
Question
How should coding agents refactor code safely?
1 / 10
Tip: Space flips the card, ← / → navigate.
Show all 10 Refactoring, Optimizing & Patching with Coding Agents practice questions and answers
- How should coding agents refactor code safely?Plan first, make incremental changes, run tests after each step, review diffs.
- Why have tests before refactoring?They verify behavior is unchanged.
- How can agents optimize execution runtimes?Profile hotspots, suggest algorithmic improvements, caching, concurrency or right-sized runtimes.
- Why measure before and after optimization?Confirms actual performance gains.
- How can agents patch application-layer vulnerabilities?Analyze scanner findings, update dependencies, fix insecure code (e.g. injection), and add tests.
- Which inputs help vulnerability patching?Security scan results (e.g. Artifact Analysis), CVE details and stack traces.
- Why review agent-generated patches?Fixes may be incomplete or introduce new bugs.
- Example application-layer vulnerability?SQL injection, XSS or insecure deserialization.
- How do you verify a patch?Re-run scanners and tests, and add regression tests.
- Why keep changes small and committed often?Easy to review and roll back.