623
- float[][] someArray
- a.Nine thousand (10 10 10 9)
b. for(dim1 = 0 ; dim1 < SIZE; dim1++)
for(dim2 = 0 ; dim2 < SIZE; dim2++)
for(dim3 = 0 ; dim3 < SIZE; dim3++)
for(dim4 = 0 ; dim4 < SIZE – 1 ; dim4++)
quick[dim1][dim2][dim3][dim4] = ’ ';
- Representational errors can cause the loop termination condition to be evaluated with unpredictable
results.
- 400500.000 (actually, 4.005E+5)
- $39,144,932.11 $–27.00
- " #0.00%"
Exam Preparation Exercises
1.Given the declarations
final intNUM_SCHOOLS = 10 ;
final intNUM_SPORTS = 3 ;
int[][] kidsInSports = new int[NUM_SCHOOLS][NUM_SPORTS];
double[][] costOfSports = new double[NUM_SPORTS][NUM_SCHOOLS];
answer the following questions:
a.What is the number of rows in kidsInSports?
b.What is the number of columns in kidsInSports?
c. What is the number of rows in costOfSports?
d.What is the number of columns in costOfSports?
e.How many components does kidsInSportshave?
f. How many components does costOfSportshave?
g.What kind of processing (row or column) would be needed to total the
amount of money spent on each sport?
h.What kind of processing (row or column) would be needed to total the num-
ber of children participating in sports at a particular school?
2.Given the following code segments, draw the arrays and their contents after
the code is executed. Indicate any undefined values with the letter U.
a.int[][] exampleA;
exampleA = new int[ 4 ][ 3 ];
inti, j;
for(i = 0 ; i < 4 ; i++)
for(j = 0 ; j < 3 ; j++)
exampleA[i][j] = i * j;