Quiz
Week 6 Practice Quiz
Create a free account to finish this quiz
Save your progress and see your final score.
Already have an account? Sign in
Questions in this quiz (12)
1By default, Java initializes array elements with what value?
- A0
- B100
- C1
- D-1
2Each array in Java has a public field named ________ that contains the number of elements in the array.
- Asize
- Bcapacity
- Clength
- Dlimit
3For the following code, what would be the value of str[2]?
String[] str = {"abc", "def", "ghi", "jkl"};- A"ghi"
- B"def"
- CA reference to the String "ghi"
- DA reference to the S tring "def"
4Given that String[] str has been initialized, to get a copy of str[0] with all characters converted to upper case, use the following statement:
- Astr.uppercase();
- Bstr[0].upperCase();
- Cstr.toUpperCase();
- Dstr[0].toUpperCase();
5In memory, an array of String objects:
- Aconsists of elements, each of which is a reference to a String object
- Bis always implemented as a ragged array
- Cconsists of elements, each of which is a String object
- Dmust be initialized when the array is declared
6In order to do a binary search on an array:
- Athe values of the array must be numeric
- Bthe array must first be sorted in ascending order
- Cyou must first do a sequential search of the array to assure the element you are looking for is there
- Dthere are no requirements
7If numbers is a two-dimensional int array that has been initialized and total is an int that has been set to 0, which of the following will sum all the elements in the array?
- A

- B

- C

- D

- A
8Which of the following is a correct method header for receiving a two-dimensional array as an argument?
- Apublic static void passArray(int[2])
- Bpublic static void passArray(int [][])
- Cpublic static void passArray(int[1][2])
- Dpublic static void passArray(int[], int[])
9Given the following two-dimensional array declaration, which statement is TRUE?
int [][] numbers = new int [6] [9];- AThe array numbers has 6 columns and 9 rows.
- BThe array numbers has 6 rows and 9 columns.
- CThe array numbers has 15 rows.
- DThe array numbers has 54 rows.
10If numbers is a two-dimensional array, which of the following would give the length of row r?
- Anumbers.length
- Bnumbers.length[r]
- Cnumbers[r].length[r]
- Dnumbers[r].length
11If numbers is a two-dimensional array, which of the following would give the length of row r?
- Anumbers.length
- Bnumbers.length[r]
- Cnumbers[r].length[r]
- Dnumbers[r].length
12In Java, you do not use the new operator when you use a(n):
- Aarray size declarator
- Binitialization list
- Ctwo-dimensional array
- DAll of these
Information
- Description
- CPSI 1413 Quiz on Week 6 Practice Quiz, created by Adam Peterson on 11/03/2019.
- Author
- Adam Peterson
- Language
- English
- Views
- 0
- Tags
- Rating
- No ratings yet Rate this quiz