Docsity

WGU D385 Coding Lab 2026/2027 | Quick Fixes, Solutions & Common Coding Errors Explained, Exams of Computer Science

Toggle sidebar
bg1
WGU D385 CODING LAB 2026/2027 | QUICK FIXES & SOLUTIONS |
MOST COMMON CODING ERRORS EXPLAINED | PRACTICAL EXAMPLES
| HIGH-YIELD REVIEW GUIDE | CURRENTLY UPDATED
1.
John
is a network administrator for ACME
company.
He
is trying
to
explain
least privileges to a new technician. Which of the following is the basic
premise of least privilege?
Always assign responsibilities to the administrator who has the
minimum permissions required.
When assigning permissions, give users only the permissions they
need to do their work and no more.
Do not give management more permissions than users.
Regularly review user permissions and take away one that they
currently have to see
if they will complain or even
notice that it is
missing.
2.
If you
were to
implement a function
that checks the
quality of user input for a
temperature value, what criteria would you include to ensure its validity?
Check if the value is a boolean.
Check if the value is a list of temperatures.
Check if the value is a string containing letters.
Check if
the
value
is
a
number within
a
specified
range.
3.
Describe
what
happens
when
the
assertion
for
temperature
checks
fails.
The
assertion
automatically
corrects
the
temperature
value.
The program continues without any interruption.
The assertion prints a warning message without stopping the
program.
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download WGU D385 Coding Lab 2026/2027 | Quick Fixes, Solutions & Common Coding Errors Explained and more Exams Computer Science in PDF only on Docsity!

WGU D385 CODING LAB 2026/2027 | QUICK FIXES & SOLUTIONS |

MOST COMMON CODING ERRORS EXPLAINED | PRACTICAL EXAMPLES

| HIGH-YIELD REVIEW GUIDE | CURRENTLY UPDATED

  1. John is a network administrator for ACME company. He is trying to explain least privileges to a new technician. Which of the following is the basic premise of least privilege? Always assign responsibilities to the administrator who has the minimum permissions required. When assigning permissions, give users only the permissions they need to do their work and no more. Do not give management more permissions than users. Regularly review user permissions and take away one that they currently have to see if they will complain or even notice that it is missing.
  2. If you were to implement a function that checks the quality of user input for a temperature value, what criteria would you include to ensure its validity? Check if the value is a boolean. Check if the value is a list of temperatures. Check if the value is a string containing letters. Check if the value is a number within a specified range.
  3. Describe what happens when the assertion for temperature checks fails. The assertion automatically corrects the temperature value. The program continues without any interruption. The assertion prints a warning message without stopping the program.

The assertion raises an AssertionError, indicating the temperature is not below freezing.

  1. Describe the importance of logging errors such as division by zero in Python applications. Logging is only important for syntax errors, not runtime errors. Logging errors is unnecessary as they do not affect the program's execution. Logging errors only serves to slow down the application without any benefits. Logging errors like division by zero helps in debugging and maintaining code quality by providing insights into runtime issues.
  2. If a developer receives serialized data that does not pass validation checks, what is the recommended action to take? Automatically fix the data and proceed. Reject the data and raise an error. Ignore the validation and deserialize the data. Log the data and continue processing.
  3. Describe how plain text should be formatted before it is encrypted using AES CTR mode. The plain text should be compressed before encryption. The plain text should be converted to a hexadecimal format. The plain text should be left as a string without any changes. The plain text should be formatted into bytes and padded appropriately.
  1. Describe the importance of implementing data quality checks for strings and numeric values in Python programming. Data quality checks are optional and can be ignored if the code runs without errors. Data quality checks ensure that inputs are valid and meet expected formats, preventing errors and vulnerabilities. Data quality checks are used to improve the aesthetic of the code without affecting functionality. Data quality checks are only necessary for numeric values, as strings are always valid.
  2. A freezer unit for frozen food should maintain temperatures of or below. 24 0 32 10
  3. If you encounter a piece of code that uses the % operator for string formatting and includes a secret key, how would you refactor it to enhance security? Replace the secret key with a hardcoded value. Refactor the code to use f-strings or the format() method to safely include the secret key. Leave the code as is, since it works correctly. Use the % operator but add comments to indicate the risk.
  1. Describe q.how q.the q.least q.privilege q.principle q.can q.enhance q.security q.in q.a q.system. q. By q.limiting q.user q.permissions, q.the q.least q.privilege q.principle q.reduces q.the q.risk q.of q.unauthorized q.access q.and q.potential q.damage. q. q. By q. providing q. unrestricted q. access, q. it q. enhances q. system q. performance. q. q. By q.granting q. users q. full q.access, q. it q. encourages q. collaboration. q. q. By q.allowing q. users q.to q.access q.all q.files, q. it q. simplifies q. user q.management.
  2. Describe q.the q.consequences q.of q.failing q.to q.validate q.serialized q.data q.before q.deserialization. q. q. Failing q. to q.validate q. serialized q. data q. has q. no q. significant q. impact. q. q. Failing q. to q.validate q. serialized q. data q. improves q. system q. efficiency. q. Failing q.to q.validate q.serialized q.data q.only q.affects q.performance. q. Failing q.to q.validate q.serialized q.data q.can q.lead q.to q.security q.vulnerabilities q.and q.data q.corruption.
  3. Why q.is q.bcrypt q.preferred q.over q.MD5 q.for q.password q.hashing? q. MD5 q.is q.faster q.and q.requires q.less q.computational q.power. q. MD5 q.is q.more q.widely q.used q.in q.modern q.applications. q. Bcrypt q.is q.designed q.to q.be q.slow q.and q.includes q.a q.salt, q.making q.it q.more q.secure q.against q.brute-force q.attacks. q. Bcrypt q.is q.easier q.to q.implement q.than q.MD5.
  4. A q.Custom q.Object q.is q.used q.to q.gather q.feedback q.about q.Employees. q.This q.Object q.should q.be q.Private q.so q.Employees q.cannot q.see q.each q.other's q.Records. q.Only q.the q.CEOq.should q.seeq.allq.Records. q.How q.can q.this q.beq.done?

q. Encrypt q.the q. plain q. text q.without q.any q.formatting.

  1. Describe q.the q.concept q.of q.object-level q.authorization q.and q.its q.importance q.in q.securing q.data q.access. q. Object-level q.authorization q.allows q.any q.user q.to q.access q.data, q.promoting q.transparency. q. q. Object-level q.authorization q. is q. irrelevant q. in q. modern q. programming. q. Object-level q.authorization q.restricts q.data q.access q.to q.the q.owner, q.ensuring q.that q.sensitive q.information q.is q.protected. q. Object-level q.authorization q.is q.only q.necessary q.for q.public q.data.
  2. What q.method q.should q.be q.used q.to q.safely q.format q.strings q.in q.Python q.to q.avoid q.exposing q.sensitive q.information? q. Concatenate q.strings q.using q.the q.+ q.operator. q. Directly q.print q.the q.secret q.key q.without q.formatting. q. q. Use q.f-strings q.or q.the q.format() q. method q. instead q. of q. the q. % q. operator. q. Use q.the q.% q.operator q.for q.string q.formatting.
  3. Which q.of q.the q.following q.policies q.should q.be q.used q.when q.assigning q.permissions, q.giving q.users q.only q.the q.permissions q.they q.need q.to q.do q.their q.work q.and q.no q.more? q. Separation q.of q.duties q. Physical q.access q.control q. Acceptable q.use q. Least q.privilege
  4. Format q.string q.vulnerabilities q.arise q. primarily q.because:

q. Assumptions q.are q.made q.on q.the q.size q.of q.the q.output q.buffer

  1. What q.is q.the q.least q.privilege q.principle q.in q.the q.context q.of q.file q.permissions? q. Allowing q.users q.to q.modify q.file q.permissions q.freely. q. Granting q.all q.permissions q.to q.all q.users. q. Assigning q.only q.the q.permissions q.necessary q.for q.users q.to q.perform q.their q.tasks. q. Restricting q.access q.to q.files q.based q.on q.user q.roles.
  2. If q.you q.encounter q.a q.division q.by q.zero q.error q.in q.a q.Python q.application, q.how q.would q.you q.modifyq.theq.codeq.toq.handleq.thisq.situationq.gracefully? q. Change q.the q.division q.operation q.to q.multiplication q.to q.avoid q.the q.error. q. Use q.a q.conditional q.statement q.to q.check q.for q.zero q.before q.performing q.the q.division. q. Ignore q.the q.error q.and q.let q.the q.program q.crash. q. Implement q.a q.try-except q.block q.to q.catch q.the q.ZeroDivisionError q.and q.log q.an q.appropriate q.message.
  3. What q.is q.the q.recommended q.secure q.hashing q.algorithm q.for q.password q.storage? q. SHA- 1 q. SHA- 256 q. MD q. bcrypt
  4. What q.is q.the q.primary q.function q. used q.to q.encrypt q.plain q.text q.in q.AES q.CTR q.mode? q. DES q.encryption q.function q. AES q.encryption q. function

q. Blowfish q.encryption q.function q. RSA q.encryption q.function

  1. Describe q.why q.using q.the q.% q.operator q.for q.string q.formatting q.can q.lead q.to q.security q.vulnerabilities q.in q.Python. q. q. The q. % q.operator q.is q.the q.fastest q.method q.for q.string q.formatting. q. Using q.the q.% q.operator q.is q.recommended q.for q.all q.string q.operations. q. q. The q.% q. operator q.is q.the q.only q.way q.to q.format q.strings q.in q.Python. q. Using q.the q.% q.operator q.can q.expose q.sensitive q.information q.if q.the q.string q.is q. not q .properly q.sanitized, q.allowing q. for q.potential q.injection q. attacks.
  2. What q.is q.the q.primary q.method q.used q.to q.ensure q.that q.only q.the q.owner q.of q.an q.object q.can q.access q.itsq.dataq.in q.Python? q. Encrypt q.the q.data q.with q.AES q. Apply q.password q.hashing q. q. Implement q. object-level q. authorization q. Use q.public q.access q.modifiers
  3. Describe q.how q.you q.would q.implement q.a q.range q.validation q.check q.for q.a q.numeric q.input q.in q.Python. q. You q.can q.use q.a q.loop q.to q.continuously q.prompt q.for q.input q.until q.a q.valid q.number q.is q.entered. q. You q.can q.use q.a q.try-except q.block q.to q.catch q.errors q.when q.the q.input q.is q.not q.a q.number. q. You q.can q.use q.an q.if q.statement q.to q.check q.if q.the q.input q.is q.greater q.than q.or q.equal q.to q. 1 q.and q.less q.than q.or q.equal q.to q.10.