Docsity

WGU D385 Coding Lab 2026/2027 | Python Security & Testing Practice | Quick Fixes, Exams of Software Engineering

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
pfd
pfe
pff

Partial preview of the text

Download WGU D385 Coding Lab 2026/2027 | Python Security & Testing Practice | Quick Fixes and more Exams Software Engineering 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 nmhow nmthe nmleast nmprivilege nmprinciple nmcan nmenhance nmsecurity nmin nma nmsystem. n m By nmlimiting nmuser nmpermissions, nmthe nmleast nmprivilege nmprinciple nmreduces nmthe nmrisk nmof nmunauthorized nmaccess nmand nmpotential nmdamage. n m n m By n m providing n m unrestricted n m access, n m it n m enhances n m system n m performance. n m n m By nmgranting n m users n m full nmaccess, n m it n m encourages n m collaboration. n m n m By nmallowing n m users nmto nmaccess nmall nmfiles, n m it n m simplifies n m user nmmanagement.
  2. Describe nmthe nmconsequences nmof nmfailing nmto nmvalidate nmserialized nmdata nmbefore nmdeserialization. n m n m Failing n m to nmvalidate n m serialized n m data n m has n m no n m significant n m impact. n m n m Failing n m to nmvalidate n m serialized n m data n m improves n m system n m efficiency. n m Failing nmto nmvalidate nmserialized nmdata nmonly nmaffects nmperformance. nm Failing nmto nmvalidate nmserialized nmdata nmcan nmlead nmto nmsecurity nmvulnerabilities nmand nmdata nmcorruption.
  3. Why nmis nmbcrypt nmpreferred nmover nmMD5 nmfor nmpassword nmhashing? n m MD5 nmis nmfaster nmand nmrequires nmless nmcomputational nmpower. n m MD5 nmis nmmore nmwidely nmused nmin nmmodern nmapplications. n m Bcrypt nmis nmdesigned nmto nmbe nmslow nmand nmincludes nma nmsalt, nmmaking nmit nmmore nmsecure nmagainst nmbrute-force nmattacks. n m Bcrypt nmis nmeasier nmto nmimplement nmthan nmMD5.
  4. A nmCustom nmObject nmis nmused nmto nmgather nmfeedback nmabout nmEmployees. nmThis nmObject nmshould nmbe nmPrivate nmso nmEmployees nmcannot nmsee nmeach

n m This nmis nmnot nmpossible, nmCustom nmObjects nmcannot nmhave nmSharing nmSettings n m configured n m OWD nmto nm'Public nmRestricted' nmand nmset nma nmSharing nmException nmfor nmthe nmCEO nmUser n m OWD nmto nm'Private', nmdisable nmHierarchynmAccess, nmSharing nmRule nmfor nmCEO nmRole n m OWD nmto nm'Private', nmdisable nmHierarchy nmAccess, nmSharing nmRule nmfor nmCEO nmUser

  1. A nmrange nmcheck nm n m determines nmwhether nma nmnumber nmis nmwithin nma nmspecified nmrange n m n m ensures nmthe n m users n m enter nmonly nmnumeric n m data nminto nma nmfield n m verifies nmthat nma nmrequired nmfield nmcontains nmdata n m n m ensures nmthat n m users n m enter nmonly nmalphabetic n m data n m into n m a nmfield
  2. How nmis nmthe nmvalidity nmof nmdata nmchecked? n m Check nmthat nmdata nmconforms nmto nmthe n m correct nmformat, nmtype nmand n m range n m Check nmthat nmdata nmis nmnot nmrecorded nmmore nmthan nmonce n m Check nmall nmdata nmthat nmshould nmhave nmbeen nmcollated nmis nmstored n m n m Check nmthat nmdata nmis n m stored n m in n m a n m standard n m way nmfor nmall nmdata nmelements
  3. If nmyou nmhave nma nmplain nmtext nmmessage nmthat nmis nmnot nmin nmbyte nmformat, nmwhat nmsteps nmwould nmyounmtakenmto nmpreparenmitnmfornmAESnmCTRnmmode nmencryption? n m Convert nmthe nmplain nmtext nmto nma nmlist nmof nmcharacters. n m Convert nmthe nmplain nmtext nmto n m bytes nmand nmapply nmpadding nmif nmnecessary.

n m Leave nmthe nmplain nmtext nmas nmis nmand nmdirectly nmencrypt nmit.

  1. Format nmstring nmvulnerabilities nmarise n m primarily nmbecause: n m Assumptions nmare nmmade nmon nmthe nmsize nmof nmthe nmoutput nmbuffer

n m More nmparameters nmare nmsupplied nmthan nmthe nmformat nmexpects. n m Invalid nmparameter nmvalues nmare nmspecified. n m User nminput nmis nmused nmas nmthe nmformat nmspecifier.

  1. If nmyou nmmodify nmthe nmassertion nmto nmcheck nmfor nmtemperatures nmbelow nmfreezing nmand nmincludenmanmcustom nmerrornmmessage,nmhownmwouldnmyou nmwritenmit? n m assert nmtemperature nm<= nm0, nm'Temperature nmis nmabove nmfreezing' n m assert nmtemperature nm> nm0, nm'Temperature nmmust nmbe nmbelow nmfreezing' n m assert nmtemperature nm== nm0, nm'Temperature nmmust nmbe nmbelow nmfreezing' n m n m assert n m temperature n m < n m 0, n m 'Temperature n m must n m be n m below n m freezing'
  2. What nmis nmthe nmprimary nmpurpose nmof nmvalidating nmincoming nmserialized nmdata nmbefore nmdeserialization? n m To nmimprove nmcode nmperformance. n m To nmensure nmdata nmintegrity nmand nmsecurity. n m To nmenhance nmuser nminterface. n m To nmsimplify nmthe nmcode nmstructure.
  3. If nmyou nmhave nma nmweb nmapplication nmwhere nmusers nmcan nmcreate nmand nmmanage nmtheir nmprofiles, nmhow nmwould nmyou nmimplement nmobject-level nmauthorization nmto nmprotect nmuser nmdata? n m By nmchecking nmthe nmuser's nmidentity nmagainst nmthe nmprofile nmowner nmbefore nmgranting nmaccess. n m By nmencrypting nmall nmprofile nmdata nmwithout nmchecking nmownership. n m By nmusing nma nmsingle nmaccess nmkey nmfor nmall nmusers.
  1. What nmis nmthe nmleast nmprivilege nmprinciple nmin nmthe nmcontext nmof nmfile nmpermissions? n m Allowing nmusers nmto nmmodify nmfile nmpermissions nmfreely. n m Granting nmall nmpermissions nmto nmall nmusers. n m Assigning nmonly nmthe nmpermissions nmnecessary nmfor nmusers nmto nmperform nmtheir nmtasks. n m Restricting nmaccess nmto nmfiles nmbased nmon nmuser nmroles.
  2. If nmyou nmencounter nma nmdivision nmby nmzero nmerror nmin nma nmPython nmapplication, nmhow nmwould nmyounmmodifynmthenmcodenmtonmhandlenmthisnmsituation nmgracefully? n m Change nmthe nmdivision nmoperation nmto nmmultiplication nmto nmavoid nmthe nmerror. n m Use nma nmconditional nmstatement nmto nmcheck nmfor nmzero nmbefore nmperforming nmthe nmdivision. n m Ignore nmthe nmerror nmand nmlet nmthe nmprogram nmcrash. nm Implement nma nmtry-except nmblock nmto nmcatch nmthe nmZeroDivisionError nmand nmlog nman nmappropriate nmmessage.
  3. What nmis nmthe nmrecommended nmsecure nmhashing nmalgorithm nmfor nmpassword nmstorage? n m SHA- 1 n m SHA- 256 n m MD n m bcrypt
  4. What nmis nmthe nm primary nmfunction n m used nmto nmencrypt nmplain nm text nmin nmAES nmCTR nmmode? n m DES nmencryption nmfunction

n m AES nmencryption n m function

n m You nmcan nmuse nma nmlist nmto nmstore nmvalid nmnumbers nmand nmcheck nmif nmthe nminput nmis nmin nmthat nmlist.

  1. What n m happens n m when n m your nmprogram n m attempts n m to n m divide n m by nm zero? n m n m Arithmetic n m exception n m thrown n m Garbage nmwill nmprint n m Nothing nmwill nmprint
  2. What nmis nma nmcorrect nmPython nmexpression nmfor nmchecking nmto nmsee nmif nma nmnumber nmstored nminnmanmvariablenmxnmis nmbetween nm 0 nmandnm5? n m x nm> nm 0 nmand nm< nm 5 nm n m x nm> nm 0 nmor nmx nm< nm 5 n m x nm> nm 0 nmand nmx nm< nm 5