exam questions

Exam 350-401 All Questions

View all questions & answers for the 350-401 exam

Exam 350-401 topic 1 question 359 discussion

Actual exam question from Cisco's 350-401
Question #: 359
Topic #: 1
[All 350-401 Questions]

Refer to the exhibit.

Running the script causes the output in the exhibit. What should be the first line of the script?

  • A. from ncclient import manager
  • B. import manager
  • C. from ncclient import *
  • D. ncclient manager import
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
cvndani
Highly Voted 3 years, 4 months ago
Selected Answer: A
I think that the correct answer is A
upvoted 7 times
...
AbdullahMohammad251
Most Recent 9 months, 2 weeks ago
Selected Answer: A
To use a specific submodule or class from a Python library, you should import it using the correct syntax. In this case, you want to import the manager class from the ncclient library. The correct import statement is: 'from ncclient import manager' Option B: import manager This option is incorrect because it does not specify the module 'ncclient' to import 'manager.' Python would not recognize 'manager' without its module. Option C: 'from ncclient import *' This imports all public attributes from the 'ncclient' library, which is not ideal for clarity and can lead to potential conflicts. It is better practice to import only what you need explicitly. Option D: 'ncclient manager import' This option is syntactically incorrect in Python and would result in a syntax error.
upvoted 2 times
...
[Removed]
1 year ago
Selected Answer: A
A is correct
upvoted 1 times
...
HarwinderSekhon
1 year, 11 months ago
Selected Answer: A
A AND C ARE CORRECT BUT A IS MORE SPECIFIC.
upvoted 3 times
...
danman32
1 year, 11 months ago
This is a confusing aspect of Python. ncclient isn't a module but rather a package that contains the module manager (manager.py) The question is, would you get an error that the module could not be found if you only imported the package even if you called the function by its full package.module.function()? If so, then you would need "from ncclient import manager" Or you could 'import ncclient.manager" in which case when calling connect(), you would need the full path. https://www.programiz.com/python-programming/package
upvoted 2 times
...
XDR
2 years, 1 month ago
Selected Answer: A
It's a little bit tricky, you don't have to remove the first line: from ncclient import manager import ncclient This way works, so answer is A
upvoted 4 times
secretuser
1 year, 1 month ago
This is correct, you must leave import ncclient. If you only have "from ncclient import manager" the code must be updated to remove ncclient from the line "ncclient.manager.connect".
upvoted 1 times
...
...
M_Abdulkarim
2 years, 9 months ago
Selected Answer: A
I think Both A and C are correct, but import * will import unnecessary modules
upvoted 4 times
...
rlilewis
3 years ago
Selected Answer: A
https://ncclient.readthedocs.io/en/latest/ Multiple examples shown using "from ncclient import manager" and then using manager.connect
upvoted 4 times
...
rettich
3 years, 3 months ago
Selected Answer: A
See Link from CHGclimber
upvoted 2 times
...
bogd
3 years, 3 months ago
No answer seems correct - a "from" import would require "with manager.connect", but the code uses "with ncclient.manager.connect".
upvoted 3 times
...
CHGclimber
3 years, 3 months ago
I would recommend A: https://developer.cisco.com/codeexchange/github/repo/ncclient/ncclient/
upvoted 4 times
danman32
1 year, 10 months ago
Problem though is that with A, the snippet "with ncclient.manager.connect" would have to be "with manager.connect", which is what the github example has.
upvoted 1 times
...
...
Trust48
3 years, 4 months ago
Selected Answer: C
provided answer is correct
upvoted 3 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...