Homework : Due December 9th
Read chapter 7, section 7.9
- What is a two-dimensional array?
- How many subscripts do you need to access an element of a two-dimensional array?
- Read about initializing a two-dimensional array.
- Given:
int [][] array = { {1,2,3}, {4,5,6} };
- How many rows does the array have?
- How many columns does the array have?
- Give the name of the field that represents the number of rows?
- Give the name of the field that represents the number of columns in
the row with subscript 0.
- Write the code (calling statement) to pass the array in question 4 to a
method called sumArray that will return the sum of the array passed.
- Write method sumArray.
- Complete Multiple Choice and True/False: questions 10 and 21
- Complete Algorithm Workbench: 6-10
- Complete Short Answer 9.
- Given: int[][] values = new int[4][5].
Write a nested loop to set values as follows:
[0] [1] [2] [3] [4]
[0] 1 2 3 4 5
[1] 1 2 3 4 5
[2] 1 2 3 4 5
[3] 1 2 3 4 5
- Given: int[][] values = new int[4][5].
Write a nested loop to set values as follows:
[0] [1] [2] [3] [4]
[0] 0 1 2 3 4
[1] 1 2 3 4 5
[2] 2 3 4 5 6
[3] 3 4 5 6 7
- Given: int[][] matrix = new int[5][5].
Write a nested loop to set matrix as follows:
[0] [1] [2] [3] [4]
[0] 1 0 0 0 0
[1] 0 1 0 0 0
[2] 0 0 1 0 0
[3] 0 0 0 1 0
[4] 0 0 0 0 1
Email Me |
Office Hours |
My Home Page |
Department Home |
MCC Home Page
© Copyright Emmi Schatz 2013