You have up to 25 minutes. You may use a calculator, but no text book or notes.
Carefully trace the following algorithm. What does it output? Be sure to mark a section of your answer as the output, separate from your scratch work.
step 1. Let N be 8
step 2. Set I to 1
step 3. If I > N then stop.
step 4. If I < 4 or I is odd, then output I
step 5. Set I to I+1
step 6. Go back to step 3.
For each type of statement below, indicate which step(s) from the algorithm in question 1 contain that type of statement.
Below is an illustration of an array and two other variables. What are the values of each of the following expressions?
A[0]
=A[X]
=A[Y]+1
=A[X+1]
=A[A[2]]
=