CSIS 212 FINAL EXAM - QUESTION AND ANSWERS
CSIS 212 FINAL EXAM - QUESTION AND ANSWERS • Question 1 3 out of 3 points Which statement below could be used to simulate the outputs of tossing a quarter to get heads or tails? Suppose randomNumbers is a SecureRandom object. Selected Answer: randomNInt(2); • Question 2 3 out of 3 points Overloaded methods always have the same _________. Selected Answer: method name • Question 3 3 out of 3 points The identifiers in an enumeration ________. Selected Answer: must be unique. • Question 4 3 out of 3 points Declaring main as static allows the JVM to invoke main ________. Selected Answer: without creating an instance of the class in which main is declared. • Question 5 3 out of 3 points Variables should be declared as fields only if ________. Selected Answer: they are required for use in more than one method or their values must be saved between calls to the class’s methods • Question 6 3 out of 3 points The package contains classes for manipulating all of the following items except ________. Selected Answer: classes • Question 7 3 out of 3 points Which set of statements totals the items in each row of two-dimensional array items, and displays each row’s total? Selected Answer: for (int row = 0; row < h; row++) { int total = 0; for (int column = 0; column < items[row].length; column++) { total += items[row][column]; Sf("Row %d's total is %d%n", row, total); } • Question 8 3 out of 3 points Which of the following statements is false? Selected Answer: When an argument is passed by reference, the called method can access the argument’s value in the caller directly but cannot modify it. • Question 9 3 out of 3 points A programmer must do the following before using an array: Selected Answer: declare then create the array. • Question 10 0 out of 3 points How many Book objects are created by the following statement? Book[] books = new Book[10]; Selected Answer: None of the above. • Question 11 3 out of 3 points In Java, multidimensional arrays ________. Selected Answer: All of the above. • Question 12 3 out of 3 points What do the following statements do? double[] array; array = new double[14]; Selected Answer: Create a double array containing 14 elements. • Question 13 3 out of 3 points A constructor cannot: Selected Answer: specify return types or return values. • Question 14 3 out of 3 points Constructors: Selected Answer: Both (a) and (c). • Question 15 3 out of 3 points Which syntax imports all static members of class Math? Selected Answer: import static .Math.*. • Question 16 3 out of 3 points Using public set methods helps provide data integrity if: Selected Answer: Both b and c. • Question 17 3 out of 3 points Instance variables declared final do not or cannot: Selected Answer: Be modified after they are initialized. • Question 18 3 out of 3 points When no access modifier is specified for a method or variable, the method or variable: Selected Answer: Has package access. • Question 19 3 out of 3 points Overriding a method differs from overloading a method because: Selected Answer: Overridden methods have the same signature. • Question 20 3 out of 3 points Which statement is true when a superclass has protected instance variables? Selected Answer: All of the above. • Question 21 3 out of 3 points Which of the following statements is false?
Written for
Document information
- Uploaded on
- January 17, 2022
- Number of pages
- 8
- Written in
- 2021/2022
- Type
- Exam (elaborations)
- Contains
- Questions & answers
Subjects
-
csis 212 final exam question and answers • question 1 3 out of 3 points which statement below could be used to simulate the outputs of tossing a quarter to get heads or tails suppose randomnumbers