WGU D385 OA | Objective Assessment | Questions
and Answers | 2025 Update | 100% Correct.
Correct 39
100%
Incorrect 00
WGU D385 OA
39 Correct terms
Questions and answers
Term
def admin(filename, admin):
return admin
def user(filename, user):
return user
def grant_permission(name_list, filename):
# FIXME
os.chmod(filename, stat.S_IRWXU)
check_permission(filename)
,6/9/25, 12:42 AM D385 OA
path2 = os.access(filename, os.R_OK)
print("Access to read the file:", path2)
# Check if User has Write Access
path3 = os.access(filename, os.W_OK)
print("Access to write the file:", path3)
# Check if User has Execute Permission
path4 = os.access(filename, os.X_OK)
print("Check if path can be executed:", path4)
if os.access(filename, os.R_OK):
# open txt file as file
with open(filename) as file:
file.read()
else:
# in case can't access the file
print("Cannot access the file")
with open("output_file.txt", 'w') as f:
if os.access(filename, os.W_OK):
f.write("I have write privilege.\n")
if __name__ == '__main__':
filename = input()
name = input()
k = []
res
Give this one a go later!
if result:
os.chmod(filename,
encrypted_text = stat.S_IRWXU)
cipher.encrypt(plain_text) else:
os.chmod(filename, stat.S_IRUSR
| stat.S_IRGRP | stat.S_IROTH)
, 6/9/25, 12:42 AM D385 OA
else:
return x * y
Don't know?
2 of 39
Term
import time
class Limiter:
def __init__(self, rate, per):
self.rate = rate
self.per = per
self.bucket = rate
self.last_check = time.time()
def limit(self, callback_fn):
current = time.time()
time_passed = current - self.last_check
self.last_check = current
# Finish line 18 by writing an expression that determines the value of
the bucket
# Use the following variables in your expression: time_passed,
self.bucket, self.rate, and self.per
bucket = # Insert your expression here
if (bucket > self.rate):
self.bucket = self.rate
if (bucket < 1):
pass
else:
callback_fn()