Quiz #2

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: