What is the outcome of this Python snippet: client.connect(ip, port=22, username=usr, password=pswd); stdin, stdout, stderr = client.exec_command('show ip bgp 192.168.101.0 bestpath\n'); print(stdout)?
Choose an answer
Tap an option to check your answer.
Correct answer: connects to a Cisco device using SSH and exports the BGP table for the prefix.
Why this is the answer
The Python snippet uses the paramiko library (implied by client.connect and client.execcommand) to establish an SSH connection to a network device. The port=22 explicitly specifies SSH. The execcommand('show ip bgp 192.168.101.0 bestpath\n') executes a Cisco IOS XE command to display BGP bestpath information for the specified prefix. Finally, print(stdout) outputs the standard output from that command. Therefore, it connects via SSH and retrieves specific BGP table information. The other options are incorrect because the code explicitly uses port 22 (SSH, not Telnet), and the command specifically targets BGP information, not the entire routing table or a general formatted output.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed