Security Testing Questions with Answers

6 practice questions on Security Testing (Software Testing & QA) with answers and step-by-step solutions. Try 6 samples below, then practise all 6 free in the AptiNest app.

Sample questions

Question 1Easy

Why should passwords be stored hashed with a salt?

  1. So users can read their passwords back
  2. To make logins faster for everyone
  3. So leaked databases do not expose the passwords
  4. To compress the database storage

Answer: C. So leaked databases do not expose the passwords

Explanation

A salted hash cannot be reversed easily and defeats precomputed tables.

Step-by-step solution

  1. Hash hides password.
  2. Salt makes each unique.
  3. Safe storage.

Why the other options are wrong

  • A. Hashes are one way.
  • B. Hashing is intentionally slower.
  • D. Compression is unrelated.

Question 2Easy

Which attack inserts malicious SQL through an input field?

  1. Phishing
  2. SQL injection
  3. Denial of service
  4. Port scan

Answer: B. SQL injection

Explanation

SQL injection places SQL fragments in input so the database executes unintended commands.

Step-by-step solution

  1. Input reaches SQL.
  2. Attacker adds SQL.
  3. Injection.

Why the other options are wrong

  • A. Phishing tricks users.
  • C. DoS floods resources.
  • D. Port scan finds open ports.

Question 3Medium

Cross-site scripting (XSS) lets an attacker:

  1. Read the disk of the server directly
  2. Crash the database engine remotely
  3. Guess stored passwords offline
  4. Run a malicious script in a victim's browser

Answer: D. Run a malicious script in a victim's browser

Explanation

XSS injects script that the victim's browser executes in the site's context.

Step-by-step solution

  1. Script injected.
  2. Runs in victim browser.
  3. XSS.

Why the other options are wrong

  • A. That needs server compromise.
  • B. That's a different attack.
  • C. That is cracking.

Question 4Medium

What is the purpose of penetration testing?

  1. Simulate an attack to find exploitable weaknesses
  2. Test the speed of the company network
  3. Check the spelling of the user interface
  4. Count the lines of code written

Answer: A. Simulate an attack to find exploitable weaknesses

Explanation

Authorised testers try to exploit the system to reveal real security gaps.

Step-by-step solution

  1. Authorised attack.
  2. Find weaknesses.
  3. Penetration test.

Why the other options are wrong

  • B. That's performance work.
  • C. Not related.
  • D. Not related.

Question 5Medium

Which measure best prevents SQL injection?

  1. Client-side validation of the input fields only
  2. Hiding the detailed error page
  3. Parameterised queries (prepared statements)
  4. Requiring longer passwords for users

Answer: C. Parameterised queries (prepared statements)

Explanation

Parameterised queries keep data separate from SQL commands.

Step-by-step solution

  1. Separate code and data.
  2. Use placeholders.
  3. Prepared statements.

Why the other options are wrong

  • A. Client checks can be bypassed.
  • B. Hiding errors does not fix injection.
  • D. Passwords are unrelated.

Question 6Medium

What does the principle of least privilege require?

  1. Give each user or process only the access it needs
  2. Give administrators access to everything by default
  3. Share one account among the whole team
  4. Disable logging for faster performance

Answer: A. Give each user or process only the access it needs

Explanation

Limiting rights reduces the damage if an account or process is compromised.

Step-by-step solution

  1. Minimum needed.
  2. Smaller blast radius.
  3. Least privilege.

Why the other options are wrong

  • B. Broad admin access violates the principle.
  • C. Shared accounts hide who did what.
  • D. Logging supports security.

Practise all 6 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 Software Testing & QA topics · All topics