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 62
} 
What is the result of attempting to compile and run the above program? 
a. Prints: 1,3 
b. Prints: 2,3 
c. Prints: 1,3 
d. Prints: 2,4 
e. Run time Exception 
f. Compiler Error 
g. None of the Above 
 
Question 2 
class Basics { 
 private static int x=1; 
 static void m(int i) {x++;i++;} 
 public static void main (String[] args) { 
 int y=3; 
 m(y); 
 System.out.println(x + "," + y); 
 } 
} 
What is the result of attempting to compile and run the above program? 
a. Prints: 1,3 
b. Prints: 2,3 
c. Prints: 1,3 
d. Prints: 2,4 
e. Run time Exception 
f. Compiler Error 
g. None of the Above 
 
Question 3 
interface A { 
 final void m6(); // 1 
 synchronized void m7(); // 2 
 strictfp void m8(); // 3 
 native void m9(); // 4 
} 
Compile-time errors are generated at which lines? 
a. 1 
b. 2 
c. 3 
d. 4 
e. None of the above. 
 
Question 4 
 
Which of the following are modifiers that can be applied to a method declaration within an interface? 
a. abstract 
b. final 
c. private 
d. protected 
e. public 
f. None of the above. 
 
Question 5 
interface A { 
 int a = 1; // 1 
 public int b = 2; // 2 
 public static int c = 3; // 3 
 public static final int d = 4; // 4 
} 
 
Which of the field declarations result in a compile-time error? 
a. 1 
b. 2 
c. 3 
d. 4 
e. None of the above. 
 
Question 6 
class L { 
 static String m(float i) {return "float";} 
 static String m(double i) {return "double";} 
 public static void main (String[] args) { 
 int a = 1; 
 long b = 2; 
 System.out.print(m(a)+","+ m(b)); 
 } 
} 
What is the result of attempting to compile and run the above program?

Mais conteúdos dessa disciplina