D278 ITSW 2113 Scripting &
Programming - Foundations
Objective Assessment Review
(Questions & Solutions)
2025
©2025
, Question 1 (Multiple Choice)
Question:
When developing network automation scripts for Cisco devices, which
Python module is most suitable for parsing complex command-line
arguments?
Options:
A. `sys.argv`
B. `getopt`
C. `argparse`
D. `configparser`
Correct ANS:
C. `argparse`
Rationale:
The `argparse` module provides advanced parsing capabilities, generates
helpful usage messages automatically, and handles user-provided
arguments and options in a robust manner—making it ideal for building
network automation tools that require a rich set of command-line
options.
---
Question 2 (Multiple Choice)
Question:
In Python network automation scripts, what does the built-in object
`os.environ` represent?
Options:
A. A list of active processes
B. A dictionary mapping environment variable names to their values
©2025
,C. The command history of the current session
D. A module for connecting to remote devices
Correct ANS:
B. A dictionary mapping environment variable names to their values
Rationale:
`os.environ` is a dictionary-like object that provides access to the
environment variables. This is especially useful in automation scripts
where dynamic configuration via environment variables is preferred for
managing deployment settings.
---
Question 3 (Fill-in-the-Blank)
Question:
In Python, the __________ library is commonly used to establish secure
SSH connections for network device automation.
ANS:
Paramiko
Rationale:
Paramiko is a widely used library in the Python ecosystem that
implements the SSHv2 protocol, enabling secure and encrypted
connections to network devices such as Cisco routers and switches.
---
Question 4 (True/False)
Question:
True or False: In Python, the Global Interpreter Lock (GIL) prevents
multiple threads from executing Python byte code simultaneously, which
©2025
, can limit concurrency in CPU-bound tasks but is less impactful for I/O-
bound operations.
Correct ANS:
True
Rationale:
The GIL ensures that only one thread executes Python byte code at a
time. While this can be a bottleneck for CPU-bound processes, I/O-bound
tasks—which are common in network operations—can bypass much of
this limitation by waiting on external events, thus making threading a
viable option.
---
Question 5 (Multiple Response)
Question:
Which of the following Python libraries are specifically leveraged for
network automation tasks? (Select all that apply)
Options:
A. Netmiko
B. Napalm
C. Pandas
D. Nornir
E. TensorFlow
Correct ANS:
A. Netmiko, B. Napalm, D. Nornir
Rationale:
Netmiko, Napalm, and Nornir are libraries designed to simplify the
automation and management of network devices. Pandas is primarily for
data analysis, and TensorFlow is meant for machine learning; hence, they
©2025
Programming - Foundations
Objective Assessment Review
(Questions & Solutions)
2025
©2025
, Question 1 (Multiple Choice)
Question:
When developing network automation scripts for Cisco devices, which
Python module is most suitable for parsing complex command-line
arguments?
Options:
A. `sys.argv`
B. `getopt`
C. `argparse`
D. `configparser`
Correct ANS:
C. `argparse`
Rationale:
The `argparse` module provides advanced parsing capabilities, generates
helpful usage messages automatically, and handles user-provided
arguments and options in a robust manner—making it ideal for building
network automation tools that require a rich set of command-line
options.
---
Question 2 (Multiple Choice)
Question:
In Python network automation scripts, what does the built-in object
`os.environ` represent?
Options:
A. A list of active processes
B. A dictionary mapping environment variable names to their values
©2025
,C. The command history of the current session
D. A module for connecting to remote devices
Correct ANS:
B. A dictionary mapping environment variable names to their values
Rationale:
`os.environ` is a dictionary-like object that provides access to the
environment variables. This is especially useful in automation scripts
where dynamic configuration via environment variables is preferred for
managing deployment settings.
---
Question 3 (Fill-in-the-Blank)
Question:
In Python, the __________ library is commonly used to establish secure
SSH connections for network device automation.
ANS:
Paramiko
Rationale:
Paramiko is a widely used library in the Python ecosystem that
implements the SSHv2 protocol, enabling secure and encrypted
connections to network devices such as Cisco routers and switches.
---
Question 4 (True/False)
Question:
True or False: In Python, the Global Interpreter Lock (GIL) prevents
multiple threads from executing Python byte code simultaneously, which
©2025
, can limit concurrency in CPU-bound tasks but is less impactful for I/O-
bound operations.
Correct ANS:
True
Rationale:
The GIL ensures that only one thread executes Python byte code at a
time. While this can be a bottleneck for CPU-bound processes, I/O-bound
tasks—which are common in network operations—can bypass much of
this limitation by waiting on external events, thus making threading a
viable option.
---
Question 5 (Multiple Response)
Question:
Which of the following Python libraries are specifically leveraged for
network automation tasks? (Select all that apply)
Options:
A. Netmiko
B. Napalm
C. Pandas
D. Nornir
E. TensorFlow
Correct ANS:
A. Netmiko, B. Napalm, D. Nornir
Rationale:
Netmiko, Napalm, and Nornir are libraries designed to simplify the
automation and management of network devices. Pandas is primarily for
data analysis, and TensorFlow is meant for machine learning; hence, they
©2025