Skip to main content

Section 9.2 Arrays-WE1-P1

Subsection 9.2.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.2.2 Arrays-WE1-P1

Exercises Exercises

1.

Q1: Assume the following declarations:

2.

Q2: Assume the following declarations:

3.

    Q3: Which line produces the first compiler error?

  • double [] gamma = new double[5];

  • gamma[0] = 14;

  • gamma[1] = gamma[0];

  • gamma[gamma[0]] = 42;

  • gamma[5] = 22;

You have attempted of activities on this page.