Skip to main content

Section 11.7 Arrays-WE2-P4

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 11.7.1

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

Exercises Exercises

1.
Q26: The value of alpha[0] is .
2.
Q27: The value of alpha[1] is .
3.
Q28: The value of alpha[2] is .
4.
Q29: The value of alpha[3] is .
5.
Q30: The value of alpha[4] is .
You have attempted of activities on this page.