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
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 43
Which of the following is true about the following code
A. The program aborts with an exception B. A compile error at line 11 will occur because doit needs to surround the throw statement with try-catch logic, or change it's declaration to: void doit throws MyError1 | ||
C. The program will run and generate the output "Exception" | ||
D. The program will run and generate the output "MyError1" | ||
E. The program will run and generate the output "RuntimeException" |
Question 52
In the code below, we get a compile error at line 25.
Pick the code which replaces line 25 and fixes this compile error and uses the MyMouseHandler class to process Mouse Clicks.
A. this.addMouseListener();
B. addMouseListener(this.JFrame); | ||
C. MyMouseHandler mmh = new MyMouseHandler(); mmh.addMouseListener(); | ||
D. addMouseListener( new MyMouseHandler()); |
Question 57
Which of the following is true about the following code
A. A compile error at line 11 will occur because doit needs to surround the throw statement with try-catch logic, or change it's declaration to: void doit throws MyError1 B. The program aborts with an exception | ||
C. The program will run and generate the output "Exception" | ||
D. The program will run and generate the output "RuntimeException" | ||
E. The program will run and generate the output "MyError1" |
Question 63
1. Which statement is true about the following code
B. This code will not compile unless we catch the "FileNotFoundException" | ||
D. There is a compile error because ObjectOutputStream does not have a constructor which takes a FileOutputStream as it's only parameter. | ||
F. This will not compile unless the Data class implements the FileWriteable interface | ||
H. A compile error occurs because the Data class does not implement the methods in the Serializable interface | ||
J. A Binary file with the name of file.dat will be created that contains the binary contents of the array "arr" |
3 points
Question 64
1. On line 6, what happens if you remove the "implements Serializable"
a. The new line 6 would just be: class Data
D. A Binary file with the name of file.dat will be created that contains the binary contents of the array "arr" | ||
G. The ObjectOutputStream cannot be written because Data does not implement Serializable. An exception occurs instead. | ||
J. This code will not compile unless we catch the "FileNotFoundException" | ||
M. This will not compile unless the Data class implements the FileWriteable interface | ||
P. There is a compile error because ObjectOutputStream does not have a constructor which takes a FileOutputStream as it's only parameter. |
3 points
Question 65
1. Which statement is true about the following code
A. If the file abc.txt exists, this code will read the first string found on the line into the variable "s" | ||
B. A compile error occurs because we need to surround line 10 with try-catch logic to catch a "FileNotFoundException" | ||
C. If the file abc.txt exists, this code will read the first line of text into the variable "s" | ||
D. A compile error occurs because this code cannot throw an "IOException" |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started