exam questions

Exam 98-388 All Questions

View all questions & answers for the 98-388 exam

Exam 98-388 topic 1 question 12 discussion

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

HOTSPOT -
You are creating a method that processes invoices. The invoices are contained in an ArrayList instance. After each invoice is processed, the method must remove the invoice from the ArrayList instance.
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://beginnersbook.com/2013/12/java-arraylist/

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
mtmoore
Highly Voted 4 years, 9 months ago
The last dropdown should be ")", if you use i=i+1 in this case it will skip over elements because the index of the elements in an arraylist change as elements are added or removed (if you had 3 elements and removed the 2nd element, you don't have elements with index 0 and index 2 left, you have 0 and 1 left). In other words, you actually want to perform this operation on the first item in the list (0) over and over again until the list is empty.
upvoted 5 times
Abhitera
4 years, 3 months ago
Correct
upvoted 2 times
...
...
Lordhoobla
Most Recent 4 years ago
For this question, there is no proper answer that is given. If there is a change in the step variable, the traversal process will be exclusive to certain values; if there was no step, the compiler would mark it as a syntax error. The correct way of typing it would be "i+=0". It bypasses the compiler while also not stepping up so every element is covered
upvoted 1 times
...
cmgal306
4 years, 5 months ago
Not really, since to actually have the for loop work correctly, it would need to add to the original integer. It wouldn't end if you didn't add onto it.
upvoted 2 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 ...