CS 1 AP Worksheet – Arrays
CS 1 AP Worksheet – Arrays
Name________________________
Use the following program segment to answer questions 1-10:
...
public static void main(String [] args){
int [] N1 = new int[10];
double [] N2 = new double[24];
char [] N3 = new char[17];
int [] N4 = new int[10];
...
}
1. The subscripts of array N3 are of type_____________
2. The elements of array N2 are of type ______________
3. The elements of array N4 are assigned the value______
4. How many elements (values) can array N1 contain? _____
5. How many elements (values) can array N2 contain? _____
6. How many elements (values) can array N3 contain? _____
7. How many elements (values) can array N4 contain? _____
8. How would you assign the value ‘B’ to the first position in N3?
9. How would you assign the value of 100 to each element in N1?
10. How would you assign the value 13.5 to the 3rd location in N2?
Use this declaration and diagram to answer #11 – 15:
int[] Ex = new int[7];
Ex
|13 |43 |76 |31 |45 |91 |0 |
11. What is the output for System.out.print(Ex[1]);? ____________
12. What is the output for System.out.print(Ex[3]);? ____________
13. What is the output for System.out.print(Ex[5]);? ____________
14. What is the output for System.out.print(Ex[7]);? ____________
15. What is the output for System.out.print(Ex[0]);? ____________
Fill in the arrays below:
16. Ex
| | | | | | | |
N=0;
for(k = 2; k ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- 13.1 rna worksheet answer key
- 4 1 climate worksheet answer key
- 13 1 rna worksheet answer key
- 13 1 rna worksheet answers biology
- unit 1 ap psychology test
- 13 1 rna worksheet answers
- 4 1 climate worksheet answers
- trace 1 10 worksheet printable
- unit 1 ap chem
- arrays worksheet grade 2
- 2nd grade arrays worksheet free
- arrays worksheet free