Testing Task 2 Preparation Guide
Vulnerability Remediation, Unit
Testing & Test Evidence 2026 | Verified
WGU D385 Software Security and Testing Task | Comprehensive
Examination
WGU D385 Software Security and Testing Task 2 Preparation
Guide Vulnerability Remediation, Unit Testing & Test
Evidence 2026 actual exam preparation document with
INTRODUCTION
This document is an important and very helpful preparation
resource for WGU D385 Software Security and Testing Task 2
Preparation Guide Vulnerability Remediation, Unit Testing &
Test Evidence 2026. Every item uses a focused exam stem, four
response options, a keyed response, and a clear rationale,
making it easier to understand the subject, spot distractors, and
build real exam confidence.
Page 1
, Question 1
A security engineer discovers a SQL injection vulnerability in a legacy Java
application. Which remediation strategy best aligns with defense-in-depth
while minimizing performance overhead?
A. Escaping all user input with a custom blacklist filter
B. Using parameterized queries with a Web Application Firewall (WAF)
as a secondary control
C. Storing all database credentials in a configuration file with restricted
permissions
D. Implementing input length validation and server-side sanitization
Correct Answer: B - Using parameterized queries with a Web
Application Firewall (WAF) as a secondary control
RATIONALE
Parameterized queries eliminate the root cause by separating code
from data, and a WAF adds a layer of defense without significant
performance cost. Blacklist filtering is easily bypassed, credential
storage does not prevent injection, and input validation alone is
insufficient.
Question 2
In unit testing, which mocking approach is most appropriate when testing a
service that depends on a slow external API, and why?
A. Use a spy to record calls and verify them later, because it preserves
real API behavior.
B. Use a stub to return canned responses, because it isolates the unit and
speeds up tests.
C. Use a mock to assert interactions, because it ensures the API is called
correctly.
D. Use a fake with in-memory implementation, because it simulates the
API without network overhead.
Page 2
,Correct Answer: D - Use a fake with in-memory implementation,
because it simulates the API without network overhead.
RATIONALE
A fake provides a lightweight, in-memory implementation that mimics
the API's behavior, offering both speed and realistic interaction
without network calls. Stubs and mocks are more limited in scope, and
spies still execute real code, which is slow.
Question 3
Which of the following best describes the purpose of a Software Bill of
Materials (SBOM) in vulnerability remediation?
A. To list all open-source components and their versions for rapid
identification of vulnerable dependencies
B. To document the test cases executed during unit testing
C. To provide a summary of code coverage metrics
D. To serve as a legal contract between software vendors and clients
Correct Answer: A - To list all open-source components and their
versions for rapid identification of vulnerable dependencies
RATIONALE
An SBOM enumerates all components and dependencies, enabling
quick detection of known vulnerabilities (e.g., via CVEs). It does not
document tests, coverage, or contracts, though it supports compliance.
Question 4
A developer writes a unit test that passes even when the production code is
broken. Which test smell is most likely present?
A. Assertion-free test
B. Eager test
C. Test with excessive mocking
D. Test that depends on external state
Page 3
, Correct Answer: A - Assertion-free test
RATIONALE
An assertion-free test lacks verification, so it passes regardless of code
correctness. Eager tests perform too much, excessive mocking can
hide issues but not necessarily cause false passes, and external state
dependence may cause flakiness but not guaranteed false positives.
Question 5
When using static application security testing (SAST), which finding is most
likely to be a false positive?
A. Hardcoded password in source code
B. Use of a cryptographically weak random number generator
C. Potential SQL injection in a string concatenation
D. Unvalidated redirect in a web application
Correct Answer: C - Potential SQL injection in a string
concatenation
RATIONALE
SAST tools often flag string concatenation as potential SQL injection
even when the input is later sanitized or parameterized, leading to
false positives. Hardcoded passwords and weak RNG are typically
true positives, while unvalidated redirects are usually detected
accurately.
Question 6
In test-driven development (TDD), what is the primary purpose of the 'red'
phase?
A. To write a failing test that defines the desired behavior
B. To refactor code to improve design
C. To run all tests and ensure they pass
D. To write the minimal code to pass the test
Page 4