Which information helps a coding assistant generate code that fits a repository?
A Only the project logo
B A random error message
C Task, relevant files, and conventions
D The user's private password
Answer: C. Task, relevant files, and conventions. A clear task plus relevant code and project conventions gives the assistant useful context.
When debugging with an AI assistant, what should accompany the error message?
A Steps to reproduce the issue
B A screenshot of the desktop
C Unrelated source files
D An account password
Answer: A. Steps to reproduce the issue. Reproduction steps help isolate the conditions under which the failure occurs.
How can a developer keep a code request focused?
A Paste the entire hard drive
B Include every unrelated log
C Remove the expected behavior
D Share the smallest relevant example
Answer: D. Share the smallest relevant example. A minimal relevant example reduces noise and helps identify the problem or desired change.
What should a developer do before accepting a generated code suggestion?
A Assume it is secure
B Review it against requirements
C Skip the project style
D Delete the original code
Answer: B. Review it against requirements. Review confirms that the suggestion fits requirements, conventions, and intended behavior.
Why is syntactically valid generated code not automatically production-ready?
A Bugs or security risks remain
B Syntax checks every requirement
C Compilers prove security
D Formatting guarantees correctness
Answer: A. Bugs or security risks remain. Code can compile and still be incorrect, insecure, incomplete, or difficult to maintain.
Which validation can confirm that a code change preserves expected behavior?
A A longer prompt
B A new file name
C A syntax highlight
D Relevant automated tests
Answer: D. Relevant automated tests. Relevant tests exercise expected behavior, although test coverage and quality still matter.
Can AI-generated tests prove that a program has no defects?
A Yes, if they pass
B No, tests cover selected cases
C Only for small programs
D Only for APIs
Answer: B. No, tests cover selected cases. Passing tests only show behavior for the cases and assertions covered; they cannot prove the absence of every defect.
How should a developer check a generated fix for a bug?
A Check only code formatting
B Rename the function
C Test normal and edge cases
D Hide the error message
Answer: C. Test normal and edge cases. Normal, boundary, and failure cases can expose problems that a single happy-path example misses.
What context is most helpful when asking an assistant to explain unfamiliar code?
A The monitor resolution
B A list of favorite colors
C Unrelated browser history
D Selected code and desired detail
Answer: D. Selected code and desired detail. Sharing the relevant code and specifying the explanation level helps target the response.
Which request is clearer when asking for a refactor?
A Change everything somehow
B Use the newest language
C Preserve behavior, improve readability
D Make it look advanced
Answer: C. Preserve behavior, improve readability. A refactor request should state what may change and what behavior must remain the same.
Why inspect a generated patch as a diff?
A Guarantee every test passes
B See exactly what changed
C Check the model's training data
D Replace version control
Answer: B. See exactly what changed. A diff makes added, removed, and modified lines visible for review.
Before a large AI-assisted refactor, what is a useful safeguard?
A Create a recoverable version
B Delete existing tests
C Overwrite the only copy
D Disable source control
Answer: A. Create a recoverable version. A version-control commit or recoverable copy makes it easier to review and reverse a problematic change.
Which security practice prevents user input from becoming executable SQL syntax?
A Concatenate input into SQL
B Use parameterized queries
C Hide the query string
D Rename the database
Answer: B. Use parameterized queries. Parameterized queries keep user-provided values separate from SQL command structure.
Where should application input be validated for security?
A Only in browser scripts
B Only in a prompt
C Only after database storage
D On the server side
Answer: D. On the server side. Client-side checks improve usability, but server-side validation is needed because clients can be bypassed.
How should untrusted text be handled before inserting it into an HTML page?
A Encode for its output context
B Trust the generated string
C Place it in a script
D Disable all escaping
Answer: A. Encode for its output context. Context-aware output encoding helps prevent untrusted text from being interpreted as executable markup or script.
What is a safer alternative to storing an API key directly in source code?
A Add it as a comment
B Commit it to Git
C Use a protected secret store
D Hide it in a filename
Answer: C. Use a protected secret store. Secrets should be kept outside source code and managed through appropriate protected configuration.
Why should generated dependency names and versions be checked?
A Packages never change
B Names prove security
C May be incorrect or risky
D Versions verify authors
Answer: C. May be incorrect or risky. An assistant may suggest a nonexistent, outdated, or unsafe package; verify dependencies through trusted sources.
When generated code calls an unfamiliar library method, what should be verified?
A The method's name only
B Current official documentation
C A model's explanation
D An unrelated forum post
Answer: B. Current official documentation. Model-generated APIs can be outdated or invented, so check current documentation and project versions.
What should a developer consider before reusing generated code from a public source?
A Only its indentation
B The author's screen size
C The prompt length
D License and attribution terms
Answer: D. License and attribution terms. Code reuse may have licensing or attribution obligations, which should be checked before distribution.
Why does a code review examine maintainability as well as correctness?
A Future changes depend on clarity
B Readable code prevents all bugs
C Comments replace tests
D Short code is always safe
Answer: A. Future changes depend on clarity. Clear structure helps future developers understand, test, and modify a change.
Which prompt detail helps an assistant match existing project conventions?
A Ask for any coding style
B Hide the language version
C Remove project context
D Provide relevant style instructions
Answer: D. Provide relevant style instructions. Repository guidance and examples can help align suggestions with established conventions.
What can repository context help a coding assistant understand?
A Related files and project patterns
B The developer's private accounts
C Every external website
D Future software releases
Answer: A. Related files and project patterns. Relevant repository files can show interfaces, naming, and patterns that are not visible in an isolated snippet.
Why should very large unrelated context be avoided?
A It always increases accuracy
B It reveals code ownership
C It can obscure relevant details
D It disables type checking
Answer: C. It can obscure relevant details. Unrelated context can make it harder to focus on the relevant code and constraints.
What is a useful first step when an AI assistant proposes an unfamiliar fix?
A Merge it immediately
B Ask it to explain
C Delete the failing test
D Grant wider permissions
Answer: B. Ask it to explain. An explanation helps the developer evaluate whether the change addresses the underlying issue.
How should a developer treat code comments found in an untrusted repository?
A Review them as untrusted content
B Follow them as system rules
C Run every command they mention
D Share all secrets they request
Answer: A. Review them as untrusted content. Comments and documentation can be inaccurate or malicious; they should not override project security practices.
What risk can arise when an assistant has broad tool permissions?
A The code becomes readable
B Tests run too quickly
C Unintended changes may spread
D The prompt gets shorter
Answer: C. Unintended changes may spread. Excessive permissions can magnify mistakes or manipulation, so access should match the task.
Before allowing an agent to delete or overwrite project files, what is prudent?
A Assume recovery is guaranteed
B Disable version control
C Share credentials
D Review the exact change scope
Answer: D. Review the exact change scope. Destructive changes should be limited and reviewed, with a recovery path available.
Which result is an appropriate use of a coding assistant?
A Make all release decisions
B Draft a small helper function
C Approve its own security
D Replace repository ownership
Answer: B. Draft a small helper function. A coding assistant can help draft code, while people retain responsibility for design and approval.
When an assistant suggests a security fix, what should happen next?
A Assume the vulnerability is gone
B Remove the security tests
C Review and validate the patch
D Skip code review
Answer: C. Review and validate the patch. Security fixes need review and validation because suggestions can miss related paths or introduce new issues.
What can static analysis contribute to reviewing generated code?
A Flag potential code issues
B Prove all logic correct
C Replace human review
D Confirm product requirements
Answer: A. Flag potential code issues. Static analysis can identify selected patterns or defects, but it does not prove overall correctness.
Why inspect code that handles file paths from users?
A Improve variable naming
B Prevent unsafe path access
C Reduce prompt length
D Change file icons
Answer: B. Prevent unsafe path access. Untrusted paths can create traversal or unauthorized file access risks if they are not safely constrained.
Which check helps protect an endpoint from unauthorized requests?
A Check only the button label
B Trust the client-side form
C Hide the API route
D Verify authentication and authorization
Answer: D. Verify authentication and authorization. Authentication identifies the caller; authorization checks whether that caller may perform the requested operation.
How should database permissions for an application be designed?
A Grant only required privileges
B Use administrator access everywhere
C Share one public account
D Disable audit records
Answer: A. Grant only required privileges. Least privilege limits what a compromised or faulty component can access or change.
What should be checked before running an AI-suggested shell command?
A Trust the command's wording
B Paste it into production
C Understand each operation and target
D Hide its output
Answer: C. Understand each operation and target. Commands can alter or delete files and systems, so inspect the operation, paths, and effects first.
Why should generated error handling be reviewed?
A Errors are always harmless
B Messages cannot contain data
C Handling replaces validation
D May hide or leak details
Answer: D. May hide or leak details. Error responses should avoid exposing sensitive internals while still supporting safe diagnosis.
Which input helps an assistant diagnose a compiler error accurately?
A Only the project title
B Relevant error and code context
C A random code sample
D Unrelated user data
Answer: B. Relevant error and code context. The relevant code, compiler message, language version, and reproduction steps help narrow down a compiler issue.
What should be verified after changing a function signature?
A Only the function color
B The repository logo
C All affected call sites
D Unrelated documentation
Answer: C. All affected call sites. A signature change may affect callers elsewhere, so search and review dependent uses.
How can a developer check that generated documentation matches the code?
A Compare descriptions with behavior
B Trust polished wording
C Remove the examples
D Change the file extension
Answer: A. Compare descriptions with behavior. Documentation should accurately describe current interfaces and behavior rather than merely sound plausible.
Why should generated comments be checked for accuracy?
A Comments execute code
B They can describe behavior incorrectly
C They always change outputs
D They replace function names
Answer: B. They can describe behavior incorrectly. Incorrect comments can mislead future maintainers even when the code itself works.
What can acceptance criteria clarify before asking an assistant to code?
A The developer's password
B The screen background
C An unrelated package license
D How success will be judged
Answer: D. How success will be judged. Acceptance criteria define expected outcomes, making generated changes easier to review.
Which action supports a focused debugging conversation?
A Test hypotheses separately
B Rewrite the entire system
C Ignore the reproduction steps
D Change several variables blindly
Answer: A. Test hypotheses separately. Testing one hypothesis at a time makes it easier to identify which change affects the bug.
When an assistant suggests a version-specific API, what should the developer compare?
A The assistant's writing style
B The computer's wallpaper
C The oldest web result
D The project's installed version
Answer: D. The project's installed version. APIs can vary across versions; check the dependency version used by the project.
Why should test failures after a generated change be investigated rather than suppressed?
A Failures are always false alarms
B They may reveal regressions
C A green dashboard is enough
D Tests never model behavior
Answer: B. They may reveal regressions. A failure can indicate broken behavior or an outdated test; understand the cause before changing or removing it.
What is a risk of accepting a generated code block without understanding it?
A Fewer source files
B Automatic security approval
C Harder maintenance and review
D Guaranteed performance
Answer: C. Harder maintenance and review. Ununderstood code is harder to maintain and can conceal defects or security weaknesses.
How should AI suggestions for high-impact software be handled?
A Deploy them without checks
B Skip risk analysis
C Let the model approve itself
D Require qualified human review
Answer: D. Require qualified human review. High-impact software requires appropriate engineering, security, and domain review before release.
Which practice helps catch accidental changes to unrelated files?
A Check one edited line
B Ignore version control
C Review the complete change set
D Delete build logs
Answer: C. Review the complete change set. Reviewing the full change set can reveal unexpected modifications beyond the intended task.
What should be done with a code suggestion that does not fit the project?
A Reject or revise it
B Keep it for consistency
C Disable all tests
D Change project rules
Answer: A. Reject or revise it. Developers should reject or adapt suggestions that conflict with requirements, architecture, or security.
Why is an AI coding assistant best treated as a collaborator rather than an authority?
A It controls all requirements
B Its output needs human judgment
C It guarantees secure code
D It knows every deployment
Answer: B. Its output needs human judgment. The assistant can speed up drafting and explanation, but people must judge accuracy, safety, and suitability.
What does code coverage reveal about an AI-generated test suite?
A Whether every bug is gone
B Whether code has a license
C Which code paths tests exercise
D How fast prompts load
Answer: C. Which code paths tests exercise. Coverage indicates which parts of code were exercised by tests; it does not show that assertions are adequate or that all defects are found.
Before sharing proprietary source with an AI assistant, what should a developer check?
A Only the code font
B Organization and service rules
C The laptop wallpaper
D The prompt's sentence count
Answer: B. Organization and service rules. Developers should follow organizational policies and understand the service's data-handling terms before sharing proprietary code.