WGU D385 OA EXAM LATEST UPDATE THIS YEAR
COMPLETE 250 QUESTIONS AND CORRECT ANSWERS
JUST RELEASED
WGU D385 Software Security and Testing exam
QUESTION: Which Python function is prone to a potential code injection attack?
A. eval()
B. type()
C. print()
D. append() - ANSWER-Code Injection Attacks: A code injection attack is a type of security
vulnerability where an attacker can insert and execute malicious code into a program or
application. This can happen when user-supplied data is not properly validated or sanitized
before being executed by the program. If an attacker can manipulate data that gets executed as
code, they can potentially take control of the application, access sensitive information, or
perform unauthorized actions.
Now, let's examine the answer options:
A. eval()
This option is correct. The eval() function in Python is prone to code injection attacks because it
takes a string as input and interprets it as Python code. In other words, it allows dynamic
execution of arbitrary Python expressions. If untrusted data from a user or an external source is
2
,Page 3 of 120
passed to eval() without proper validation, an attacker can inject malicious Python code that
gets executed, leading to serious security risks. (CORRECT)
B. type()
The type() function in Python is not directly related to code injection attacks. It is used to
determine the type of an object, such as whether it's a list, dictionary, integer, etc.
C. print()
The print() function in Python is not prone to code injection attacks. It is used to display output
on the console or in files and does not execute arbitrary code.
D. append()
The append() function is a list method in Python used to add elements to the end of a list. It is
not related to code injection vulnerabilities as it deals with manipulating list data.
QUESTION: What are two common defensive coding techniques?
A. Check functional preconditions and postconditions
B. Encrypt passwords and email submissions
C. Adjust length and encoding of messages
D. Develop code with exceptions to find errors - ANSWER-A. Check functional preconditions and
postconditions
3
, Page 4 of 120
Functional preconditions and postconditions are common defensive coding techniques used to
ensure the correctness and robustness of software. Here's an explanation of these terms:
Preconditions: Functional preconditions are checks that are performed at the beginning of a
function or method to verify that the input data or the environment's state is valid and meets
the expected criteria. By checking preconditions, developers can ensure that the function can
safely proceed with its execution and prevent potential issues or errors that might arise due to
invalid data.
Postconditions: Functional postconditions are checks performed at the end of a function or
method to ensure that the expected outcomes or results have been achieved. Postconditions
help validate that the function has executed correctly and produced the intended results. They
also aid in identifying any unexpected behaviors or issues that might have occurred during the
execution.
By implementing these checks in the code, developers can significantly reduce the likelihood of
errors, crashes, and security vulnerabilities. By catching potential issues early on and providing
meaningful feedback to users or other parts of the system, functional preconditions and
postconditions contribute to the overall stability and reliability of the software. (CORRECT)
QUESTION: Which package is meant for internal use by Python for regression testing?
A. test
B. regress test
C. doctest
D. assert - ANSWER-A. test
4
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller STUVIAGRADES. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $24.99. You're not tied to anything after your purchase.