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.
N: 8I: 1
2
3
5
7For 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] = 3A[X] = A[2] = 4A[Y]+1 = A[5]+1 = 7+1 = 8A[X+1] = A[2+1] = A[3] = 0A[A[2]] = A[4] = 2