Logo Passei Direto
Buscar

Questões para Certificação JAVA 1 4_pag24

Ferramentas de estudo

Material
páginas com resultados encontrados.
páginas com resultados encontrados.

Prévia do material em texto

Certified Java Programmer Mock Exam 24
g. Prints: fffffffe,fffffffe,ffffffff 
h. Prints: fffffffe,fffffffe,fffffffe 
i. Runtime error 
j. Compiler error 
k. None of the above 
 
Question 3 
class V { 
 public static void main (String[] args) { 
 System.out.print((0.0 % -1)+","+(-0.0 % 1)+","+(-0.0 % -1)); 
 } 
} 
What is the result of attempting to compile and run the above program? 
a. Prints: 0.0,0.0,0.0 
b. Prints: 0.0,0.0,-0.0 
c. Prints: 0.0,-0.0,0.0 
d. Prints: 0.0,-0.0,-0.0 
e. Prints: -0.0,0.0,0.0 
f. Prints: -0.0,0.0,-0.0 
g. Prints: -0.0,-0.0,0.0 
h. Prints: -0.0,-0.0,-0.0 
i. Runtime error 
j. Compiler error 
k. None of the above 
 
Question 4 
class Color {} 
class Red extends Color {} 
class Blue extends Color {} 
class A { 
 public static void main (String[] args) { 
 Color c1 = new Red(); 
 Color c2 = new Blue(); 
 Red r1 = new Red(); 
 boolean b1 = c1 instanceof Color; 
 boolean b2 = c1 instanceof Blue; 
 boolean b3 = r1 instanceof Blue; 
 System.out.print(b1+","+b2+","+b3); 
 } 
} 
What is the result of attempting to compile and run the above program? 
a. false,false,false 
b. false,false,true 
c. false,true,false 
d. false,true,true 
e. true,false,false 
f. true,false,true 
g. true,true,false 
h. true,true,true 
i. Runtime error 
j. Compiler error 
k. None of the above 
 
Question 5 
class W { 
 public static void main (String[] args) { 
 byte x = 3; 
 byte y = 5; 
 System.out.print((-x == ~x + 1)+","+(-y == ~y + 1)); 
 } 
} 
What is the result of attempting to compile and run the above program? 
a. Prints: false,false 
b. Prints: false,true 
c. Prints: true,false 
d. Prints: true,true 
e. Runtime error 
f. Compiler error 
g. None of the above 
 
Question 6 
class A { 
 public static void main (String[] args) { 
 int a = 1 | 2 ^ 3 & 5; 
 int b = ((1 | 2) ^ 3) & 5; 
 int c = 1 | (2 ^ (3 & 5)); 
 System.out.print(a + "," + b + "," + c); 
 } 
}

Mais conteúdos dessa disciplina