WGU D385 |PA |PRE-ASSESMENT EXAM
Correct 39
Incorrect 00
1 of 39
Term
import logging
import sys
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.stdout,format='%(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)
Give this one a try later!
logging.error("The exception t = Template("Hello, my name is $n.")
that occured is: %s", str(e)) print(t.substitute(n=user.name))
return isinstance(wg_int, int)
bucket = self.bucket + (time_passed *
self.rate / self.per)
return wg_string is not None
Don't know?
2 of 39
Term
def authorizeAdmin(usr):
assert isinstance(usr, list) and usr != [], "No user found"
assert 'admin' in usr, "No admin found."
print("You are granted full access to the application.")
If __name__ == '__main__':
authorizeAdmin(['user'])
Give this one a try later!
ValueError: Empty user list TypeError: Invalid user type
, AssertionError: No admin
AssertionError: No user found
found
Don't know?
3 of 39
Term
Which method is used for a SQL injection attack?
Give this one a try later!
Exploiting query parameters Passing safe query parameters
Overloading server resources Manipulating session cookies
Don't know?
4 of 39
Term
404
Give this one a try later!
403 Ok
, Not Found Found 10
Don't know?
5 of 39
Term
import requests
url = 'https://api.github.com/invalid'
try:
request_response = requests.get(url)
# If the response was successful, no Exception will be raised
request_response.raise_for_status()
except Exception as err:
print(f'Other error occurred: {err}')
else:
print('Success!')
Give this one a try later!
200 - ok 401 - Not Authorized
500 - Server Error 404 - Not Found
Don't know?
6 of 39
Correct 39
Incorrect 00
1 of 39
Term
import logging
import sys
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.stdout,format='%(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)
Give this one a try later!
logging.error("The exception t = Template("Hello, my name is $n.")
that occured is: %s", str(e)) print(t.substitute(n=user.name))
return isinstance(wg_int, int)
bucket = self.bucket + (time_passed *
self.rate / self.per)
return wg_string is not None
Don't know?
2 of 39
Term
def authorizeAdmin(usr):
assert isinstance(usr, list) and usr != [], "No user found"
assert 'admin' in usr, "No admin found."
print("You are granted full access to the application.")
If __name__ == '__main__':
authorizeAdmin(['user'])
Give this one a try later!
ValueError: Empty user list TypeError: Invalid user type
, AssertionError: No admin
AssertionError: No user found
found
Don't know?
3 of 39
Term
Which method is used for a SQL injection attack?
Give this one a try later!
Exploiting query parameters Passing safe query parameters
Overloading server resources Manipulating session cookies
Don't know?
4 of 39
Term
404
Give this one a try later!
403 Ok
, Not Found Found 10
Don't know?
5 of 39
Term
import requests
url = 'https://api.github.com/invalid'
try:
request_response = requests.get(url)
# If the response was successful, no Exception will be raised
request_response.raise_for_status()
except Exception as err:
print(f'Other error occurred: {err}')
else:
print('Success!')
Give this one a try later!
200 - ok 401 - Not Authorized
500 - Server Error 404 - Not Found
Don't know?
6 of 39