QuestionQ49

VerifiedStatic and Dynamic Analysis

The following pseudo-code calculates a customer’s cruise credits using their prior cruise history:

Question Image

The code has data-flow anomalies on lines 14 and 27. Which data-flow anomaly examples occur on those lines?

Explanation

Line 14 uses CRUISE_CREDITS as an operand in CRUISE_CREDITS + 5 before it has been assigned an initial value. Line 27 assigns a value to LOYALTY_RATING, but no later statement uses that value, making it a definition that is not subsequently used.

Community Discussion

No comments yet. Be the first to start the discussion!