exam questions

Exam JN0-221 All Questions

View all questions & answers for the JN0-221 exam

Exam JN0-221 topic 1 question 20 discussion

Actual exam question from Juniper's JN0-221
Question #: 20
Topic #: 1
[All JN0-221 Questions]

Which Python code block is an example of a context manager?

  • A. while True: device "" Device(host-"vmx-1", user-"lab", passwd-"lab123") ...
  • B. try: device "" Device(host-"vmx-1", user-"lab", passwd-"lab123") ... except: print("Unable to connect to the vMX1")
  • C. with Device(host="vmx-1", user="lab", passwd="lab123") as device: ...
  • D. for host in ["vmx-1", "vmx-2"]: device "" Device(host-host, user-"lab", passwd-"lab123") ...
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

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
shiiitboi
Highly Voted 4 years, 2 months ago
Option C is the correct answer
upvoted 5 times
...
exam_study
Most Recent 3 years, 4 months ago
Selected Answer: C
The “open” builtin function Python was implemented to support the Context Manager protocol (called using “with”).
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 ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago