Docsity

WGU D522 TASK 1 PERFORMANCE ASSESSMENT | PYTHON NETWORK AUTOMATION, DEVICE INVENTORY, CON, Exams of Information and Communications Technology (ICT)

Partial preview of the text

Download WGU D522 TASK 1 PERFORMANCE ASSESSMENT | PYTHON NETWORK AUTOMATION, DEVICE INVENTORY, CON and more Exams Information and Communications Technology (ICT) in PDF only on Docsity!

WGU D522 TASK 1 PERFORMANCE ASSESSMENT | PYTHON NETWORK

AUTOMATION, DEVICE INVENTORY, CONNECTIVITY & DNS COMPROMISE AUDIT |

COMPLETE 2026 GUIDE

Core Domains

  • Python Fundamentals for IT Automation
  • Data Structures (Lists, Tuples, Dictionaries, Sets)
  • File I/O and Data Serialization (CSV, JSON)
  • Network Automation with Netmiko and SSH
  • Device Discovery and Endpoint Inventory
  • Connectivity Testing and Ping Sweeps
  • Live DNS Configuration Audit (resolvectl)
  • Error Handling, Logging, and Exception Management
  • Regular Expressions for Log and CLI Parsing
  • Script Design, Debugging, and Documentation Introduction This comprehensive WGU D522 Task 1 Performance Assessment study guide is designed for students completing the Python Network Automation, Device Inventory, Connectivity & DNS Compromise Audit performance assessment at Western Governors University. The exam contains 70 questions covering all essential topics

required for successful completion of Task 1, including Python fundamentals, data structures for device management, Netmiko library usage for network automation, endpoint discovery, connectivity testing, and live DNS configuration auditing. Each question includes a verified correct answer and a detailed rationale explaining the underlying concepts and computational reasoning. This resource reflects the 2026 WGU D522 curriculum requirements for network automation and Python scripting in IT environments. SECTION 1: PYTHON FUNDAMENTALS & DATA TYPES (Questions 1–15) Question 1 A developer needs to create a script to process a list of IP addresses. The addresses are provided as a string: "192.168.1.1, 10.0.0.1, 172.16.0.1". Which Python method should be used to convert this string into a list of individual IP addresses? A. .join() B. .split() C. .strip() D. .replace() B RATIONALE: The .split() method is used to divide a string into a list based on a specified delimiter. In this case, addresses.split(",") would create a list of individual IP addresses. The .join() method combines list elements into a string, .strip() removes whitespace, and .replace() substitutes characters. Question 2 A developer is creating a Python script to capture metrics for different network interfaces on a router, with each set of metrics treated as a single, immutable record. Which data structure should be used?

def multiply_numbers(num1, num2) result = num1 * num return result Which code adjustment will resolve the syntax error? A. Add a colon after def multiply_numbers(num1, num2) B. Remove the return statement C. Add parentheses around the parameters D. Change def to function A RATIONALE: In Python, function definitions require a colon at the end of the def statement line. The correct syntax is def multiply_numbers(num1, num2): followed by an indented block. The colon indicates the start of the function body. Question 5 Based on the Python snippet: text value = input("Enter a number: ") result = int(value) + 10 print(result) What purpose does result = int(value) + 10 serve? A. Converts the user's input into a string and concatenates it B. Converts the user's input into an integer and adds 10 C. Multiplies the user's input by 10 D. Divides the user's input by 10 B

RATIONALE: The int() function converts the user's string input into an integer data type. The + 10 then performs addition, resulting in the numeric sum. This demonstrates type conversion and arithmetic operations in Python. Question 6 What is the output of this Python code? text numbers = [1, 2, 3] numbers[0] = 10 print(numbers) A. [1, 2, 3] B. [10, 2, 3] C. [1, 10, 3] D. [10, 10, 10] B RATIONALE: Lists are mutable in Python. The assignment numbers[0] = 10 replaces the first element (index 0) with the value 10, while the remaining elements stay unchanged. The output is [10, 2, 3]。 Question 7 What will this code return? text my_str = "Hello World" print(my_str[0:5])

A. [1, 2, 3]

B. {1, 2, 3}

C. (1, 2, 3)

D. <1, 2, 3>

C

RATIONALE: Tuples are created using parentheses () in Python. Square brackets [] create lists, curly braces {} create sets or dictionaries, and angle brackets are not used for Python data structures. Question 10 Which function should be used to add data to a file, such as a network configuration file? A. read() B. write() C. append() D. open() B RATIONALE: The write() method is used to add data to a file. It writes a string to the file. The open() function is used to open a file, read() reads data from a file, and append() is a mode for opening a file to add data at the end. Question 11 Which characteristics are associated with tuples in Python? A. Ordered and changeable B. Unordered and changeable C. Ordered and unchangeable D. Unordered and unchangeable

C

RATIONALE: Tuples are ordered sequences that are immutable (unchangeable) after creation. This makes them ideal for storing fixed data records that should not be modified, such as network interface metric snapshots. Question 12 Which Python method is used to combine two lists? A. merge() B. combine() C. extend() D. append() C RATIONALE: The extend() method adds all elements from one list to the end of another list. append() adds a single element, while merge() and combine() are not native Python list methods. Question 13 A developer needs to create a Python script to manage network device credentials securely. Which data structure is most appropriate for storing device connection parameters (IP, username, password, port)? A. List B. Tuple C. Dictionary D. Set C

C. 13

D. 10

A

RATIONALE: Multiplication has higher precedence than addition in Python. The expression is evaluated as 5 + (3 * 2) = 5 + 6 = 11. Understanding operator precedence is critical for accurate automation scripting. SECTION 2: DATA STRUCTURES & DEVICE MANAGEMENT (Questions 16–25) Question 16 A network inventory script needs to store device names in a collection that prevents duplicates automatically. Which data structure should be used? A. List B. Tuple C. Set D. Dictionary C RATIONALE: A set is an unordered collection of unique elements that automatically prevents duplicates. This is ideal for maintaining a unique inventory of discovered devices without manually checking for duplicates. Question 17 A Python script needs to store network interface statistics (speed, duplex, status, MAC address) as a single record that cannot be modified after creation. Which data structure is most appropriate?

A. List B. Tuple C. Dictionary D. Set B RATIONALE: A tuple is ordered and immutable, making it ideal for storing a fixed set of metrics that should not be modified. This ensures data integrity for historical records of network interface snapshots. Question 18 Which Python code snippet correctly creates a dictionary with key-value pairs for network device management? A. devices = ('Router1', '192.168.1.2') B. devices = {"Router1": "192.168.1.2", "Switch1": "192.168.1.3"} C. devices = ["Router1", "192.168.1.2"] D. devices = {"Router1", "192.168.1.2"} B RATIONALE: Dictionaries are created using curly braces {} with colon-separated key-value pairs. Option B correctly creates a dictionary mapping device names to IP addresses. Option A creates a tuple, Option C creates a list, and Option D creates a set. Question 19 A Python script needs to store a list of discovered device IP addresses. The script must allow adding new addresses, removing addresses, and accessing addresses by index. Which data structure should be used?

C. Set D. Dictionary C RATIONALE: A set is an unordered collection of unique elements. It automatically enforces uniqueness without requiring manual duplicate checking, making it ideal for maintaining a set of unique device hostnames. Question 22 Which of the following is NOT a valid Python data type? A. int B. float C. char D. str C RATIONALE: Python does not have a dedicated char data type. Characters are represented as strings of length 1 using the str type. int, float, and str are all valid Python data types. Question 23 A Python script needs to store network configuration data where each configuration parameter is accessed by a descriptive name. Which data structure is most appropriate? A. List B. Tuple C. Dictionary D. Set C

RATIONALE: Dictionaries store data as key-value pairs, allowing access to values by descriptive keys. This is ideal for storing configuration parameters where each setting has a meaningful name, such as {"hostname": "router01", "domain": "example.com", "dns": "8.8.8.8"}. Question 24 Based on the Python snippet: person = {"name": "Alice", "role": "admin", "id": 1001}. How would you access the value "admin"? A. person[0] B. person["role"] C. person.role D. person.get(1) B RATIONALE: Dictionary values are accessed using the key in square brackets, e.g., person["role"]. The .get() method can also be used but requires the key name. Index-based access does not work with dictionaries. Question 25 Which Python method is used to remove the last item from a list? A. remove() B. delete() C. pop() D. discard() C RATIONALE: The pop() method removes and returns the last item from a list (or a specified index). remove() removes the first occurrence of a specified value, delete() is not a list method, and discard() is used with sets.

C. while loops D. for loops B RATIONALE: try/except blocks are used for exception handling in Python. They allow the script to attempt a network connection and gracefully handle any exceptions (e.g., timeout, authentication failure) without crashing. This is essential for robust automation scripts. Question 28 A developer writes a Python script to automate a backup process. The script must check if a backup directory exists, create it if it does not, and copy .conf files to it. Which modules should be imported? A. os and sys B. os and shutil C. netmiko and re D. json and csv B RATIONALE: The os module provides functions for interacting with the operating system, including checking for directory existence (os.path.exists()) and creating directories (os.makedirs()). The shutil module provides file operations including copying files (shutil.copy2()). Question 29 What is the purpose of the f before the string in return f"{greeting}, {name}!"? A. It indicates a file operation B. It creates a formatted string with embedded variables

C. It converts the string to a float D. It defines a function B RATIONALE: The f prefix creates an f-string (formatted string literal) in Python. It allows variables and expressions to be embedded directly within curly braces {} in the string, making string formatting cleaner and more readable. Question 30 Which Python statement is used to exit a loop prematurely? A. exit B. stop C. break D. continue C RATIONALE: The break statement is used to exit a loop prematurely. continue skips the rest of the current iteration and moves to the next, exit is used to terminate the entire program, and stop is not a Python statement. Question 31 A Python script needs to iterate through a list of IP addresses and ping each one. Which loop construct is most appropriate? A. while loop B. for loop C. do-while loop D. repeat loop B