exam questions

Exam 98-381 All Questions

View all questions & answers for the 98-381 exam

Exam 98-381 topic 1 question 5 discussion

Actual exam question from Microsoft's 98-381
Question #: 5
Topic #: 1
[All 98-381 Questions]

You are developing a Python application for an online product distribution company.
You need the program to iterate through a list of products and escape when a target product ID is found.
How should you complete the code? To answer, select the appropriate code segments in the answer area.
NOTE: Each correct selection is worth one point.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:
References: https://www.w3resource.com/python/python-while-loop.php

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
Vaibhavdhingra24
Highly Voted 4 years, 10 months ago
doesn't matter what comes after else
upvoted 6 times
...
inomjon
Most Recent 2 years, 4 months ago
Answer true I think this codes true worked
upvoted 1 times
...
PavanKumpatlaAccountTwo
3 years, 3 months ago
My code:- productIdList = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] index = 0 while (index < 0): print(productIdlist[index]) if productIdlist[index] == 6: break else: index += 1
upvoted 1 times
PavanKumpatlaAccountTwo
3 years, 3 months ago
Wait, made a mistake:- productIdList = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] index = 0 while (index < 10): print(productIdlist[index]) if productIdlist[index] == 6: break else: index += 1
upvoted 2 times
...
...
Shw7
3 years, 9 months ago
Working Code: pL = [0,1,2,3,4,5,6,7,8,9] index = 0 while index < 10: print(pL[index]) if pL[index] == 6: break else: index += 1
upvoted 1 times
...
JeffJupiter
4 years, 10 months ago
increment index by 1 comes in the else block
upvoted 3 times
...
ASTROW
4 years, 11 months ago
does anyone know what comes after the else?
upvoted 3 times
nowisthetime
4 years, 9 months ago
index+=1
upvoted 4 times
...
...
grassie
4 years, 11 months ago
what would come after the "else"?
upvoted 2 times
omi773
2 years, 4 months ago
index +=1
upvoted 1 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