Quiz #2
Friday
With a piece of paper, write down your name and answers to for following questions.
When initializing a two-dimensional array, you enclose each row's initialization list in:
- Braces
- Parentheses
- Brackets
- Quotation marks
In this sorting algorithm, we look for the smallest element in a unsorted array and put it in the proper place.
- Insertion Sort
- Selection Sort
- Bubble Sort
- Merge Sort
When an object is passed as an argument to a method, what is passed?
- A copy of the object
- The name of the object
- A reference to the object
- None of these; You cannot pass an object to a method
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.Find an error from the following code: