Skip to main content

Section 9.7 Arrays-WE2-P4

Subsection 9.7.1 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 9.7.2 Arrays-WE2-P4

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 |blank|.
2.
Q27: The value of alpha[1] is |blank|.
3.
Q28: The value of alpha[2] is |blank|.
4.
Q29: The value of alpha[3] is |blank|.
5.
Q30: The value of alpha[4] is |blank|.
You have attempted of activities on this page.