exam questions

Exam 350-901 All Questions

View all questions & answers for the 350-901 exam

Exam 350-901 topic 1 question 132 discussion

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


Refer to the exhibit. A Python script has these requirements:
✑ Retrieve a list of Bluetooth clients seen by the access points on a network.
✑ Print the content of the response.
✑ Retrieve the next page only if it is available in the response headers.
What must be added where the code is missing to get the remaining pages by using the next link from the link response header of the last request?
A.

B.

C.

D.

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
testingrealname
Highly Voted 2 years, 1 month ago
Def is not C or D you can't use if to check if it is 'equal to' with a single "=", the comparing object in python for 'equal to' is "==", so the best answer here is A! https://realpython.com/python-is-identity-vs-equality/#comparing-equality-with-the-python-and-operators B is not cuz links['url'] will fail, there is a drag and drop similar questions with this example, compare and you will know that A is the right one to use here. https://stackoverflow.com/questions/32312758/python-requests-link-headers Those that says C is the right one, please study a bit more python.
upvoted 10 times
moin_master
2 years, 1 month ago
That is a conditional None-Check not a comparison. If there is no next url given it won't proceed...
upvoted 1 times
testingrealname
2 years, 1 month ago
A and B are conditional None-Check, if you think C and D is a conditional None-Check you really need to study and practice more, because the single '=' will cause a syntax error: test = [{ 'rel' : "first"},{ 'rel' : "next"}] if test[0]['rel'] = "some": print("true") File "<string>", line 2 if test[0]['rel'] = "some": ^ SyntaxError: invalid syntax >
upvoted 1 times
...
...
...
Teringzooi
Highly Voted 1 year, 8 months ago
Correct answer: A - check the content of the "Link" header. - if present, use it's value as URL for the next iteration - if not, break the loop (header won't be present in the last batch) if response.links.get('next') url=response.links["next"]["url"] https://stackoverflow.com/questions/32312758/python-requests-link-headers
upvoted 5 times
...
luckymuki
Most Recent 1 week, 1 day ago
A is correct answer. Compare with question #134
upvoted 1 times
...
Marc_Pr
2 months, 1 week ago
Correct answer seems to be C (although the = must be == which seems to be wrong in the answer). Links is a list, therefore you can't perform a .get operation on it (which only works on a dictionary). You first need to get the first item of the list ([0]) which is a dictionary. D does not make sense, else there is no embedded dictionary in a dictionary.
upvoted 1 times
...
designated
1 year, 9 months ago
A is correct: # check the content of the "Link" header. # if present, use it's value as URL for the next iteration # if not, break the loop (header won't be present in the last batch) if response.links.get('next') url=response.links["next"]["url"]
upvoted 4 times
...
QuiShong
1 year, 12 months ago
This should be A. C and D are completely invalid. Also, links should be a dict, not a list if I'm correct.
upvoted 2 times
...
CiscoRider
2 years ago
I agree with testingrealname. The correct answer is A.
upvoted 2 times
...
__al__
2 years, 2 months ago
to me, looks like C
upvoted 1 times
...
dexilec82
2 years, 3 months ago
At first I choose D but then I realized the response.link is not a variable but a value so cannot do the dot notation method I guess, I think I am getting the hang of python syntax lol so C is the correct answer.
upvoted 2 times
...
entropicBoy
2 years, 4 months ago
Not C, = is not a valid comaparator, and position 0 is for firt, not next.
upvoted 1 times
entropicBoy
2 years, 4 months ago
it´s A. https://stackoverflow.com/questions/32312758/python-requests-link-headers
upvoted 6 times
...
...
duracell
2 years, 5 months ago
C is correct.
upvoted 4 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