Skip to main content

Section 10.4 Arrays-WE2-P1

Subgoals for Evaluating Arrays.

  1. Set up array from 0 to size-1
  2. Evaluate data type of statements against array
  3. Trace statements, updating slots as you go
    1. Remember assignment subgoals

Subsection 10.4.1

Assume the following given declarations:
int [] alpha;
Give the contents of alpha after the execution of these statements.
alpha = new int[10];
for (int i = 0; i < 10; i++)
    alpha[i] = i * i;

Exercises Exercises

1.
Q4: Enter the values of alpha in the blanks.
The value of alpha[0] is .
2.
Q5: Enter the values of alpha in the blanks.
The value of alpha[1] is .
3.
Q6: Enter the values of alpha in the blanks.
The value of alpha[2] is .
4.
Q7: Enter the values of alpha in the blanks.
The value of alpha[3] is .
5.
Q8: Enter the values of alpha in the blanks.
The value of alpha[4] is .
6.
Q9: Enter the values of alpha in the blanks.
The value of alpha[5] is .
7.
Q10: Enter the values of alpha in the blanks.
The value of alpha[6] is .
8.
Q11: Enter the values of alpha in the blanks.
The value of alpha[7] is .
9.
Q12: Enter the values of alpha in the blanks.
The value of alpha[8] is .
10.
Q13: Enter the values of alpha in the blanks.
The value of alpha[9] is .
You have attempted of activities on this page.