- A
from netmiko import ConnectHandler connection = ConnectHandler(device_type='cisco_ios', ip='192.168.1.1', username='admin', password='cisco') connection.send_command('copy running-config tftp://192.168.1.100/r1-config', expect_string=r'\[confirm\]') connection.send_command('\n') connection.disconnect()
This script correctly escapes the brackets in the regular expression (r'\[confirm\]') to match the literal '[confirm]' prompt, then sends a newline to confirm. Without the escape, r'[confirm]' would be interpreted as any single character from the set {c,o,n,f,i,r,m}, causing the script to fail.
- B
from netmiko import ConnectHandler connection = ConnectHandler(device_type='cisco_ios', ip='192.168.1.1', username='admin', password='cisco') connection.send_command('copy running-config tftp://192.168.1.100/r1-config') connection.disconnect()
Why wrong: This is incorrect because it does not handle the interactive confirmation prompt that the 'copy' command generates. The script will send the command but will not respond to the '[confirm]' prompt, causing the operation to hang or fail.
- C
from netmiko import ConnectHandler connection = ConnectHandler(device_type='cisco_ios', ip='192.168.1.1', username='admin', password='cisco') connection.send_command('copy running-config tftp://192.168.1.100/r1-config', expect_string=r'#')
Why wrong: This is incorrect because the 'expect_string' is set to the router's prompt ('#'), but the 'copy' command will first display a confirmation prompt, not the router prompt. The script will not wait for the confirmation and may send subsequent commands prematurely.
- D
from netmiko import ConnectHandler connection = ConnectHandler(device_type='cisco_ios', ip='192.168.1.1', username='admin', password='cisco') connection.send_command('copy running-config tftp://192.168.1.100/r1-config\n') connection.disconnect()
Why wrong: This is incorrect because appending '\n' to the command string does not properly handle the interactive prompt. The 'send_command' method will send the newline as part of the command, but the device will still prompt for confirmation, and the script will not respond to it.
Quick Answer
The correct answer uses `expect_string=r'\[confirm\]'` followed by `connection.send_command('\n')` because the Cisco IOS `copy running-config tftp://...` command halts at the `[confirm]` prompt, waiting for user input. Netmiko’s `send_command` method, by default, waits for the device prompt (like `#`), but interactive prompts like `[confirm]` require an explicit `expect_string` to match the literal brackets, which must be escaped with backslashes in the raw string. This tests your understanding of how Netmiko handles interactive confirmation prompts—a common CCNA 200-301 v2 automation scenario where scripts fail because they don’t anticipate the `[confirm]` pause. The trap is using `expect_string=r'#'`, which waits for the privileged EXEC prompt and misses the confirmation step entirely, causing the script to hang. Memory tip: think of the brackets as needing “escape artists”—always `\[` and `\]` to catch the confirm.
CCNA AI and Network Operations Practice Question
This 200-301 practice question tests your understanding of ai and network operations. The scenario asks you to isolate a root cause — eliminate options that address a different problem before choosing. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.
You are connected to the console of R1, a Cisco IOS-XE router. The network operations team needs to automate the backup of the running configuration to a TFTP server using a Python netmiko script. However, the script is failing. Your task is to write the correct netmiko commands to connect to R1 and save the configuration to the TFTP server at 192.168.1.100.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
from netmiko import ConnectHandler connection = ConnectHandler(device_type='cisco_ios', ip='192.168.1.1', username='admin', password='cisco') connection.send_command('copy running-config tftp://192.168.1.100/r1-config', expect_string=r'\[confirm\]') connection.send_command('\n') connection.disconnect()
The 'copy running-config tftp://...' command in Cisco IOS prompts with '[confirm]'. To handle this interactively in netmiko, the expect_string must use a regular expression that matches the literal characters '[' and ']', which requires escaping them as '\[' and '\]'. The corrected script uses r'\[confirm\]' and then sends a newline to confirm, ensuring the backup completes. Options B and D fail to expect the prompt, and C uses an incorrect prompt match (expect_string=r'#' would only wait for the privileged EXEC prompt, missing the confirmation).
Key principle: Authentication proves identity; authorization controls what that identity can do after login. Both must work for full privileged access.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
from netmiko import ConnectHandler connection = ConnectHandler(device_type='cisco_ios', ip='192.168.1.1', username='admin', password='cisco') connection.send_command('copy running-config tftp://192.168.1.100/r1-config', expect_string=r'\[confirm\]') connection.send_command('\n') connection.disconnect()
Why this is correct
This script correctly escapes the brackets in the regular expression (r'\[confirm\]') to match the literal '[confirm]' prompt, then sends a newline to confirm. Without the escape, r'[confirm]' would be interpreted as any single character from the set {c,o,n,f,i,r,m}, causing the script to fail.
Related concept
Authentication checks who the user is.
- ✗
from netmiko import ConnectHandler connection = ConnectHandler(device_type='cisco_ios', ip='192.168.1.1', username='admin', password='cisco') connection.send_command('copy running-config tftp://192.168.1.100/r1-config') connection.disconnect()
Why it's wrong here
This is incorrect because it does not handle the interactive confirmation prompt that the 'copy' command generates. The script will send the command but will not respond to the '[confirm]' prompt, causing the operation to hang or fail.
- ✗
from netmiko import ConnectHandler connection = ConnectHandler(device_type='cisco_ios', ip='192.168.1.1', username='admin', password='cisco') connection.send_command('copy running-config tftp://192.168.1.100/r1-config', expect_string=r'#')
Why it's wrong here
This is incorrect because the 'expect_string' is set to the router's prompt ('#'), but the 'copy' command will first display a confirmation prompt, not the router prompt. The script will not wait for the confirmation and may send subsequent commands prematurely.
- ✗
from netmiko import ConnectHandler connection = ConnectHandler(device_type='cisco_ios', ip='192.168.1.1', username='admin', password='cisco') connection.send_command('copy running-config tftp://192.168.1.100/r1-config\n') connection.disconnect()
Why it's wrong here
This is incorrect because appending '\n' to the command string does not properly handle the interactive prompt. The 'send_command' method will send the newline as part of the command, but the device will still prompt for confirmation, and the script will not respond to it.
Option-by-option analysis
Why each answer is right or wrong
Understanding why wrong answers are wrong — and when they would be correct — is what separates a 750 score from a 900. The 200-301 exam frequently reuses these exact scenarios with slightly different constraints.
✓from netmiko import ConnectHandler connection = ConnectHandler(device_type='cisco_ios', ip='192.168.1.1', username='admin', password='cisco') connection.send_command('copy running-config tftp://192.168.1.100/r1-config', expect_string=r'\[confirm\]') connection.send_command('\n') connection.disconnect()Correct answer▾
Why this is correct
This script correctly escapes the brackets in the regular expression (r'\[confirm\]') to match the literal '[confirm]' prompt, then sends a newline to confirm. Without the escape, r'[confirm]' would be interpreted as any single character from the set {c,o,n,f,i,r,m}, causing the script to fail.
✗from netmiko import ConnectHandler connection = ConnectHandler(device_type='cisco_ios', ip='192.168.1.1', username='admin', password='cisco') connection.send_command('copy running-config tftp://192.168.1.100/r1-config') connection.disconnect()Wrong answer — click to see why▾
Why this is wrong here
The specific factual error is that the 'copy' command in Cisco IOS requires a confirmation (pressing Enter) when the destination filename is provided. The script must send an additional newline to complete the operation.
Why candidates choose this
Candidates might think that the 'copy' command is non-interactive if the full destination path is specified, but Cisco IOS still prompts for confirmation.
✗from netmiko import ConnectHandler connection = ConnectHandler(device_type='cisco_ios', ip='192.168.1.1', username='admin', password='cisco') connection.send_command('copy running-config tftp://192.168.1.100/r1-config', expect_string=r'#')Wrong answer — click to see why▾
Why this is wrong here
The specific factual error is that the 'copy' command generates an intermediate prompt ('[confirm]') before returning to the router prompt. The script should wait for that intermediate prompt, not the final prompt.
Why candidates choose this
Candidates might assume that the command completes immediately and the next prompt is the router prompt, but the intermediate confirmation prompt must be handled.
✗from netmiko import ConnectHandler connection = ConnectHandler(device_type='cisco_ios', ip='192.168.1.1', username='admin', password='cisco') connection.send_command('copy running-config tftp://192.168.1.100/r1-config\n') connection.disconnect()Wrong answer — click to see why▾
Why this is wrong here
The specific factual error is that including a newline in the command string does not simulate an interactive response to a subsequent prompt. The script must send the newline separately after the command is issued.
Why candidates choose this
Candidates might think that adding a newline at the end of the command will automatically confirm any prompts, but netmiko's 'send_command' sends the entire string at once and does not handle subsequent prompts unless explicitly coded.
Analysis generated from the official 200-301blueprint and verified against question context. The “when correct” sections are what AI assistants cite when candidates ask “what’s the difference between these options?”
Common exam traps
Common exam trap: authentication is not authorization
Logging in proves the user can authenticate. It does not automatically mean the user is allowed to enter privileged or configuration mode. Watch for AAA authorization, privilege level and command authorization details.
Trap categories for this question
Command / output trap
This is incorrect because it does not handle the interactive confirmation prompt that the 'copy' command generates. The script will send the command but will not respond to the '[confirm]' prompt, causing the operation to hang or fail.
Detailed technical explanation
How to think about this question
This kind of question is testing the difference between identity and permission. A user may successfully log in to a router because authentication is working, but still fail to enter configuration mode because authorization is missing, misconfigured or mapped to a lower privilege level.
KKey Concepts to Remember
- Authentication checks who the user is.
- Authorization controls what the user is allowed to do after login.
- Privilege levels affect access to EXEC and configuration commands.
- AAA, TACACS+ and RADIUS can separate login success from command access.
TExam Day Tips
- Do not assume successful login means full administrative access.
- Look for words such as cannot enter configuration mode, privilege level, authorization or command access.
- Separate login problems from permission problems before choosing the answer.
Key takeaway
Authentication proves identity; authorization controls what that identity can do after login. Both must work for full privileged access.
Real-world example
How this comes up in practice
A junior network technician can log in to a core router but cannot reach the enable prompt or configuration mode. The AAA server is authenticating the login — but the authorisation policy only grants privilege level 1, not 15. Authentication (who you are) is working; authorisation (what you can do) is not.
What to study next
Got this wrong? Here's your next step.
Review Cisco AAA concepts — authentication, authorization, and accounting. Study privilege levels (0–15), command authorization under TACACS+, and how RADIUS differs. Then practise related 200-301 questions on access control and AAA configuration.
- →
AI and Network Operations — study guide chapter
Learn the concepts, then practise the questions
- →
AI and Network Operations practice questions
Targeted practice on this topic area only
- →
All 200-301 questions
1,819 questions across all exam domains
- →
CCNA 200-301 v2 study guide
Full concept coverage aligned to exam objectives
- →
200-301 practice test guide
How to use practice tests most effectively before exam day
Related practice questions
Related 200-301 practice-question pages
Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.
Network Infrastructure and Connectivity practice questions
Practise 200-301 questions linked to Network Infrastructure and Connectivity.
Switching and Network Access practice questions
Practise 200-301 questions linked to Switching and Network Access.
IP Routing practice questions
Practise 200-301 questions linked to IP Routing.
Network Services and Security practice questions
Practise 200-301 questions linked to Network Services and Security.
AI and Network Operations practice questions
Practise 200-301 questions linked to AI and Network Operations.
CCNA subnetting practice questions
Practise IPv4 subnetting, CIDR, masks, host ranges and subnet selection.
CCNA OSPF practice questions
Practise OSPF neighbours, router IDs, metrics, areas and routing-table interpretation.
CCNA VLAN practice questions
Practise VLANs, access ports, trunks, allowed VLANs and switching scenarios.
CCNA STP practice questions
Practise spanning tree, root bridge election, port roles and STP troubleshooting.
CCNA EtherChannel practice questions
Practise LACP, PAgP, port-channel behaviour and bundle requirements.
CCNA ACL practice questions
Practise standard and extended ACLs, permit/deny logic and traffic filtering.
CCNA NAT practice questions
Practise static NAT, dynamic NAT, PAT and inside/outside address translation.
Practice this exam
Start a free 200-301 practice session
Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.
FAQ
Questions learners often ask
What does this 200-301 question test?
AI and Network Operations — This question tests AI and Network Operations — Authentication checks who the user is..
What is the correct answer to this question?
The correct answer is: from netmiko import ConnectHandler connection = ConnectHandler(device_type='cisco_ios', ip='192.168.1.1', username='admin', password='cisco') connection.send_command('copy running-config tftp://192.168.1.100/r1-config', expect_string=r'\[confirm\]') connection.send_command('\n') connection.disconnect() — The 'copy running-config tftp://...' command in Cisco IOS prompts with '[confirm]'. To handle this interactively in netmiko, the expect_string must use a regular expression that matches the literal characters '[' and ']', which requires escaping them as '\[' and '\]'. The corrected script uses r'\[confirm\]' and then sends a newline to confirm, ensuring the backup completes. Options B and D fail to expect the prompt, and C uses an incorrect prompt match (expect_string=r'#' would only wait for the privileged EXEC prompt, missing the confirmation).
What should I do if I get this 200-301 question wrong?
Review Cisco AAA concepts — authentication, authorization, and accounting. Study privilege levels (0–15), command authorization under TACACS+, and how RADIUS differs. Then practise related 200-301 questions on access control and AAA configuration.
What is the key concept behind this question?
Authentication checks who the user is.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Last reviewed: Jun 7, 2026
This 200-301 practice question is part of Courseiva's free Cisco certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 200-301 exam.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.