Which of the following would you use to compare the result of investing $X a year for 6 years in three different banks that compound interest monthly? Assume a fixed rate for the 6-year period.
-
DO WHILE statement
-
nested DO loops
-
a DO group
-
DO UNTIL statement
B
Correct answer
Explanation
Evaluating the investment requires iterating across multiple dimensions: the three different banks, the six years of investment, and the twelve monthly compounding periods per year. Nested DO loops are necessary to handle these multiple levels of iteration, whereas single DO groups, DO WHILE, or DO UNTIL statements cannot easily manage multi-layered loops.