AI Foundations · 18% practice allocation

AI Foundations: AI-Powered Dev Tools Practice Questions

5 free sample questions from the AI-Powered Dev Tools domain, with answers and explanations. The full AI Foundations bank has 735 questions across 5 domains. Questions follow the AI Foundations course content.

1.

An engineering team wants to use an AI assistant to perform a security review of a pull request. Which of the following tasks is an AI coding assistant MOST capable of reliably helping with during this review? (Select TWO)

  • A. Automatically building and deploying a patched version of the code to the staging environment once issues are found
  • B. Flagging common insecure coding patterns such as unsanitized user input passed to SQL queries or shell commands✓ Correct
  • C. Certifying that the reviewed code is free of all zero-day vulnerabilities, including flaws that have not yet been publicly disclosed
  • D. Identifying hardcoded secrets, credentials, or API keys present in the diff✓ Correct
  • E. Verifying at runtime, by executing exploit attempts against the production server, that the application cannot be compromised
Explanation

AI assistants are good at pattern-matching tasks. Two examples are spotting hardcoded secrets and credentials, and flagging well-known insecure patterns such as SQL injection or shell injection through unsanitized input. Both are text patterns you can recognize in a static code review. No AI tool can certify that code is free of all zero-day vulnerabilities, especially ones unknown when the model was trained, and believing it can is a dangerous misconception. AI coding tools work on source code text. They cannot run exploit attempts against a production server at runtime. Building and deploying a patch to staging is an operational CI/CD task, outside the scope of an AI code review assistant.

2.

A developer is using GitHub Copilot in VS Code and notices that the inline suggestions keep offering completions that are stylistically inconsistent with the rest of the codebase — for example, using var instead of const, and callbacks instead of async/await. The codebase enforces ESLint rules and uses modern ES2022 conventions. Which action would MOST effectively guide Copilot toward producing suggestions that match the team's conventions?

  • A. Switch to Copilot Chat and ask it to summarize the ESLint rules, so the summary is carried into later inline completions✓ Correct
  • B. Clear the Copilot extension's suggestion cache by disabling and re-enabling it, so stale style patterns are discarded
  • C. Ensure the relevant ESLint config file and representative existing source files are open in the editor, providing Copilot with in-context style examples
  • D. Upgrade to Copilot Enterprise, which parses the repository's ESLint config and automatically enforces its rules in suggestions
Explanation

Copilot's inline completion relies heavily on the surrounding context: open files and the content near the cursor. Having the ESLint config and well-styled source files open shows Copilot the project's conventions and steers suggestions toward that style. Disabling and re-enabling the extension does not change suggestion style, because there is no suggestion cache that stores style preferences. Asking Copilot Chat to summarize the ESLint rules can explain them, but that summary is not fed back into the inline completion context. Copilot Enterprise offers features like knowledge bases and PR summaries, but it does not automatically parse ESLint rules or enforce them in generated suggestions.

3.

A security-conscious team discovers that their AI coding assistant generated a function that embeds a third-party analytics SDK. The SDK was not in the project's dependency list, and no developer explicitly requested it. When investigating, they find the AI inferred the SDK from a commented-out import at the top of a related file. Which TWO practices would BEST prevent this class of AI-generated dependency injection risk?

  • A. Remove or clean up commented-out imports and dead code from files before using them as context for AI completions.✓ Correct
  • B. Disable the AI assistant entirely whenever working in files that contain commented-out code, re-enabling it only after the file is committed.
  • C. Always accept AI suggestions in full to preserve their context, then perform a batch audit of all new dependencies at the end of each sprint.
  • D. Use a software composition analysis (SCA) tool in the CI pipeline to detect and alert on newly introduced direct and transitive dependencies.
  • E. Configure the AI assistant's prompt or instructions to require explicit developer approval before introducing any new external dependency.✓ Correct
Explanation

The two best preventive practices work before the code is generated. First, clean up commented-out imports and dead code before they enter the AI's context window, which removes the misleading signals that lead the AI to infer unwanted dependencies. Second, instruct the AI to get explicit developer approval before adding any new external dependency, which stops the behavior up front. Accepting suggestions in full and auditing at sprint end is the opposite of safe practice. Turning the assistant off in any file with commented-out code is impractical and overcautious. An SCA tool in CI is a valuable detective control, but it runs after the code has been generated and committed, so it addresses a different layer of the problem.

4.

A developer is using Cursor's Cmd+K (Ctrl+K on Windows) inline edit feature. They select a 15-line function, invoke Cmd+K, and type the instruction: 'make this faster'. The resulting suggestion is a minor cosmetic rename with no performance improvement. What is the MOST likely root cause of this poor result?

  • A. Cursor's underlying model has a context window too small to reason about a 15-line function together with its surrounding file context
  • B. The developer should have used Copilot Chat instead, since Cursor's inline edit feature is optimized only for coordinated multi-file changes rather than single functions
  • C. The instruction lacked specificity — it did not describe the current bottleneck, the desired algorithmic approach, or measurable performance criteria✓ Correct
  • D. Cmd+K is restricted to renaming and formatting operations; performance-oriented rewrites of a selection require opening Composer in agent mode instead
Explanation

Cmd+K makes inline edits based on the natural-language instruction you give it. A vague instruction like 'make this faster' tells the model almost nothing about what kind of optimization is needed: lower time complexity, fewer memory allocations, less redundant I/O, and so on. A precise instruction (e.g., 'Replace the O(n²) nested loop with a dictionary lookup to reduce time complexity') gives far better results. The claim that Cmd+K is limited to renaming and formatting, with performance rewrites needing Composer, is wrong: Cmd+K fully supports performance-related edits. The context-window claim is wrong because fifteen lines is tiny compared with any modern model's context window. The claim that Cursor is optimized only for multi-file changes is wrong: Cmd+K and Composer cover different scopes (inline vs. multi-file), and Cmd+K is the right tool for targeted single-selection edits.

5.

A developer notices that their AI coding assistant produces significantly better completions when working in the middle of a large codebase compared to in a freshly created file. Which context window strategy BEST explains this improvement?

  • A. Surrounding open files, imported modules, and existing function signatures in the same workspace provide relevant context that guides the model toward more accurate and project-specific suggestions.✓ Correct
  • B. The AI retrieves the file's git commit history and fine-tunes on those past diffs at completion time, so files with a longer revision history yield better project-specific suggestions.
  • C. The AI caches previously accepted completions across the workspace and reuses them verbatim whenever a similar code pattern is detected, so mature codebases produce more cache hits and better suggestions overall.
  • D. Larger files trigger a higher-quality model tier in tools like Copilot, which is reserved for substantial codebases and not used for small or empty files.
Explanation

AI coding assistants depend heavily on what is visible in the context window, including open tabs, nearby code, imports, and type definitions, to produce relevant suggestions. A rich codebase gives more signal about naming conventions, patterns, and interfaces. The git-history option is wrong because commit history is not fed to the model as real-time context during completion. The caching option is wrong because the model generates completions fresh; they are not literal cache lookups of earlier outputs. The model-tier option is wrong because tools like Copilot do not switch model tiers based on file size.

Test yourself across every AI Foundations domain

The free AI Foundations practice test mixes about 20 questions weighted like the exam. The full 735-question bank adds instant grading, flashcards and a timed mock exam.

Study this domain

AI-Powered Dev Tools study guide (AI Foundations) →

Other AI Foundations domains

← All AI Foundations study resources