CS FundamentalsVery hardProduct-company placement · GATE CS

A fragment contains `total = 0` immediately followed by `total = compute()`, with no use of total in between, and later `print(rate)` where rate has not yet been assigned. Which data-flow anomalies are these?

  1. A. du and dk
  2. B. dd (defined twice without use) and ur (used before defined)
  3. C. uu and dd
  4. D. ud and du

Correct answer: B. dd (defined twice without use) and ur (used before defined)

Two definitions with no intervening use (dd) suggest wasted or mistaken code; using a variable on a path where it is undefined (ur) is a real bug. Static data-flow analysis flags both without running the code.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic