Logo Passei Direto
Buscar
Material
páginas com resultados encontrados.
páginas com resultados encontrados.

Prévia do material em texto

Certified Java Programmer Mock Exam 53
 try { 
 white.m1(); 
 a++; 
 } catch (WhiteException e) {b++;} 
 finally {c++;} 
 System.out.print(a+","+b+","+c); 
 } 
} 
What is the result of attempting to compile and run the program? 
a. Prints: 0,0,0 
b. Prints: 0,0,1 
c. Prints: 0,1,0 
d. Prints: 0,1,1 
e. Prints: 1,0,0 
f. Prints: 1,0,1 
g. Prints: 1,1,0 
h. Prints: 1,1,1 
i. Compiler Error 
j. Run Time Error 
k. None of the Above 
 
Question 6 
class Level1Exception extends Exception {} 
class Level2Exception extends Level1Exception {} 
class Level3Exception extends Level2Exception {} 
class Purple { 
 public static void main(String args[]) { 
 int a,b,c,d,f,g,x; 
 a = b = c = d = f = g = 0; 
 x = 4; 
 try { 
 try { 
 switch (x) { 
 case 1: throw new Level1Exception(); 
 case 2: throw new Level2Exception(); 
 case 3: throw new Level3Exception(); 
 case 4: throw new Exception(); 
 } 
 a++; 
 } 
 catch (Level2Exception e) {b++;} 
 finally{c++;} 
 } 
 catch (Level1Exception e) { d++;} 
 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,0,0,1 
b. Prints: 0,0,0,0,1,0 
c. Prints: 0,0,1,0,0,1 
d. Prints: 0,0,1,0,1,1 
e. Prints: 0,1,1,1,1,1 
f. Prints: 1,1,1,1,1,1 
g. Compiler Error 
h. Run Time Error 
i. None of the Above 
 
Question 7 
class A { 
 public static void main(String[] args) { 
 boolean b = true; 
 if (b = false) { 
 System.out.print("A"); 
 } else if (b) { 
 System.out.print("B"); 
 } else { 
 System.out.print("C"); 
 } 
 } 
} 
What is the result of attempting to compile and run the above program? 
a. Prints: A 
b. Prints: B 
c. Prints: C 
d. Runtime Exception 
e. Compiler Error

Mais conteúdos dessa disciplina