

















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


















Question 1: What is the primary purpose of Task 1 in WGU D385? A. To implement secure API authentication with OAuth B. To add logging, error handling, assertions, and passing unit tests to the equipment rental app C. To remediate SQL injection vulnerabilities D. To design a database schema Correct Answer: B. To add logging, error handling, assertions, and passing unit tests to the equipment rental app Rationale: Task 1 requires adding logging, error handling, assertions, and passing unit tests to the equipment rental app. This is distinct from Task 2, which focuses on secure coding and secure API implementation. Source: WGU D385 Comprehensive Questions and Answers Set A Question 2: What does "shift-left" security mean in the context of D385?
A. Moving security testing to the end of the development cycle B. Building security in during development (static analysis, unit tests, code review) instead of bolting it on after release C. Shifting all security responsibilities to the operations team D. Eliminating all security testing to speed up deployment Correct Answer: B. Building security in during development (static analysis, unit tests, code review) instead of bolting it on after release Rationale: Secure SDLC / shift-left involves building security in during development (static analysis, unit tests, code review) instead of bolting it on after release - this is the premise of both D385 tasks. Source: WGU D385 Comprehensive Questions and Answers Set A Question 3: What log file name is required for Task 1? A. app.log B. Troubleshooting_009963434.log C. security_events.log D. debug_output.log Correct Answer: B. Troubleshooting_009963434.log Rationale: The required log file name for Task 1 is Troubleshooting_009963434.log, with format %(asctime)s - %(levelname)s - %(message)s, INFO level, and one logging.basicConfig at module top. Source: WGU D385 Comprehensive Questions and Answers Set A Question 4: What are the three course competencies for D385? A. Encryption, authentication, and authorization B. Evaluates application and network logs; configures security authentication for REST APIs; and implements secure coding practices C. Static analysis, dynamic analysis, and penetration testing D. Logging, testing, and remediation
Source: WGU D385 Full Course Bank Question 7: What is a key advantage of static code analysis? A. It finds runtime vulnerabilities B. It provides fast turnaround time, especially when tools are used C. It eliminates all false positives D. It requires a running system Correct Answer: B. It provides fast turnaround time, especially when tools are used Rationale: A key advantage of static code analysis is fast turnaround time, especially when tools are used. Static analysis can scan entire codebases in seconds or minutes, making it suitable for continuous integration pipelines. Source: WGU D385 V2 Software Security and Testing Master Study Guide Question 8: What is a limitation of static code analysis? A. It cannot find any security issues B. It does not account for runtime vulnerabilities C. It requires a running system D. It always produces false positives Correct Answer: B. It does not account for runtime vulnerabilities Rationale: A limitation of static code analysis is that it does not account for runtime vulnerabilities, which only manifest during execution. Static analysis cannot detect issues that depend on specific runtime conditions, configurations, or data flows. Source: WGU D385 V2 Software Security and Testing Master Study Guide
Question 9: What does the report claim about zero selected findings from static analysis? A. It proves the application has no vulnerabilities B. It does not claim that zero selected findings equals zero vulnerabilities C. It guarantees the application is secure D. It means static analysis is ineffective Correct Answer: B. It does not claim that zero selected findings equals zero vulnerabilities Rationale: The report does not claim that zero selected findings equals zero vulnerabilities. Tool coverage, configuration, false negatives, data-flow limitations, dependency risks, and runtime conditions remain relevant. Source: WGU D385 Task 1 Performance Assessment Question 10: What is the purpose of the Security Defect Log in Task 1? A. To document the vulnerabilities found in the starter API and the fixes applied B. To provide a user manual for the API C. To list all the features of the API D. To describe the API's architecture Correct Answer: A. To document the vulnerabilities found in the starter API and the fixes applied Rationale: The Security Mitigation Report documents the vulnerabilities identified in the starter API, the severity of each (using CVSS), and the remediation steps taken. It demonstrates the student's ability to identify and fix security issues. Source: WGU D385 V2 Software Security and Testing Master Study Guide
Question 13: Which logging level should be used to record a runtime error that was successfully handled? A. DEBUG B. INFO C. WARNING D. ERROR Correct Answer: D. ERROR Rationale: The ERROR level should be used to log runtime errors that were caught and handled. Task 1 requires B2 try/except handling of 2 runtime errors, with 1 ERROR log entry and 1 WARNING log entry. Source: WGU D385 Comprehensive Questions and Answers Set A Question 14: What logging level should be used for anticipated failures that were successfully recovered from? A. DEBUG B. INFO C. WARNING D. CRITICAL Correct Answer: C. WARNING Rationale: The WARNING level should be used for anticipated failures that were successfully recovered from. WARNING indicates a potential issue that was handled, while ERROR indicates a more serious failure. Source: WGU D385 Full Course Bank Question 15: In Task 1, why does equipment validation log ERROR but days validation log WARNING? A. Equipment is more important than days B. Equipment is a fixed dropdown so an unknown value implies a crafted request (ERROR); days is free text so typos are expected user error (WARNING)
C. Days is always valid D. Equipment is never validated Correct Answer: B. Equipment is a fixed dropdown so an unknown value implies a crafted request (ERROR); days is free text so typos are expected user error (WARNING) Rationale: Severity maps to suspicion: equipment is a fixed dropdown so an unknown value implies a crafted request (ERROR); days is free text so typos are expected user error (WARNING). This thoughtful severity assignment improves security monitoring. Source: WGU D385 Full Course Bank Question 16: What logging level should be used for normal operations and successful validations? A. DEBUG B. INFO C. WARNING D. ERROR Correct Answer: B. INFO Rationale: The INFO level should be used for normal operations and successful validations. Task 1 requires B3 two assertions, each proven by an INFO entry. Source: WGU D385 Comprehensive Questions and Answers Set A Question 17: What is the correct format string for Task 1 logging? A. [LEVEL] - [MESSAGE] B. %(asctime)s - %(levelname)s - %(message)s C. [TIMESTAMP] [LEVEL] [MESSAGE] D. EVENT: [event] | ACTION: [action] Correct Answer: B. %(asctime)s - %(levelname)s - %(message)s
Question 20: Which Python logging module levels are correctly ordered from lowest to highest severity? A. INFO, DEBUG, WARNING, ERROR, CRITICAL B. DEBUG, INFO, WARNING, ERROR, CRITICAL C. WARNING, DEBUG, ERROR, INFO, CRITICAL D. CRITICAL, ERROR, WARNING, INFO, DEBUG Correct Answer: B. DEBUG, INFO, WARNING, ERROR, CRITICAL Rationale: Python logging levels are: DEBUG 10, INFO 20, WARNING 30, ERROR 40, CRITICAL 50. Understanding this ordering is essential for configuring appropriate log verbosity. Source: WGU D385 Full Course Bank
Question 21: What are the two handled runtime errors in Task 1? A. KeyError (unknown equipment_type) logged ERROR; ValueError/TypeError (bad or missing days) logged WARNING B. TypeError (unknown equipment_type) logged ERROR; KeyError (bad days) logged WARNING C. ValueError (unknown equipment_type) logged ERROR; KeyError (bad days) logged WARNING D. SQL injection and XSS Correct Answer: A. KeyError (unknown equipment_type) logged ERROR; ValueError/TypeError (bad or missing days) logged WARNING
Rationale: The two handled runtime errors in Task 1 are: KeyError (unknown equipment_type) logged ERROR; ValueError/TypeError (bad or missing days) logged WARNING - both in the /rent try/except. Source: WGU D385 Comprehensive Questions and Answers Set A Question 22: What does int(None) raise and when? A. ValueError, when the input is negative B. TypeError, when the days field is missing from the POST entirely C. KeyError, when the equipment is unknown D. AssertionError, when validation fails Correct Answer: B. TypeError, when the days field is missing from the POST entirely Rationale: int(None) raises TypeError when the days field is missing from the POST entirely - that's why the WARNING handler catches (ValueError, TypeError), not ValueError alone. Source: WGU D385 Full Course Bank Question 23: Why does days raise ValueError when zero or negative inside the try? A. It causes a syntax error B. It funnels the business rule into the same handled WARNING path instead of a separate return branch C. It causes a TypeError D. It bypasses validation Correct Answer: B. It funnels the business rule into the same handled WARNING path instead of a separate return branch Rationale: Days raises ValueError when zero or negative inside the try to funnel the business rule into the same handled WARNING path the report describes instead of a separate return branch. Source: WGU D385 Full Course Bank
Question 26: What information should NOT be included in user-facing error messages? A. A generic error description B. Stack traces and internal implementation details C. A request ID for tracking D. Instructions for contacting support Correct Answer: B. Stack traces and internal implementation details Rationale: User-facing error messages should not include stack traces, internal paths, package names, source lines, data shapes, or internal control flow. These details could disclose architecture information to attackers. Source: WGU D385 Task 1 Performance Assessment Question 27: What is the security implication of logging stack traces in production? A. It improves debugging efficiency B. It discloses architecture and implementation details to potential attackers C. It increases log file size D. It slows down application performance Correct Answer: B. It discloses architecture and implementation details to potential attackers Rationale: Logging stack traces in production can disclose paths, package names, source lines, data shapes, and internal control flow. This information helps attackers understand the system architecture and identify potential attack vectors. Source: WGU D385 Task 1 Performance Assessment Question 28: What exception types should be caught in secure exception handling? A. Only SystemExit and KeyboardInterrupt B. All exceptions using bare except
C. Specific anticipated exceptions such as KeyError, TypeError, ValueError D. Only custom exceptions Correct Answer: C. Specific anticipated exceptions such as KeyError, TypeError, ValueError Rationale: Secure exception handling catches specific anticipated exceptions such as KeyError, TypeError, ValueError, and AssertionError. This allows the application to handle expected failures gracefully while allowing unexpected errors to propagate for investigation. Source: WGU D385 Comprehensive Questions and Answers Set A Question 29: What is the security rationale for using narrow exception paths? A. They improve performance B. They prevent raw tracebacks from becoming an architecture-discovery channel C. They reduce code complexity D. They eliminate all errors Correct Answer: B. They prevent raw tracebacks from becoming an architecture-discovery channel Rationale: Targeted exception handling prevents raw tracebacks from becoming an architecture-discovery channel. A traceback may disclose paths, package names, source lines, data shapes, and internal control flow. Source: WGU D385 Task 1 Performance Assessment Question 30: What logging level should be used for anticipated failures that were successfully recovered from? A. DEBUG B. INFO C. WARNING D. CRITICAL
Correct Answer: B. They are removed from the compiled bytecode Rationale: When Python runs with the -O (optimize) flag, assert statements are removed from the compiled bytecode. Assertions are stripped at optimize level 1, so they are documentation of developer assumptions, never production input validation. Source: WGU D385 Full Course Bank Question 33: What assertions are used in the Task 1 sample code? A. assert username is not None and assert total > 0 B. assert password == "secret" C. assert request.method == "GET" D. No assertions are used Correct Answer: A. assert username is not None and assert total > 0 Rationale: The sample code uses two assertions: assert username is not None, "username must be supplied by the caller" and total = daily_rate * rental_days; assert total > 0, "validated rental totals must be positive". Source: WGU D385 Task 1 Performance Assessment Question 34: What is the correct syntax for an assertion with a custom error message? A. assert condition B. assert condition, "error message" C. assert(condition, "error message") D. assert condition; "error message" Correct Answer: B. assert condition, "error message" Rationale: The correct syntax for an assertion with a custom error message is assert condition, "error message". The sample code uses this syntax: assert username is not None, "username must be supplied by the caller". Source: WGU D385 Task 1 Performance Assessment
Question 35: Why are assertions NOT used as the sole protection against hostile input? A. They are too slow for production use B. Python can remove assert statements when executed with optimization C. They only work with string data D. They cannot be logged Correct Answer: B. Python can remove assert statements when executed with optimization Rationale: Assertions are not used as the sole protection against hostile input because Python can remove assert statements when executed with optimization. Boundary validation remains mandatory because Python can remove assert statements. Source: WGU D385 Full Course Bank Question 36: What is the relationship between assertions and input validation? A. Assertions replace input validation B. Input validation replaces assertions C. Assertions document conditions after validation establishes preconditions D. They are unrelated concepts Correct Answer: C. Assertions document conditions after validation establishes preconditions Rationale: The relationship is that assertions document conditions the developer expects to be true after external data has been validated. The design uses normal conditional checks for security decisions and assertions only after validation establishes the relevant preconditions. Source: WGU D385 Task 1 Performance Assessment