Skip to main content

Section 10.5 Arrays-WE2-P2

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.5.1

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

Exercises Exercises

1.
Q14: The value of beta[0] is .
2.
Q15: The value of beta[1] is .
3.
Q16: The value of beta[2] is .
4.
Q17: The value of beta[3] is .
5.
Q18: The value of beta[4] is .
6.
Q19: The value of beta[5] is .
You have attempted of activities on this page.