A continuación tienes las preguntas relacionadas con este capítulo del curso.
Cuestionario 8. 1Z0-808
Resumen del Cuestionario
0 of 8 Preguntas completed
Preguntas:
Información
Ya has completado el cuestionario anteriormente. Por lo tanto no puedes iniciarlo de nuevo.
Cargando Cuestionario…
Debes iniciar sesión o registrarte para empezar el cuestionario.
En primer lugar debes completar esto:
Resultados
Resultados
0 de 8 Preguntas respondidas correctamente
Tu tiempo:
El tiempo ha pasado
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
Categorías
- Sin categorizar 0%
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- Actual
- Revisar
- Respondido/a
- Correcto
- Incorrecto
- Pregunta 1 de 8
1. Pregunta
public class Triangle { static double area; int b = 2, h = 3; public static void main(String[] args) { double p, b, h; // line n1 if (area == 0) { b = 3; h = 4; p = 0.5; } area = p * b * h; // line n2 System.out.println("Area is " + area); } }
What is the result?
CorrectoIncorrecto - Pregunta 2 de 8
2. Pregunta
Given the code fragment:
public class Test { public static void main(String[] args) { // line n1 switch (x) { case 1: System.out.println("One"); break; case 2: System.out.println("Two"); break; } } }
Which three code fragments can be independently inserted at line nl to enable the code to print one?
CorrectoIncorrecto - Pregunta 3 de 8
3. Pregunta
public class App { public static void main(String[] args) { Boolean[] bool = new Boolean[2]; bool[0] = new Boolean(Boolean.parseBoolean("true")); bool[1] = new Boolean(null); System.out.println(bool[0] + " " + bool[1]); } }
What is the result?
CorrectoIncorrecto - Pregunta 4 de 8
4. Pregunta
Given the following code for the classes MyException and Test:
MyException.java public class MyException extends RuntimeException{ }
================================================================
Test.java public class Test { public static void main(String[] args) { try { method1(); } catch (MyException ne) { System.out.print("A"); } } public static void method1() { // line n1 try { throw Math.random() > 0.5 ? new MyException() : new RuntimeException(); } catch (RuntimeException re) { System.out.print("B"); } } }
What is the result?
CorrectoIncorrecto - Pregunta 5 de 8
5. Pregunta
Given:
public class App { String myStr = "7007"; public void doStuff(String str) { int myNum = 0; try { String myStr = str; myNum = Integer.parseInt(myStr); } catch (NumberFormatException ne) { System.err.println("Error"); } System.out.println("myStr: " + myStr + ", myNum: " + myNum); } public static void main(String[] args) { App obj = new App(); obj.doStuff("9009"); } }
What is the result?
CorrectoIncorrecto - Pregunta 6 de 8
6. Pregunta
Which two are benefits of polymorphism?
CorrectoIncorrecto - Pregunta 7 de 8
7. Pregunta
Given the code fragment:
int nums1[] = new int[3]; int nums2[] = {1,2,3,4,5}; nums1 = nums2; for(int x : nums1){ System.out.print(x + ":"); }
What is the result?
CorrectoIncorrecto - Pregunta 8 de 8
8. Pregunta
Given:
public class Product { int id; String name; public Product(int id, String name) { this.id = id; this.name = name; } }
And given the code fragment:
public static void main(String[] args) { Product p1 = new Product(101, "Pen"); Product p2 = new Product(101, "Pen"); Product p3 = p1; boolean ans1 = p1 == p2; boolean ans2 = p1.name.equals(p2.name); System.out.print(ans1 + ":" + ans2); }
What is the result?
CorrectoIncorrecto