Questions 9, 11, 15, 19, 24, 26, 29, 33, 35, 43, 52, 57, 63, 64, 65 all require
ID: 3858321 • Letter: Q
Question
Questions 9, 11, 15, 19, 24, 26, 29, 33, 35, 43, 52, 57, 63, 64, 65 all require pictures to answer, the link to the associated pictures is provided below
https://drive.google.com/open?id=0B8Jh4LT8NcplaGhTVFpJOEhLcU0
Question 23
What is the output of the above program
A. 21
B. A run time exception will occur during the run of this program
C. 212
D. The compiler will generate errors on lines 20, 21, 22
Question 24
Which line has an error in it (Check all that apply ... there is more than 1 line that needs to be checked)?
A. Line 10
B. Line 11
C. There are no errors
D. Line 8
E. Line 7
Question 26
Which of the following is true about this program?
A. It is illegal to create a private class derived from WindowAdapter.
B. When you click on the "X" box in the upper right corner, the program says Goodbye.
C. It won't compile because the code doesn't implement the other
WindowListener methods (i.e. WindowOpened, WindowActivated, etc.)
D. When you click on the "X" box in the upper right corner, the program throws a "Not Implemented" exception because not all WindowListener methods have been implemented.
Question 29
There is a run time error on which line Number?
A. Line 10
B. Line 8
C. Line 9
D. Line 7
E. No Errors
Question 32
Which data structures would be helpful for creating a stack type of data structure
A. HashMap
B. TreeSet
C. HashSet
D. ArrayList
Question 33
A. The output will be:
MI OH
B. A compile error occurs on the iterator call
(line number 11)
C. The output will be:
MI=Lansing OH=Columbus
D. The output will be:
Lansing Columbus
Question 35
What are the consequences of having this line commented out?
A. The System will throw an "Unhandled Mouse Click" exception when it discovers that the MouseListener is never connected.
B. A compile error will result once Eclipse discovers that it has a class that implements MouseListener, but this class is never passed to the system.
C. No Compile error or runtime error. However, when our code executes we will not be informed of Mouse clicks.
D. A runtime exception will occur when we exit the constructor, because the system will detect an unconnected MouseListener
A. 21
B. A run time exception will occur during the run of this program
C. 212
D. The compiler will generate errors on lines 20, 21, 22
Explanation / Answer
24)
A,B
Line 10, Line 11 has errors.
cannot add an object of type Test to ArrayList of type Integer
and cannot assign a type Integer to type String.
26)
B. When you click on the "X" box in the upper right corner, the program says Goodbye.
29)
A. Line 10
Integer cannot be casted to string.
32)
D.ArrayList
ArrayList can be used to implement a stack.
Stack is first in first out, so pushing can be done at the back and
popping can be done from the front.
33)
B. A compile error occurs on the iterator call.
It should be defined the following way.
Iterator<Map.Entry<String,String>> iter = list.entrySet().iterator();
35)
C. No Compile error or runtime error. However, when our code executes we will not be informed of Mouse clicks.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.