Which Action Does This Python Network Automation Script Perform?

Refer to the exhibit. Which action results from executing the Python script? - image

  1. display the output of a command that is entered on that device
  2. display the output of a command that is entered on that device in a single line
  3. SSH to the IP address that is manually entered on that device
  4. display the unformatted output of a command that is entered on that device Source Reference Answer

Community Votes

D
62%
A
38%

62% of anonymous learners picked answer D. Votes are pick records left by other test-takers — they are not the verified answer.

Community Insight

It tests the precise distinction between raw and processed data streams in automation, where candidates often overlook the absence of formatting or parsing logic.

This question evaluates your ability to interpret Python-based network automation scripts that use Paramiko for remote CLI execution. The community consensus confirms the script streams raw, unformatted command output line-by-line to stdout without any data parsing.

Many candidates select Option A because it broadly describes the script's function, but they fail to recognize that certification exams require precise terminology; 'unformatted' specifically denotes the lack of data transformation, making it the technically accurate choice.

Community Discussion (8 comments)

Mizuchan 👍 6
I think it should be D.
Abbribas 👍 2 Selected: D
The output of the command executed on the remote device is streamed line by line via the stdout variable. Each line is printed with print(u) inside the loop. Since no specific formatting or processing is applied to the output, "unformatted" might also be a valid way to describe the result.
a67c04a 👍 1 Selected: D
I go with D - same question as 1024.
zbeugene7 👍 1
D is correct answer , there is a difference betweem formatted and unformatted output and no formatting is applied to the output in this case , what is the purpose of this question ? This is a primitive script , ping the IP , SSH to the host if it's reachable , run the command entered earlier, check the unformatted results , why is this question in CCNP exam ? CCNA has more difficult questions , what is that special knowledge correct answer to this question proves that a network engineer must have to be a professional compared to that of an associate ?
peer1024 👍 2 Selected: D
#! /usr/bin/env python3 from pythonping import ping import paramiko import sys import time s = "%s %s" % (sys.argv[1],'') s1 = s.replace(' ','') ip = s1 t = "%s %s" % (sys.argv[2],'') #PYTHON ping needs root ! #r = ping(s1, count=7) #r1 = r.succes() #if r1 != True: # print (ip + " - no ping possible") # exit client = paramiko.client.SSHClient() client.load_system_host_keys() client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) client.connect(ip, username=USER, password=PSWD, port=22) stdin, stdout, stderr = client.exec_command(t +'\n') time.sleep(3) print(t) for u in stdout: print(u, end='') #print(u) client.close
CiscoTerminator 👍 2
are we software devs now? so in network devOps what will the questions be?
supershysherlock 👍 2 Selected: A
Based on the available information, the script is designed to execute a command on a remote device over SSH and print the output. So the correct answer is: A. display the output of a command that is entered on that device
NazgulNr5 👍 4
It also does SSH to the device entered, if the ping succeeds. BTW, this is a terrible Python code.

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

Expert Analysis

Core Script Behavior

The provided Python code leverages the Paramiko library to establish an SSH connection to a target network device. Once authenticated, it executes a user-supplied CLI command and captures the device's response. The script then iterates through the returned data stream, printing each line individually to standard output using a basic print() statement.

Why Option D is Correct

Option D accurately describes the outcome because the script outputs the raw CLI response exactly as received. As discussed in community comments [2], the output is streamed line-by-line directly from the device without any intermediate processing. Since the code lacks data parsing, JSON serialization, or pretty-printing functions, the result remains in its native, unaltered state. Exam questions frequently test this nuance to verify that engineers can differentiate between direct output and structured automation results.

Why Other Options Are Incorrect

  • Option A is functionally true but technically imprecise. It ignores the critical detail that the output is presented exactly as received, which is why 'unformatted' is the superior answer.
  • Option B is incorrect because the loop explicitly handles multiple lines sequentially, never concatenating them into a single string.
  • Option C misidentifies the primary objective. While SSH connectivity is a necessary prerequisite step [8], the script's ultimate purpose is command execution and output retrieval, not merely host reachability testing.

Official Reference

Exam Strategy

When analyzing automation scripting questions, always trace the exact data flow from input to final output. Look for keywords like 'formatted,' 'parsed,' or 'streamed' to match the script's actual processing logic, and prioritize answers that reflect the precise technical state of the data rather than just the high-level goal.

Related Analysis

Practice All 350-401 Questions

Access 218 questions with complete answers and detailed explanations.

View Full 350-401 Practice Test →

← Back to 350-401 Study Guide