Sample questions
Question 1Easy
'Shift left' in DevSecOps means:
- Giving developers fewer permissions
- Fixing security only after release
- Doing security checks earlier in development
- Moving servers to the data centre on the left side of the network diagram for isolation
Answer: C. Doing security checks earlier in development
Explanation
Finding issues during coding and CI is far cheaper than after deployment.
Step-by-step solution
- Shift left means moving a task earlier in the development timeline.
- For security, that means running checks during coding and CI.
- Option C matches this, so it is correct.
Why the other options are wrong
- A. Fewer permissions is least privilege, not shift left.
- B. Fixing security only after release is the opposite of shift left.
- D. Data centre placement is unrelated.
Tip: Shift left = find security problems earlier, when they are cheaper to fix.
Question 2Easy
Why scan container images in CI?
- To make images smaller by removing packages that the scanner considers unnecessary
- To compress layers
- To find vulnerable OS packages and libraries before deploying
- To speed up the build
Answer: C. To find vulnerable OS packages and libraries before deploying
Explanation
Image scanners match installed packages against vulnerability databases.
Step-by-step solution
- Scanners check for known security issues in software.
- Vulnerable OS packages are a common source of attacks.
- Finding these before deployment prevents security risks.
Why the other options are wrong
- A. Scanners do not shrink images by removing packages; that is a separate job done by choosing minimal bases.
- B. Scanning does not compress layers; compression is a build or registry matter, not a security check.
- D. Scanning is a security step and does not speed up the build; it adds time rather than saving it.
Tip: Always scan images for vulnerabilities before deploying.
Question 3Easy
Which practice reduces a container's attack surface?
- Using minimal base images and running as non-root
- Exposing every port
- Running with
--privileged - Installing debugging tools in production images so problems can be fixed quickly
Answer: A. Using minimal base images and running as non-root
Explanation
Fewer packages and fewer privileges leave attackers less to work with.
Step-by-step solution
- Minimal base images reduce unnecessary software, lowering risks.
- Running as non-root limits user permissions, preventing escalation.
- Fewer packages mean fewer vulnerabilities for attackers to exploit.
- Non-root access stops malicious code from modifying system files.
- This reduces the number of entry points for attacks.
Why the other options are wrong
- B. Exposing every port widens the attack surface rather than reducing it.
- C. Running with
--privileged gives the container near-host access, which increases the attack surface. - D. Debugging tools in production give an attacker extra tools to use, so they enlarge the attack surface.
Tip: Use minimal images and non-root users to shrink attack surface.
Question 4Medium
Why add a secrets scanner (e.g. as a pre-commit hook or CI step)?
- To generate new passwords
- To block commits that contain credentials
- To scan container images for malware before they are pushed to the registry
- To store secrets
Answer: B. To block commits that contain credentials
Explanation
Catching keys before they reach a shared repo avoids costly rotations and leaks.
Step-by-step solution
- Secrets scanners check code for credentials before commits.
- They stop bad code from being added to the repo.
- This stops secrets from leaking into shared repositories.
- Blocking commits with credentials prevents security risks.
- Final answer: To block commits that contain credentials.
Why the other options are wrong
- A. Generating passwords is not what a secrets scanner does; it looks for credentials in code.
- C. Scanning images for malware is a container scanning job, not a secrets scanner's job.
- D. A secrets scanner finds secrets; it does not store them, and storing secrets needs a vault.
Tip: Use a secrets scanner to catch credentials early and avoid leaks.
Question 5Medium
- SAST analyses source code; DAST tests a running application
- They are names for the same scanner
- Both only scan containers
- SAST tests a running application from outside; DAST reads and analyses the source code
Answer: A. SAST analyses source code; DAST tests a running application
Explanation
Static analysis finds code patterns early; dynamic testing probes the live app from outside.
Step-by-step solution
- SAST stands for static application security testing.
- It analyses source code without running the application.
- DAST tests a running application from outside. Option A is correct.
Why the other options are wrong
- B. SAST and DAST are different kinds of scanner.
- C. Neither is limited to scanning containers.
- D. The two descriptions are swapped.
Tip: Static = source code, no running app; Dynamic = running app, from outside.
Question 6Medium
A developer accidentally commits an API key to Git and then deletes it in the next commit. What is the right response?
- Rename the file
- Revoke and rotate the key, since it remains in history
- Nothing; deleting it is enough
- Make the repository private and keep using the key, since only the team can now see it
Answer: B. Revoke and rotate the key, since it remains in history
Explanation
Git history keeps the old commit; treat the secret as compromised and rotate it.
Step-by-step solution
- The API key is in Git history even after deletion.
- Secrets in history are exposed, so revoke the key.
- Create a new key to replace the compromised one.
- Update all references to use the new key immediately.
- Remove the old key from any active systems or code.
Why the other options are wrong
- A. Renaming the file does not remove the key from history; the secret is still in the old commit.
- C. Deleting it in a later commit leaves it in history, so doing nothing leaves the key exposed.
- D. Making the repo private does not help: the key is still valid, still in history, and must be rotated.
Tip: Revoke and rotate keys immediately after any leak, even if deleted.
Question 7Medium
- A list of all components and versions in a piece of software
- A secret-management tool
- A type of firewall
- A secure backup of the main branch, kept offline in case the Git server is compromised
Answer: A. A list of all components and versions in a piece of software
Explanation
A Software Bill of Materials lets you quickly find whether you ship an affected component.
Step-by-step solution
- SBOM stands for Software Bill of Materials.
- It lists all components and their versions in software.
- This helps identify vulnerable parts quickly.
- 0 matches the definition of SBOM.
- Final answer: A (A list of all components and versions in a piece of software).
Why the other options are wrong
- B. An SBOM is an inventory of components, not a secret-management tool.
- C. A firewall filters network traffic; an SBOM is a list of software components and versions.
- D. A backup of the main branch is a backup, not a bill of materials for software components.
Tip: Remember SBOM stands for Software Bill of Materials.
Question 8Medium
Dependency pinning with lockfiles helps security because:
- Lockfiles remove vulnerabilities
- Pinned packages cannot be malicious, because the registry verifies every pinned version
- Builds use reviewed versions, not whatever is newest
- Lockfiles encrypt dependencies
Answer: C. Builds use reviewed versions, not whatever is newest
Explanation
Unexpected upgrades, including compromised releases, cannot slip in silently.
Step-by-step solution
- Lockfiles ensure exact package versions are used.
- This prevents unexpected updates during builds.
- Pinned packages are not automatically upgraded to newer versions.
- Newer versions may include security vulnerabilities.
- Using reviewed versions improves build reliability and security.
Why the other options are wrong
- A. Lockfiles do not remove vulnerabilities; they only fix which versions are installed.
- B. The registry does not verify pinned packages as safe; a pinned version can still be malicious.
- D. Lockfiles do not encrypt dependencies; they only record exact versions, which is not encryption.
Tip: Use lockfiles to prevent silent, unsafe updates.
Question 9Hard
Why sign container images and verify signatures at deploy time?
- Unsigned images cannot be scanned for vulnerabilities, so signing is needed before scanning
- Signatures speed up pulls
- Signing makes images smaller
- To ensure only images from your trusted pipeline run
Answer: D. To ensure only images from your trusted pipeline run
Explanation
Verification blocks tampered or unknown images, a defence against supply-chain attacks.
Step-by-step solution
- Signing ensures images come from trusted sources.
- Verification stops unauthorized or altered images running.
- This stops supply chain attacks during deployment.
- Only trusted pipeline images are allowed to run.
- Final answer: To ensure only images from your trusted pipeline run.
Why the other options are wrong
- A. Unsigned images can still be scanned; signing is about trust at deploy time, not a scanning step.
- B. Signature checks add a step to pulls rather than speeding them up.
- C. Signing does not change image size; the signature is metadata stored alongside the image.
Tip: Verify signatures at deploy time to block untrusted images.
Question 10Hard
A typosquatting attack in package ecosystems involves:
- Sending phishing emails that point out typos in a project's documentation and ask for credentials
- Publishing a malicious package with a name like a popular one
- Breaking the build with syntax errors
- Misspelling variable names
Answer: B. Publishing a malicious package with a name like a popular one
Explanation
A developer who mistypes 'reqeusts' may install malware; review new dependencies carefully.
Step-by-step solution
- Typosquatting uses similar names to popular packages.
- Attackers publish harmful code under these fake names.
- Users install the wrong package by mistake.
- Malware runs silently without user knowledge.
- This method exploits human error in typing.
- Final answer: B.
Why the other options are wrong
- A. Phishing emails about documentation typos are a different attack; typosquatting uses fake package names.
- C. Breaking the build with syntax errors is a bug, not a typosquatting attack on package names.
- D. Misspelled variable names are coding mistakes, not a supply chain attack on package registries.
Tip: Check package names carefully to avoid typosquatting.
Practise all 15 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 →