QuestionQ17

VerifiedReviews

You have been tasked with reviewing the code shown below:

Question Image

Which defect type should be reported during the code review?

Explanation

The loop can be endless because A is updated as A - B without ensuring that B is positive. For B = 0, A never changes; for a negative B, A increases. In either case, an initially true A > B condition can remain true indefinitely.

Community Discussion

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