GoConqr has a new look! Let us know what you think.

Quiz

Week 6 Practice Quiz

Adam Peterson 12 questions

Take the quiz

Questions in this quiz (12)

  1. 1By default, Java initializes array elements with what value?
    1. A0
    2. B100
    3. C1
    4. D-1
  2. 2Each array in Java has a public field named ________ that contains the number of elements in the array.
    1. Asize
    2. Bcapacity
    3. Clength
    4. Dlimit
  3. 3For the following code, what would be the value of str[2]?

    String[] str = {"abc", "def", "ghi", "jkl"};
    1. A"ghi"
    2. B"def"
    3. CA reference to the String "ghi"
    4. DA reference to the S tring "def"
  4. 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:
    1. Astr.uppercase();
    2. Bstr[0].upperCase();
    3. Cstr.toUpperCase();
    4. Dstr[0].toUpperCase();
  5. 5In memory, an array of String objects:
    1. Aconsists of elements, each of which is a reference to a String object
    2. Bis always implemented as a ragged array
    3. Cconsists of elements, each of which is a String object
    4. Dmust be initialized when the array is declared
  6. 6In order to do a binary search on an array:
    1. Athe values of the array must be numeric
    2. Bthe array must first be sorted in ascending order
    3. Cyou must first do a sequential search of the array to assure the element you are looking for is there
    4. Dthere are no requirements
  7. 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?
    1. AImage for option A
    2. BImage for option B
    3. CImage for option C
    4. DImage for option D
  8. 8Which of the following is a correct method header for receiving a two-dimensional array as an argument?
    1. Apublic static void passArray(int[2])
    2. Bpublic static void passArray(int [][])
    3. Cpublic static void passArray(int[1][2])
    4. Dpublic static void passArray(int[], int[])
  9. 9Given the following two-dimensional array declaration, which statement is TRUE?

    int [][] numbers = new int [6] [9];
    1. AThe array numbers has 6 columns and 9 rows.
    2. BThe array numbers has 6 rows and 9 columns.
    3. CThe array numbers has 15 rows.
    4. DThe array numbers has 54 rows.
  10. 10If numbers is a two-dimensional array, which of the following would give the length of row r?
    1. Anumbers.length
    2. Bnumbers.length[r]
    3. Cnumbers[r].length[r]
    4. Dnumbers[r].length

Information

Description
CPSI 1413 Quiz on Week 6 Practice Quiz, created by Adam Peterson on 11/03/2019.
Language
English
Views
0
Rating
No ratings yet
Rate this quiz
Rate this quiz

Feedback

What is it about?

What do you think of the new look?

How do you like it?