Test
Week 6 Practice Quiz
Crea una cuenta gratis para terminar este test
Guarda tu progreso y consulta tu resultado final.
¿Ya tienes cuenta? Inicia sesión
Preguntas del test (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
Información
- Descripción
- CPSI 1413 Test sobre Week 6 Practice Quiz, creado por Adam Peterson el 11/03/2019.
- Autor
- Adam Peterson
- Idioma
- English
- Visitas
- 0
- Etiquetas
- Valoración
- Aún sin valoraciones Valora este test