• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 3 out of 21 pages
Exam (elaborations)

WGU D385 ZHN1 Task 1 – Software Security and Testing | Complete Static Code Analysis, Python Application Logging, Debugging, Exception Handling & Unit Testing | 2026/2027 Updated

Document preview thumbnail
Preview 3 out of 21 pages

WGU D385 ZHN1 Task 1 – Software Security and Testing | Complete Static Code Analysis, Python Application Logging, Debugging, Exception Handling & Unit Testing | 2026/2027 Updated

Content preview

WGU D385 ZHN1 Task 1 – Software Security and Testing |
Complete Static Code Analysis, Python Application Logging,
Debugging, Exception Handling & Unit Testing | 2026/2027
Updated 50 QUESTIONS
Actual Q&A – A+ Guarantee Format | WGU D385 Software Security and Testing Task 1




1. A developer runs Bandit on a Python Flask app and gets B105:
hardcoded_password_string. The flagged line is api_key = 'sk_live_12345'.
Which is the most secure remediation?
A) Move the secret to an environment variable or secret manager and load via
os.getenv
B) Add # nosec comment to suppress the Bandit warning
C) Rename the variable to my_api_key but keep the literal value
D) Base64 encode the key and decode at runtime

Answer: B
<b>Rationale:</b> Option A is correct because secrets must not be in source
code; environment variables or a secret manager like AWS Secrets Manager
keeps them out of version control and allows rotation. Option B is wrong
because # nosec only hides the finding and leaves the vulnerability. Option C
is wrong because renaming does not remove the hardcoded secret; Bandit
still detects the entropy. Option D is wrong because Base64 is encoding not
encryption and is trivially reversible, still considered hardcoded.

2. During static analysis, a Python file contains cursor.execute(f"SELECT *
FROM users WHERE id = {user_id}"). Which vulnerability does Bandit rule B608
detect and what is the correct fix?
A) SQL injection; use parameterized query cursor.execute("SELECT * FROM
users WHERE id = %s", (user_id,))
B) Cross-site scripting; use html.escape()
C) Hardcoded password; move to .env
D) Insecure randomness; use secrets module

Answer: A

,<b>Rationale:</b> Option A is correct because f-string interpolation builds
SQL with untrusted input, enabling SQL injection; parameterized queries
separate code from data. Option B is wrong because XSS is for HTML
output, not SQL execution. Option C is wrong because this is not a secret
storage issue. Option D is wrong because randomness is unrelated to query
construction.

3. Your CI pipeline runs pylint and flake8. What is the key functional difference
between them for WGU D385 Task 1?
A) pylint performs deeper semantic analysis including type inference and design
issues; flake8 focuses on style and syntax via pycodestyle, pyflakes, and
mccabe complexity
B) Both tools only check for security vulnerabilities
C) flake8 executes unit tests
D) pylint is only a code formatter like black

Answer: A
<b>Rationale:</b> Option A is correct because pylint analyzes AST for
logical errors, undefined variables, and refactoring suggestions, while flake8
is a wrapper for style and simple logic errors. Option B is wrong because
neither is primarily a security scanner; Bandit is for security. Option C is
wrong because flake8 does not run pytest or unittest. Option D is wrong
because pylint is a linter not a formatter; black is the formatter.

4. Bandit reports B301: pickle deserialization. Code: data =
pickle.loads(user_uploaded_file). Why is this high severity?
A) pickle can execute arbitrary code during deserialization, allowing remote
code execution if loading untrusted data
B) pickle is slow and causes performance issues
C) pickle only works with integers
D) pickle requires internet connection

Answer: A
<b>Rationale:</b> Option A is correct because Python's pickle protocol can
call __reduce__ and execute arbitrary Python, so untrusted pickle is RCE.
Option B is wrong because performance is not a security severity. Option C is
wrong because pickle handles many types. Option D is wrong because pickle

, is offline serialization.

5. In static code analysis, what does SAST stand for and when is it run in the
SDLC for D385?
A) Static Application Security Testing; run on source code before execution,
early in CI pipeline
B) System Active Service Test; run after deployment in production
C) Software Acceptance Stress Test; run only during user acceptance
D) Secure API Standard Testing; run only on APIs

Answer: A
<b>Rationale:</b> Option A is correct because SAST analyzes source
without running it, ideal early to shift left. Option B is wrong because it invents
a term and timing is too late. Option C is wrong because acceptance testing
is functional not SAST. Option D is wrong because SAST covers whole
codebase not only APIs.

6. A Bandit scan shows B110: try_except_pass. The code has except: pass. Why
is this flagged as a security and maintainability issue?
A) Silently swallowing all exceptions hides failures including security-relevant
errors and makes debugging impossible
B) try/except blocks are banned entirely in Python
C) pass is a reserved keyword that crashes Python
D) It causes memory leak only

Answer: A
<b>Rationale:</b> Option A is correct because bare except: pass catches
SystemExit, KeyboardInterrupt and security exceptions like authentication
failures without logging, violating secure logging and error handling. Option B
is wrong because try/except is allowed when specific. Option C is wrong
because pass is valid syntax. Option D is wrong because memory leak is not
the primary concern.

7. Which Python construct would Bandit flag as B324: use of insecure hash MD5
for security purposes in password hashing?
A) hashlib.md5(password.encode()).hexdigest() used to store user passwords
B) hashlib.sha256() used for file integrity check with salt

Document information

Uploaded on
November 2, 2026
Number of pages
21
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$18.49

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
GradeAchiver
3.5
(11)
Sold
68
Followers
3
Items
7841
Last sold
2 days ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions