Quiz 5
Wednesday
With a piece of paper, write down your name and answers to the following questions.
What is the value of
data[3][4]
in the following 2D array?int[][] data = new int[6][]; data[0] = new int[] {1, 2, 3, 4, 5}; data[1] = new int[] {6, 7, 8}; data[2] = new int[] {9, 10, 11, 12}; data[3] = new int[] {13, 14, 15, 16, 17, 18}; data[4] = new int[] {19, 20, 21, 22}; data[5] = new int[] {23, 24, 25, 26};
- 12
- 17
- 15
- Accessing
data[3][4]
generates an error.
Which of the following is not true about static members?
- It is not necessary for an instance of a class to be created to execute static methods or use static fields
- Static members are created by placing the keyword
static
in the definition. - A static method cannot access instance members of the class using the keyword
this
- Multiple separated instances of a static field may exist
What attribute does the
compareTo
method of anenum
use to compare twoenum
constants? E.g.,public class Program { public static void main(final String[] args) { int result = Gender.Female.compareTo(Gender.Male); : } } enum Gender { Confidential, Male, Female; }
Answer:
Ordinal
.Determine if the following statement is correct and why?
A problem can be solved recursively if it can be broken down into successive smaller problems that are different from the overall problem.
Answer: False, the successive smaller problems need to be the same as the overall problem
Student Performance and Statistics
A histogram of student performance on percentage grades for Quiz 5 on Wednesday.
A table showing the average performance for each question in Quiz 5 on Wednesday.