Prévia do material em texto
Certified Java Programmer Mock Exam 48
catch (Exception e) {f++;}
finally {g++;}
System.out.print(a+","+b+","+c+","+d+","+f+","+g);
}
}
What is the result of attempting to compile and run the program?
a. Prints: 0,0,0,1,0,0
b. Prints: 0,0,1,1,0,1
c. Prints: 0,1,1,1,0,1
d. Prints: 1,0,1,1,0,1
e. Prints: 1,1,1,1,0,1
f. Compiler Error
g. Run Time Error
h. None of the Above
Question 9
1. class A {
2. void m1() {throw new ClassNotFoundException();}
3. void m2() {throw new CloneNotSupportedException();}
4. void m3() {throw new IllegalAccessException();}
5. void m4() {throw new InstantiationException();}
6. void m5() {throw new InterruptedException();}
7. void m6() {throw new NoSuchMethodException();}
8. }
What is the result of attempting to compile the program?
a. Compiler error at line 2.
b. Compiler error at line 3.
c. Compiler error at line 4.
d. Compiler error at line 5.
e. Compiler error at line 6.
f. Compiler error at line 7.
g. None of the Above
Question 10
class A {
public static void main (String[] args) {
Object error = new Error();
Object runtimeException = new RuntimeException();
System.out.print((error instanceof Exception) + ",");
System.out.print(runtimeException instanceof Exception);
}
}
What is the result of attempting to compile and run the program?
a. Prints: false,false
b. Prints: false,true
c. Prints: true,false
d. Prints: true,true
e. Compiler Error
f. Run Time Error
g. None of the Above
Question 11
class Red {
public static void main(String args[]) {
for (int i = 0; i