Quiz #2

Wednesday

With a piece of paper, write down your name and answers to the following questions.

  1. The index to the last element of an array is:

    1. 100
    2. 0
    3. The length of the array
    4. One less than the length of the array
  2. This search algorithm repeatedly divides the portion of an array being searched in half:

    1. Binary Search
    2. Sequential Search
    3. Selection Search
    4. Iterative Search
  3. This type of method cannot access any non-static member variables in its own class.

    1. instance
    2. void
    3. static
    4. non-static
  4. What is the output of the following program.

    public final class Program {
    	public static void main(final String[] args) {
    		final int[] numberArrayOne = new int[] { 1, 2, 3 };
    		final int[] numberArrayTwo = new int[] { 1, 2, 3 };
    		if (numberArrayOne == numberArrayTwo) {
    			System.out.println("YES");
    		} else {
    			System.out.println("NO");
    		}
    	}
    }

    Answer: NO

Student Performance and Statistics

A histogram of student performance on percentage grades for Quiz 2 on Wednesday.

100% 6 90 - 99% 0 80 - 89% 0 70 - 79% 5 60 - 69% 0 50 - 59% 7 40 - 49% 0 30 - 39% 0 20 - 29% 1 10 - 19% 0 0 - 9% 0

A table showing the average performance for each question in Quiz 2 on Wednesday.

Q1 0.9 / 1 Q2 0.6 / 1 Q3 0.7 / 1 Q4 0.5 / 1

Friday

With a piece of paper, write down your name and answers to for following questions.

  1. When initializing a two-dimensional array, you enclose each row's initialization list in:

    1. Braces
    2. Parentheses
    3. Brackets
    4. Quotation marks
  2. In this sorting algorithm, we look for the smallest element in a unsorted array and put it in the proper place.

    1. Insertion Sort
    2. Selection Sort
    3. Bubble Sort
    4. Merge Sort
  3. When an object is passed as an argument to a method, what is passed?

    1. A copy of the object
    2. The name of the object
    3. A reference to the object
    4. None of these; You cannot pass an object to a method
  4. If you write this method for a class, Java will automatically call it when you concatenate an object of this class with a string. What is this method called?

    Answer: The toString method.

  5. Find an error from the following code:

    int[] array = new array[10];
    for (int i = 0; i <= 10; i++) {
        array[i] = i;
    }

    Correction:

    int[] array = new array[10];
    for (int i = 0; i < 10; i++) {
        array[i] = i;
    }
w

Student Performance and Statistics

A histogram of student performance on percentage grades for Quiz 2 on Friday.

100% 0 90 - 99% 0 80 - 89% 2 70 - 79% 0 60 - 69% 5 50 - 59% 1 40 - 49% 2 30 - 39% 0 20 - 29% 3 10 - 19% 0 0 - 9% 0

A table showing the average performance for each question in Quiz 2 on Friday.

Q1 0.4 / 1 Q2 0.6 / 1 Q3 0.5 / 1 Q4 0.5 / 1 Q5 0.5 / 1