Security & Privacy Questions with Answers

25 practice questions on Security & Privacy (AI Tools for Developers) with answers and step-by-step solutions. Try 10 samples below, then practise all 25 free in the AptiNest app.

Sample questions

Question 1Easy

Which of these should you NEVER paste into an unapproved public AI chat tool?

  1. A public open-source error message
  2. A question about Python list syntax
  3. API keys, passwords or customer data
  4. A request to explain what recursion is

Answer: C. API keys, passwords or customer data

Explanation

Secrets and personal data can be retained or exposed outside your control; only approved tools and redacted data should be used.

Step-by-step solution

  1. API keys are sensitive credentials that identify your account.
  2. Passwords protect user access and should never be shared.
  3. Customer data includes personal information that must be protected.
  4. Unapproved tools may store or leak this info, risking security breaches.
  5. Sharing such data violates privacy policies and can lead to fraud.
  6. Final answer: API keys, passwords or customer data.

Why the other options are wrong

  • A. A public open-source error message is safe to share because it contains no secrets or customer data.
  • B. A question about Python list syntax has no secrets, so it is safe to ask in a public tool.
  • D. A request to explain recursion contains no secrets or customer data, so it is safe to share.

Tip: Avoid sharing any confidential info with unknown platforms.

Question 2Easy

Your company has not approved any external AI tool for proprietary code. What should you do?

  1. Paste only half of the code so it doesn't count
  2. Use a personal account at home so nobody notices
  3. Rename the variables and paste it anyway
  4. Follow the policy and ask about approved options

Answer: D. Follow the policy and ask about approved options

Explanation

Company policy governs where code may go; workarounds still leak proprietary information.

Step-by-step solution

  1. Company policy must be followed to protect proprietary code.
  2. Using unapproved tools risks leaking sensitive information.
  3. The best way is to ask about approved options directly.
  4. Follow the policy and ask about approved options.

Why the other options are wrong

  • A. Pasting half the code still leaks proprietary code, so it breaks the policy.
  • B. Using a personal account to hide use breaks company policy and still exposes proprietary code.
  • C. Renaming variables still leaks the proprietary logic, so the policy is broken anyway.

Tip: Check company guidelines before using any tool for code.

Question 3Easy

Which data is generally safest to share with an AI assistant for help?

  1. A small, made-up example that reproduces the problem
  2. Internal financial reports marked confidential, with the names blurred out
  3. A full export of the customer database
  4. The production server's root password

Answer: A. A small, made-up example that reproduces the problem

Explanation

A minimal synthetic reproduction gives the model what it needs without exposing real data.

Step-by-step solution

  1. Option A is a small, made-up example that reproduces the problem.
  2. This avoids sharing any real or sensitive information.
  3. Options B, C, and 3 involve confidential or critical data.
  4. Sharing such data can lead to leaks or misuse.
  5. The safest choice is to share only what is needed.

Why the other options are wrong

  • B. Confidential financial reports stay sensitive, and blurring names does not make them safe to share.
  • C. A full customer database export contains personal data that must not go to an outside AI tool.
  • D. A production root password is a credential that must never be shared with any AI tool.

Tip: Use the least amount of real data necessary to explain the problem.

Question 4Easy

Is it safe to paste a colleague's personal details (phone, address) into a public AI tool to format a document?

  1. No, personal data should not be shared without approval
  2. Yes, if the tool is popular
  3. Yes, as long as you delete the chat afterwards and clear your browser history
  4. Yes, personal details are always public anyway

Answer: A. No, personal data should not be shared without approval

Explanation

Personal data is protected by privacy rules and company policy; use approved tools and minimise what you share.

Step-by-step solution

  1. Personal data like phone and address is private and not meant for public sharing.
  2. AI tools may store or misuse your data even if you delete it later.
  3. Sharing personal details without approval breaks privacy rules and company policy.
  4. You should never paste sensitive info into unapproved public tools.
  5. Final answer: No, personal data should not be shared without approval.

Why the other options are wrong

  • B. A popular tool can still store or misuse data, so popularity does not make sharing safe.
  • C. Deleting the chat does not remove what the tool may have stored, so this is not safe.
  • D. Personal details are not public just because they exist; sharing them still breaks privacy.

Tip: Never share personal data with untrusted tools; always get permission first.

Question 5Medium

Why is it risky to let an AI agent auto-merge its own pull requests to main?

  1. No human verifies the change before it reaches shared code
  2. Pull requests make the agent run slower
  3. Git forbids merging code that was written by automated tools or bots
  4. Agents cannot create pull requests

Answer: A. No human verifies the change before it reaches shared code

Explanation

Required human review is a key control; auto-merging removes the chance to catch bugs or malicious changes.

Step-by-step solution

  1. Auto-merge skips human checks on code changes.
  2. Humans can spot errors or bad code.
  3. No review means risks like bugs or security issues.
  4. This is why auto-merge is risky.
  5. Final answer: A (No human verifies the change before it reaches shared code).

Why the other options are wrong

  • B. Pull requests do not slow an agent; the risk is code merging without a human check.
  • C. Git does not forbid bot-written merges; the danger is lacking human review, not the author type.
  • D. Agents can create pull requests; the risk is merging them without checks.

Tip: Always have humans review code changes before merging.

Question 6Medium

Which practice helps protect against hallucinated or malicious package suggestions?

  1. Use lock files and check new dependencies before adding them
  2. Always install the newest package whose name is closest to the AI's suggestion
  3. Disable signature and integrity checks to save time
  4. Install packages globally with admin rights

Answer: A. Use lock files and check new dependencies before adding them

Explanation

Lock files pin known versions, and reviewing new dependencies (source, maintainers, popularity) catches fake packages.

Step-by-step solution

  1. Lock files pin known versions, preventing unexpected changes.
  2. Checking new dependencies ensures they are safe and trusted.
  3. This stops malicious or fake package suggestions.
  4. Reviewing sources and maintainers adds extra security.
  5. Final answer: Use lock files and check new dependencies before adding them.

Why the other options are wrong

  • B. Installing the newest look-alike package can pull in a typosquatted or malicious package.
  • C. Disabling integrity checks removes protection against tampered packages, so it increases risk.
  • D. Global installs with admin rights widen the damage from a bad package and do not protect against it.

Tip: Always verify package sources and use lock files to avoid fake updates.

Question 7Medium

An agent browsing the web to research an error lands on a page telling it to run a shell command. What is the main risk?

  1. The page will slow down the model's tokeniser
  2. Web pages cannot contain text that a model reads
  3. Untrusted web content can steer the agent into harmful actions
  4. The agent will forget which programming language the project uses and switch

Answer: C. Untrusted web content can steer the agent into harmful actions

Explanation

Web content is untrusted input; without safeguards and human approval, injected instructions can cause real damage.

Step-by-step solution

  1. Untrusted web pages may contain harmful commands that an agent might execute.
  2. Running shell commands from unknown sources can lead to system compromise.
  3. The agent could be tricked into performing actions that harm the system or data.
  4. This risk is due to lack of control over external inputs in a research environment.
  5. Therefore, untrusted content can steer the agent into harmful actions.
  6. Final answer: Untrusted web content can steer the agent into harmful actions.

Why the other options are wrong

  • A. A page slowing the tokeniser is not the main risk; the danger is the agent obeying the page.
  • B. Web pages can certainly contain text that a model reads; that is how this injection happens.
  • D. Switching language is not the main risk; the danger is unsafe actions taken on untrusted content.

Tip: Always validate external inputs to prevent malicious command execution.

Question 8Medium

An agent wants to run curl https://unknown.site/install.sh | bash to set up a tool. What should you do?

  1. Approve it, since install scripts are always safe
  2. Decline or inspect the script and its source first
  3. Approve it and turn off future permission prompts
  4. Run it with sudo so it doesn't fail halfway

Answer: B. Decline or inspect the script and its source first

Explanation

Piping an unknown remote script into a shell runs arbitrary code; verify the source and contents before running.

Step-by-step solution

  1. Piping a download into bash runs unknown code on your machine.
  2. You should not trust an unknown source.
  3. Decline or inspect first.

Why the other options are wrong

  • A. Install scripts are not always safe.
  • C. Never disable prompts.
  • D. sudo gives it more power.

Tip: Read before you run.

Question 9Hard

Which setup best limits damage if an autonomous coding agent is tricked by prompt injection?

  1. Give it production access but ask it politely to be careful
  2. Run it on your main laptop with every permission pre-approved
  3. Store all secrets in the project rules file so it can find them easily
  4. Run it in a sandbox with no production credentials and require approval for risky commands

Answer: D. Run it in a sandbox with no production credentials and require approval for risky commands

Explanation

Isolation, missing credentials and approval gates mean even a hijacked agent can't reach sensitive systems.

Step-by-step solution

  1. Sandbox limits access to system resources.
  2. No production credentials prevent data leaks.
  3. Approval gates stop risky actions without permission.
  4. Secrets stored elsewhere avoid exposure.
  5. All three factors reduce damage from prompt injection.

Why the other options are wrong

  • A. Asking politely is not a control; production access lets injected prompts cause real damage.
  • B. Pre-approving every permission on a main laptop maximises the damage if the agent is tricked.
  • C. Secrets in a project rules file are readable by the agent and can be leaked by prompt injection.

Tip: Use sandboxing, no real credentials and require approvals for safety.

Question 10Hard

A secret key was accidentally included in an AI-generated commit that has been pushed. What is the most important step?

  1. Delete the commit message and push again
  2. Ask the AI to forget the key
  3. Make the repository private and assume the key is safe from now on
  4. Revoke and rotate the key, then remove it from the code

Answer: D. Revoke and rotate the key, then remove it from the code

Explanation

Once pushed, assume the secret is exposed; rotating it makes the leaked value useless. Cleaning history alone is not enough.

Step-by-step solution

  1. A pushed secret may already be copied.
  2. Making it private or deleting history is not enough.
  3. Revoke and rotate the key first.

Why the other options are wrong

  • A. The key remains in history.
  • B. A model cannot forget a key already in the repo.
  • C. The key may already have been seen.

Tip: Leaked means compromised.

Practise all 25 questions free

The full question bank with timed practice, progress tracking and Vidya, your AI tutor. Free, no ads.

Open this topic in the app →

Related topics

See all AI Tools for Developers topics · All topics