Which data flow anomaly can be found in this program?

Below is the pseudo-code for the Win program:

The bingo program contains a data flow anomaly.

Which data flow anomaly can be found in this program?
A . Variable ‘A" is not assigned a value before using it.
B . Variable ‘D" is defined but subsequently not used.
C . The program does not contain any comments.
D . It is recommended to use a variable instead of the hard-coded print results "Win" and *Loose".

Answer: B

Explanation:

The pseudo-code provided for the "Win" program reads in variables A, B, C, and D. However, only variables A, B, and C are used in the conditional statements to determine if the output will be "Win" or "Loose". Variable ‘D’ is never used after it is read, which is a classic example of a ‘defined but not used’ data flow anomaly. This means that while there is an instruction to read a value into variable ‘D’, there is no subsequent use of this variable in the program’s logic or output.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments