• 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 25 pages
Exam (elaborations)

WGU D385 Pre-Assessment questions and correct answers graded A+ passed

Document preview thumbnail
Preview 3 out of 25 pages

WGU D385 Pre-Assessment questions and correct answers graded A+ passed

Content preview

WGU D385 Pre-Assessment questions and correct
answers graded A+ passed
1. What is the primary defense against log
Sanitize outbound log
injection at- tacks?
messages
2. import
logging.error("The
logging
excep- tion that
import sys
occured is: %s", str(e))
import
logging
import sys
#log division by zero error to the log, the
output is printed to the screen
def divideByZeroError(dividend,
divisor):
logging.basicConfig(stream=sys.stdou
t,for- mat='%(levelname)s:%
(message)s')

try:
quotient =
dividend/divisor print
(quotient)

except Exception as e:
#logging error here, use str(e) as part of
the output if name == ' main ':
dividend =
int(input()) divisor =
int(input())

divideByZeroError(dividend,divisor)



,WGU D385 Pre-Assessment questions and correct
answers graded A+ passed
3. An attacker exploits a cross-site scripting vulnerability. Access the
user's data

4. Which Python function is prone to a eval()
potential code injection attack?

5. What are two common defensive coding
techniques?






, WGU D385 Pre-Assessment questions and correct
answers graded A+ passed
Check functional and
pre- conditions and
postcondi- tions

6. # unit test if x is None:
case import print("x is a null value")
unittest return y
def multiply_numbers(x, elif y is None:
y): #add your code print("y is a null value")
here return x * y return x
# add your code here else:
return x * y

class
TestForNone(unittest.TestCase):

def test_when_a_is_null(self):
try:
self.assertIsNone(multiply_numbers(5,
None)) except AssertionError as msg:
print(msg)
if name == ' main ':
unittest.main()

7. Which package is meant for internal use by Python for test
regression testing?

8. from string import }
Template CONFIG = { c
"API_KEY": "'you've just exposed your l
secret_key'" a

Document information

Uploaded on
March 10, 2025
Number of pages
25
Written in
2024/2025
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.
BravelRadon
3.5
(164)
Sold
963
Followers
541
Items
53579
Last sold
1 day 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