CS FundamentalsModerateCognizant · Capgemini pattern

A sequence diagram shows a loop combined fragment labelled `loop [for each item in cart]` wrapping a single message `validateItem(item)` sent from Checkout to Validator. What does this fragment mean?

  1. A. validateItem(item) is sent exactly once, and 'loop' is purely a comment
  2. B. The entire sequence diagram repeats, including messages outside the fragment
  3. C. Loop fragments are not valid inside sequence diagrams
  4. D. The validateItem(item) message is sent once per item in the cart, repeating for the guard's iteration condition, not just once

Correct answer: D. The validateItem(item) message is sent once per item in the cart, repeating for the guard's iteration condition, not just once

A loop combined fragment repeats its enclosed interaction for each iteration described by its guard; here Checkout calls validateItem once per cart item, not once overall.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic