Docsity

WGU_D522_V2_PYTHON_AUTOMATION_MASTERY_PERFORMANCE_ASSESSMENT_STUDY_BUNDLE, Exams of Computer Programming

Toggle sidebar
bg1
D522 V2 Original Practice Study Bundle Page 1
WGU D522 V2 PYTHON AUTOMATION MASTERY
PERFORMANCE ASSESSMENT STUDY BUNDLE
Important: This is an original practice and study bundle aligned to the publicly described D522 Python for IT Automation
course and current V2 performance-assessment themes. It does not reproduce confidential/live WGU assessment
prompts, answer keys, or submission-ready Task 1/Task 2 responses. Use the current official assessment instructions and
rubric for your actual submission.
1. D522 AUTOMATION WORKFLOW
Practice visual: inventory data feeds automation, which performs network collection and validation before reporting results.
2. DNS RESOLUTION FLOW
Practice visual: a hostname can be resolved to an address, while reachability and policy compliance remain separate checks.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b

Partial preview of the text

Download WGU_D522_V2_PYTHON_AUTOMATION_MASTERY_PERFORMANCE_ASSESSMENT_STUDY_BUNDLE and more Exams Computer Programming in PDF only on Docsity!

WGU D522 V2 PYTHON AUTOMATION MASTERY

PERFORMANCE ASSESSMENT STUDY BUNDLE

Important: This is an original practice and study bundle aligned to the publicly described D522 Python for IT Automation course and current V2 performance-assessment themes. It does not reproduce confidential/live WGU assessment prompts, answer keys, or submission-ready Task 1/Task 2 responses. Use the current official assessment instructions and rubric for your actual submission.

1. D522 AUTOMATION WORKFLOW

Practice visual: inventory data feeds automation, which performs network collection and validation before reporting results.

2. DNS RESOLUTION FLOW

Practice visual: a hostname can be resolved to an address, while reachability and policy compliance remain separate checks.

3. GIT EVIDENCE FLOW

Practice visual: logical changes can be staged and committed as traceable checkpoints.

Format: answer choices use large dots; the correct choice is marked by a larger green tick inside a box. Each item includes a concise solution rationale.

PYTHON FOUNDATIONS

1. Which Python data type is ordered, mutable, and allows duplicate values?

frozenset

list

set

tuple

Solution: A list is ordered and mutable and may contain duplicate values.

2. Which keyword defines a function in Python?

function

define

def

func

Solution: Python uses the def keyword to define a function.

3. What does len(['a','b','c']) return?

An error

3

Solution: len returns the number of elements in the list, which is three.

4. Which operator tests equality in Python?

is not

Solution: == compares values for equality; = performs assignment.

5. What is the result of 7 // 2?

cleanup

finally

Solution: finally executes after try/except processing in normal control flow.

12. What does import os do?

Loads the os module

Creates an OS object

Installs an operating system

Starts a shell

Solution: import loads the named module so its functions and constants can be used.

13. Which built-in converts a string such as '42' to an integer?

chr()

int()

str()

float()

Solution: int('42') converts the text to the integer 42.

14. Which built-in converts a value to a string?

string()

reprstr()

str()

text()

Solution: str() produces a string representation of a value.

15. What is a Boolean value in Python?

Only 0 or 1

Any string

A list of flags

True or False

Solution: The bool type has the values True and False.

16. Which expression creates a tuple with one element?

[5]

Solution: The comma makes (5,) a one-element tuple; (5) is just the integer 5.

17. Which method adds one item to the end of a list?

insert_end()

append()

add()

push()

Solution: append adds one element to the list's end.

18. Which method removes and returns the last list element by default?

delete()

discard()

pop()

remove()

Solution: pop() removes and returns the last element.

19. What does range(3) produce when iterated?

3 only

0, 1, 2

Solution: range stops before its endpoint, so range(3) yields 0, 1, and 2.

20. Which syntax starts a comment in Python?

Solution: A hash begins a single-line Python comment.

21. What is indentation used for in Python?

Declaring variables

Defining code blocks

Only improving appearance

Ending a statement

Solution: Indentation is syntactically significant and defines blocks.

22. Which value represents absence of a value in Python?

Empty

Void

None

Null

Solution: None is Python's singleton representing no value.

23. What does type(x) return?

The value of x

The memory address

The variable name

The type/class of x

Solution: type reports the object's type.

24. Which operator performs logical AND?

Stores key-value pairs

Fast membership testing for unique items

Preserves duplicates

Solution: Sets are optimized for membership tests and uniqueness.

31. Which loop is best when iterating directly over each item in a list?

while item in items

loop(items)

foreach items

for item in items

Solution: Python's for loop naturally iterates over iterable elements.

32. What happens when a while loop condition remains True and there is no exit path?

The loop can run indefinitely

Python automatically stops after 10 iterations

The loop becomes a for loop

The interpreter converts it to recursion

Solution: A true condition with no break or state change can create an infinite loop.

33. What does enumerate(items) provide?

Sorted items

Index and item pairs

Only indexes

Only items

Solution: enumerate yields pairs such as (index, item).

34. Which function combines two iterables element-by-element?

merge()

pair()

zip()

join()

Solution: zip creates tuples containing corresponding elements.

35. Which expression checks whether a key exists in a dictionary?

d.has(key)

exists(d,key)

d.contains(key)

key in d

Solution: The in operator tests dictionary keys.

36. What is slicing items[1:4]?

Elements at indexes 1, 2, and 3

Indexes 1 through 4 inclusive

Only index 4

The first four elements

Solution: The stop index is exclusive.

37. What does negative index -1 identify in a sequence?

No element

The last element

The first element

The second element

Solution: -1 refers to the last element.

38. Which operation sorts a list in place?

list.order()

order(list)

list.sort()

sorted_in_place(list)

Solution: sort() mutates the list in place.

39. Which function returns a new sorted iterable without mutating the original list?

sort()

order()

rank()

sorted()

Solution: sorted returns a new list containing the sorted values.

40. What is the purpose of if __name__ == '__main__':?

Run code when the file is executed directly

Always run code during import

Declare the main class

Start a thread

Solution: The condition distinguishes direct execution from import.

41. Which keyword returns a value from a function?

give

return

yield

send

Solution: return exits the function and optionally supplies a value.

42. What does yield generally create?

An exception

A package

A generator behavior

A dictionary

Solution: yield turns a function into a generator that produces values lazily.

min()

smallest()

low()

Solution: min returns the least item according to ordering.

50. What is a common reason to use a dictionary comprehension?

Create binary files

Open sockets

Build dictionaries concisely from iterable data

Remove all keys

Solution: Dictionary comprehensions create key-value mappings compactly.

FILES CSV AND JSON

51. Which mode opens a text file for reading?

w

a

x

r

Solution: r opens an existing file for reading.

52. Which mode truncates a file and writes new content?

w

r

a

x

Solution: w creates or truncates the file before writing.

53. Which mode appends to an existing file?

x

a

w

r

Solution: a writes new content at the end.

54. Why is with open(...) as f: preferred?

It compresses the file

It converts text to JSON

It automatically closes the file

It encrypts the file

Solution: The context manager closes the file when the block exits.

55. Which module provides CSV readers and writers?

table

spreadsheet

delimited

csv

Solution: Python's standard csv module handles comma-separated data.

56. What does csv.DictReader produce per row?

A dictionary-like mapping of column names to values

A tuple of integers only

A JSON string

A database cursor

Solution: DictReader maps header fields to row values.

57. Which module serializes Python objects to JSON text?

yamljson

json

picklejson

serialize

Solution: The standard json module provides JSON encoding and decoding.

58. Which function parses a JSON string into Python objects?

json.parse()

json.read()

json.loads()

json.load()

Solution: loads means load from a string; load reads from a file object.

59. Which function reads JSON from a file object?

json.loads()

json.read()

json.fromfile()

json.load()

Solution: load reads JSON from a file-like object.

60. Which function converts a Python object to a JSON string?

json.dumps()

json.dump()

json.stringify()

json.encode()

Solution: dumps serializes to a string.

61. Which function writes JSON to a file object?

json.tofile()

json.dump()

json.dumps()

json.write()

FileNotFoundError

FileMissing

NoFileError

IOAbsent

Solution: FileNotFoundError is the standard exception for a missing path.

69. Which file method reads the entire file into one string?

fetch()

read()

readalltext()

getall()

Solution: read() returns the file's contents as a string or bytes.

70. Which method reads one line at a time?

getlineall()

nextline()

readline()

line()

Solution: readline returns the next line from the file.

71. Why is line-by-line processing useful for large logs?

It always runs faster

It encrypts logs

It removes duplicates automatically

It reduces peak memory use

Solution: Streaming lines avoids loading the entire file into memory.

72. What is JSON's basic data model built around?

Objects, arrays, strings, numbers, booleans, and null

Only tables and rows

Only binary packets

Only Python classes

Solution: JSON defines a small set of structured data types.

73. Which JSON value corresponds most closely to Python None?

empty

null

None

nil

Solution: JSON uses null to represent an absent/null value.

74. Why should CSV headers be handled explicitly?

They encrypt the file

They prevent file closure

They define the meaning of each column

They are required to be numeric

Solution: Headers map positional fields to meaningful names.

75. What is a good practice before overwriting a configuration file?

Delete all backups

Disable error handling

Write directly without checks

Validate the new content and preserve a recoverable copy when appropriate

Solution: Validation and rollback options reduce the risk of corrupting configuration.

REGEX AND DATA VALIDATION

76. Which module provides Python's regular expression functions?

re

regexpy

regexp

pattern

Solution: The standard re module implements regular expressions.

77. What does re.search() do?

Splits every character

Finds a match anywhere in the string

Requires the match at the start only

Replaces every match

Solution: search scans the string for the first location matching the pattern.

78. What does re.match() normally test?

Only the last character

Only numeric fields

A match beginning at the start of the string

A match anywhere

Solution: match attempts to match at the beginning.

79. What does re.findall() return?

Only the first match object

A Boolean only

The original string

All non-overlapping matches

Solution: findall returns a list of all matching substrings or groups.

80. In regex, \d commonly matches what?

A digit

A letter

Whitespace only

87. Why validate an IP address before using it in a network operation?

To guarantee the host is reachable

To bypass DNS

To encrypt the address

To catch malformed input early

Solution: Syntax validation prevents malformed input from causing confusing downstream failures.

88. Which standard library is useful for parsing IP addresses and networks?

ipaddress

netparse

iptools

socketaddr

Solution: The ipaddress module supports IPv4/IPv6 address and network objects.

89. What does ipaddress.ip_address('192.168.1.5') return?

A DNS record

An IPv4 address object

A string only

A socket

Solution: ip_address parses the text into an IPv4Address object.

90. What does a validation function ideally return?

A network packet

A Git commit

A clear pass/fail result or validated value

A random value

Solution: Clear validation results make calling code predictable.

91. Why normalize text before comparing configuration values?

To make DNS faster

To disable logging

To change IP addresses

To avoid false mismatches from harmless formatting differences

Solution: Normalization can remove irrelevant whitespace/case differences before comparison.

92. What is a false positive in a configuration audit?

Reporting a problem when the configuration actually meets policy

Missing a real problem

A successful ping

A valid DNS response

Solution: A false positive incorrectly labels compliant data as noncompliant.

93. What is a false negative?

A successful login

Failing to report a real problem

Reporting a problem that does not exist

A syntax error

Solution: A false negative misses a condition that should have been detected.

94. Why should regexes for structured data be tested against edge cases?

Testing is unnecessary

Regex cannot be automated

Patterns that work on simple examples may fail on unusual valid or invalid inputs

Regex always changes IPs

Solution: Edge cases expose overly permissive or overly restrictive patterns.

95. What is input sanitization?

Deleting all logs

Installing packages

Resetting passwords

Transforming or rejecting unsafe input before use

Solution: Sanitization reduces risk from malformed or dangerous input.

96. Which is safer when building a shell command from user data?

Avoid the shell when possible and pass arguments as a list

Concatenate raw input into a shell string

Use eval()

Use exec() on the text

Solution: Passing argument lists avoids shell interpretation and injection risks.

97. Why avoid eval() for untrusted input?

It encrypts strings

It can execute arbitrary Python expressions

It only parses JSON

It cannot run code

Solution: eval executes Python expressions and is unsafe with untrusted input.

98. What should a parser do when expected fields are missing?

Delete the record

Ignore the schema

Fail clearly or apply an explicit, documented default

Guess silently

Solution: Explicit failure/default behavior makes automation predictable and auditable.

99. What is schema validation intended to confirm?

That a host is reachable

That a Git branch is current

That SMTP is enabled

Solution: AAAA records store IPv6 addresses.

105. Which DNS record is used for reverse IPv4 lookup?

CNAME

PTR

A

MX

Solution: PTR records map an address to a name in reverse DNS.

106. What is a CNAME record used for?

Defining an email server

Storing a MAC address

Creating an alias from one name to another name

Storing an IPv4 address

Solution: CNAME creates a canonical-name alias.

107. What is an MX record used for?

Mapping IPv4 addresses

Creating reverse DNS

Defining a subnet mask

Identifying mail servers for a domain

Solution: MX records identify mail exchangers.

108. Which command is commonly used on Linux to inspect DNS resolver status?

resolvectl status

git status

ipconfig /all

route mail

Solution: resolvectl status reports systemd-resolved resolver information where applicable.

109. Why can DNS configuration differ by operating system?

Only Windows supports DNS

Different resolver services and configuration mechanisms are used

DNS is not standardized

IP addresses are OS-specific

Solution: Resolver configuration varies by OS and service manager.

110. What is the purpose of a default gateway?

To store Git commits

To assign usernames

To forward traffic to destinations outside the local subnet

To resolve hostnames

Solution: The gateway is the next-hop router for off-subnet traffic.

111. What does a subnet mask help determine?

The DNS server password

The Git branch

The SMTP port

Which addresses are local to the subnet

Solution: The mask separates network and host portions of an IP address.

112. What does DHCP typically provide?

Dynamic network configuration such as IP address and gateway

Git repositories

Email encryption

Python packages

Solution: DHCP can assign addresses and other network settings.

113. Why might a DHCP-assigned host have no predictable IP?

Telnet changes addresses

Its address may change according to the lease

DHCP always uses static addresses

DNS prevents changes

Solution: Dynamic leases can result in different addresses over time.

114. What is reachability testing?

Checking Git branches

Checking disk compression

Checking whether a target responds to a network probe

Checking whether code is syntactically valid

Solution: Reachability testing determines whether a network target responds.

115. Why should a script distinguish DNS failure from ping failure?

They are always identical

DNS failure proves the host is offline

Ping failure proves DNS is wrong

They indicate different troubleshooting paths

Solution: A DNS issue can exist even when the host is reachable by IP, and vice versa.

116. What is latency?

The time taken for data or a response to traverse a path

The number of DNS records

The number of Git commits

The size of a Python list

Solution: Latency measures delay.

117. What does packet loss indicate?

Git is corrupted

Some probes or packets failed to reach the destination or return