Timedora
Free Practice Quiz Question List

4 Network Automation with Python Online Quiz Questions

Use this free practice quiz with 20 questions to review 4 Network Automation with Python, test your knowledge, and prepare for your next test or exam.

20 questions
01
Choose one
1 point

A team wants an automation script that is straightforward to test and maintain as its device inventory grows. Which design best separates the script's data, logic, and device access?

  1. A

    Store device inventory and desired values as structured data, place reusable procedures in functions, and use a library or API client for device access.

  2. B

    Put credentials, device inventory, and all operational logic in one function so the script has fewer components.

  3. C

    Store device details in comments and embed each device's commands directly in the control flow.

  4. D

    Use a separate script for every device so the scripts do not need reusable logic.

02
True or false
1 point

True or false: In the inventory-validation example, an invalid management address can raise ValueError, which the script catches to report the affected device.

  1. A

    True

  2. B

    False

03
Fill in the blank
1 point

To decide whether a device needs a configuration change, compare its current state with the .

04
Written response
1 point

What term describes an automation run that can be repeated without making further changes once the device has reached the desired state?

05
Choose one
1 point

In the NAPALM example, what happens when the candidate differs from the device's current configuration but the APPLY environment variable is not set to "1"?

  1. A

    It commits the candidate configuration and verifies the hostname.

  2. B

    It displays the proposed diff, then discards the candidate without applying the change.

  3. C

    It replaces the device configuration with the candidate and closes the session.

  4. D

    It skips the diff and marks the device compliant.

06
Choose all
1 point

Select all actions that belong in the automation workflow before a consequential device change is applied.

  1. A

    Validate the device list and required inputs.

  2. B

    Read the current device state needed for the task.

  3. C

    Compare current and desired state to calculate the change.

  4. D

    Produce a diff or plan for review before applying the change.

  5. E

    Apply the change before reading the current state, then decide whether it was necessary.

07
True or false
1 point

True or false: In the NAPALM example, the finally block is used to clean up a pending candidate and close the device session, including when an error occurs.

  1. A

    True

  2. B

    False

08
Written response
1 point

How many numbered stages are in the reliable automation pattern, from loading and validating inputs through recording the outcome and cleaning up?

09
Fill in the blank
1 point

In the NAPALM example, credentials are read from rather than embedded in the source code.

10
Choose one
1 point

A configuration commit succeeds, but the team needs to know whether the device actually reached the intended state. Which check best provides that evidence?

  1. A

    Confirm that the script printed the proposed diff.

  2. B

    Confirm that the candidate was loaded without an exception.

  3. C

    After committing, retrieve live device facts and check that the hostname matches the intended name.

  4. D

    Confirm that the device session closed without an exception.

11
Choose all
1 point

A device may temporarily stop responding during an automation run. Select all practices that help handle this safely.

  1. A

    Set timeouts and limit retries to errors likely to be temporary.

  2. B

    Retry every failed operation indefinitely until the device responds.

  3. C

    Avoid blindly repeating operations that are not idempotent.

  4. D

    Remove timeouts so a slow device can never cause the script to fail.

12
Choose one
1 point

Before applying a candidate configuration, an engineer is unsure whether the target platform replaces or merges configuration. What is the safest next step?

  1. A

    Assume every configuration operation merges changes and apply the entire candidate.

  2. B

    Determine whether the device or library merges or replaces configuration, then choose the smallest suitable change.

  3. C

    Prefer replacing configuration because it guarantees unrelated settings will be preserved.

  4. D

    Skip reviewing the candidate if the requested setting appears in the inventory.

13
Open ended
1 point

A script commits a risky production change, but its post-change check shows that the device is not operating as intended. What should the automation team do next, and what recovery safeguards should it have planned for such a change?

14
Choose one
1 point

A device inventory may contain malformed management addresses. Which approach helps detect those errors before the script attempts device connections?

  1. A

    Attempt to connect to every device and handle malformed addresses only after authentication fails.

  2. B

    Parse each management address with the ipaddress module before attempting connections.

  3. C

    Replace every invalid address with a default address so the script can continue.

  4. D

    Skip address checks because the network library will always report invalid input consistently.

15
Choose one
1 point

A network automation script needs a username and password to connect to devices. Which approach best protects those credentials?

  1. A

    Store the password in a comment so operators can find it easily.

  2. B

    Commit the password in a configuration file alongside the script.

  3. C

    Retrieve credentials from a secrets manager or protected environment injection.

  4. D

    Print the password to the log before connecting so failures are easier to diagnose.

16
Written response
1 point

What property should an automation script have if rerunning it after the desired device state is reached makes no further changes?

17
Written response
1 point

In the NAPALM workflow, which method displays the difference for a staged configuration candidate before it is committed or discarded?

18
True or false
1 point

True or false: If a device accepts a configuration command, that alone proves the intended operational result was achieved.

  1. A

    True

  2. B

    False

19
Choose one
1 point

A change script should default to a dry run and require an explicit opt-in before applying a staged change. Which behavior matches that requirement?

  1. A

    Commit every candidate as soon as it is loaded, then display the diff.

  2. B

    Display the proposed diff and discard the candidate unless APPLY=1 is set.

  3. C

    Discard every candidate before comparing it with the current configuration.

  4. D

    Apply the candidate only when the diff is empty.

20
Choose one
1 point

A script may fail after loading a candidate configuration. Which cleanup strategy best ensures that the candidate is discarded when needed and the device session is closed?

  1. A

    Use a finally block to discard any still-loaded candidate and close the session.

  2. B

    Close the session only after every operation succeeds.

  3. C

    Retry the commit indefinitely before closing the session.

  4. D

    Leave the candidate loaded so a later run can reuse the session.