SDP-3

Descripción

Test sobre SDP-3, creado por Aibat Karashev el 17/01/2017.
Aibat Karashev
Test por Aibat Karashev, actualizado hace más de 1 año
Aibat Karashev
Creado por Aibat Karashev hace casi 8 años
428
1

Resumen del Recurso

Pregunta 1

Pregunta
What will be the output of the program?<br>
Respuesta
  • Pine
  • Oak
  • Tree
  • Forest
  • Oops

Pregunta 2

Pregunta
Select how you would run your program to cause it to print: Arg is 2 <br>
Respuesta
  • java Myfile 2 2 2
  • java Myfile 1 2 2 3 4
  • java Myfile 1 3 2 2
  • java Myfile 1 2 2 2
  • java Myfile 0 1 2 3

Pregunta 3

Pregunta
What is the prototype of the default constructor?<br>
Respuesta
  • Test()
  • Test
  • public Test()
  • public Test(void)
  • Test(void)

Pregunta 4

Pregunta
What is the widest valid returnType for methodA in line 3?<br>
Respuesta
  • int
  • long
  • byte
  • double
  • void

Pregunta 5

Pregunta
Which is valid in a class that extends class A?<br>
Respuesta
  • public int method1(int a, int b) {return 0; }
  • private int method1(int a, int b) {return 0; }
  • protected static int method1(int a, int b) {return 0; }
  • public long method1(int a, int b) {return 0; }
  • public static int method1(int a, int b) {return 0; }

Pregunta 6

Pregunta
What will be the output of the program?<br>
Respuesta
  • one two three four
  • one two three four one
  • four three two one
  • four one three two

Pregunta 7

Pregunta
What will be the output of the program?<br>
Respuesta
  • AC
  • ACD
  • BD
  • ABCD
  • ABD

Pregunta 8

Pregunta
What will be the output of the program after the running program in such way :/> java Test red green blue?<br>
Respuesta
  • baz =
  • baz = blue
  • baz = null
  • Runtime Exception
  • Compilation Error

Pregunta 9

Pregunta
What will be the output of the program? <br>
Respuesta
  • It will print the numbers from 0 to 19 sequentially
  • It will print the numbers from 1 to 20 sequentially
  • It will print the numbers from 0 to 19 but the order is not determined
  • It will print the numbers from 1 to 20 but the order is not determined
  • It will print the numbers from 0 to 9 two times, but the order is not determined

Pregunta 10

Pregunta
The following block of code creates a Thread using a Runnable target: <br> Which of the following classes can be used to create the target, so that the preceding code compiles correctly?
Respuesta
  • public class MyRunnable extends Runnable{public void run(){}}
  • public class MyRunnable extends Object{public void run(){}}
  • public class MyRunnable implements Runnable{public void run(){}}
  • public class MyRunnable implements Runnable{void run(){}}
  • public class MyRunnable implements Thread{void run(){}}

Pregunta 11

Pregunta
What will be the output of the program?<br>
Respuesta
  • AB
  • BC
  • BCD
  • ABC
  • ACD

Pregunta 12

Pregunta
Which of these will create and start this thread? <br>
Respuesta
  • new Runnable(MyRunnable).start();
  • new Thread(MyRunnable).run();
  • new Thread(new MyRunnable()).start();
  • new MyRunnable().start();
  • new Runnable(MyRunnable).run();

Pregunta 13

Pregunta
What will be an output? <br>
Respuesta
  • true true
  • true false
  • false true
  • false false
  • Runtime error will occur

Pregunta 14

Pregunta
What will be an output? <br>
Respuesta
  • 24
  • 30
  • 120
  • 720
  • Compilation Error

Pregunta 15

Pregunta
What will be an output? <br>
Respuesta
  • 1
  • 0
  • 5
  • 15
  • Compilation Error
  • Runtime Error

Pregunta 16

Pregunta
What will be an output? <br>
Respuesta
  • 1
  • 0
  • 12
  • 78
  • Compilation error
  • Runtime error

Pregunta 17

Pregunta
What will be the output of the program? <br>
Respuesta
  • Got the exception 10
  • Got the exception e
  • Compilation error
  • Runtime error

Pregunta 18

Pregunta
What will be the output of the program? <br>
Respuesta
  • Got the Test Exception
  • Inside finally block
  • Got the Test Exception <br> Inside finally block
  • Compilation error

Pregunta 19

Pregunta
What will be the output of the program? <br>
Respuesta
  • Compilation error
  • Compiles and runs fine
  • Compiles fine but throws ArithmeticException at runtime

Pregunta 20

Pregunta
What will be the output of the program? <br>
Respuesta
  • Caught base class exception
  • Caught derived class exception
  • Caught base class exception <br> Caught derived class exception
  • Compilation error because derived is not throwable
  • Compilation error because base class exception is caught before derived class

Pregunta 21

Pregunta
What will be the output of the program? <br>
Respuesta
  • Compilation error
  • Divide by zero error
  • inside the finally block
  • a = 0
  • a=0 <br> Divide by zero block <br> inside the finally block

Pregunta 22

Pregunta
What will be the output of the program?<br>
Respuesta
  • Compilation error
  • Runtime error
  • ArrayIndexOutOfBoundsException
  • ErrorCode is printed
  • Array is printed

Pregunta 23

Pregunta
What will be the output of the program? <br>
Respuesta
  • Derived::show() called
  • Base::show() called
  • Compilation error
  • Runtime error

Pregunta 24

Pregunta
What will be the output of the program? <br>
Respuesta
  • Derived::show() called
  • Base::show() called
  • Compilation error
  • Runtime error

Pregunta 25

Pregunta
What will be the output of the program? <br>
Respuesta
  • Base
  • Derived
  • Compilation error
  • Runtime error

Pregunta 26

Pregunta
What will be the output of the program? <br>
Respuesta
  • Compilation error in super.super.Print()
  • Grandparent’s print <br> Child’s Print()
  • Grandparent’s print <br> Parent’s Print <br> Child’s Print()
  • Runtime error

Pregunta 27

Pregunta
What will be the output of the program? <br>
Respuesta
  • Complex number is (10.0 + 15.0i)
  • Compilation error
  • Runtime error
  • Complex number is Complex@8e2fb5 (where 8e2fb5 is hash code of c)

Pregunta 28

Pregunta
What will be the output of the program? <br>
Respuesta
  • 20
  • 0
  • Compilation error
  • Runtime error

Pregunta 29

Pregunta
What will be the output of the program? <br>
Respuesta
  • s1 == s2 is: true
  • s1 == s2 is: false
  • true
  • false
  • compilation error
  • runtime exception

Pregunta 30

Pregunta
What will be the output of the following program? <br>
Respuesta
  • BD
  • ABDE
  • BCDE
  • BCD
  • BDE
  • ABCE
  • ABCD
  • ABD

Pregunta 31

Pregunta
What will be the output of the following code? <br>
Respuesta
  • hello caught finally after
  • hello throwit finally
  • hello throwit caught finally after
  • compilation fails
  • hello caught after
  • caught finally after

Pregunta 32

Pregunta
What will be the output of the program? <br>
Respuesta
  • finally
  • Compilation fails
  • exception finished
  • finally finished
  • finally exception finished
  • finally exception

Pregunta 33

Pregunta
What will be the output of the program? <br>
Respuesta
  • ABCD
  • ACD
  • ABD
  • BCD
  • BC
  • BD
  • CD

Pregunta 34

Pregunta
What will be the output of the program? <br>
Respuesta
  • Hello world
  • Hello world Finally executing
  • Finally executing
  • Nothing. The program will not compile because no exceptions are specified
  • Nothing. The program will not compile because no catch clauses are specified

Pregunta 35

Pregunta
What will be the output of the program? <br>
Respuesta
  • Ex0 caught
  • Exception caught
  • Compilation fails on line 2
  • Compilation fails on line 9
  • Compilation fails on line 11

Pregunta 36

Pregunta
What line of code should replace the missing statement to make this program compile? <br>
Respuesta
  • import java.io.*;
  • import java.io.PrintWriter
  • include java.io.*;
  • no statement required

Pregunta 37

Pregunta
What will be the output of the program?<br>
Respuesta
  • 0
  • error
  • Compilation fails
  • An uncaught exception is thrown at runtime
  • No output
  • / by 0

Pregunta 38

Pregunta
Given <br> <b> Note: The keyword "instanceof" is use to check whether an object is of a particular type</b><br>What is the result?
Respuesta
  • Will produce output as false
  • Compilation fails due to error at line 3
  • Compilation fails due to error at line 4
  • Length of this array is 3
  • Will produce output a true

Pregunta 39

Pregunta
What will be the output? <br>
Respuesta
  • Got the Test Exception<br> Inside finally block
  • Inside finally block
  • Got the Test Exception
  • Compilation fails

Pregunta 40

Pregunta
What will be the output? <br>
Respuesta
  • Caught base class exception
  • Caught derived class exception
  • Compiler error because derived is not throwable
  • Compiler error because base class exception is caught before derived class

Pregunta 41

Pregunta
What is the output of the following code segment? <br>
Respuesta
  • A
  • B
  • C
  • D or lower

Pregunta 42

Pregunta
What are the values of I and product after this code is executed? <br>
Respuesta
  • 9 and 366
  • 9 and 336
  • 8 and 42
  • 8 and 336

Pregunta 43

Pregunta
What is the output of the following code fragment? <br>
Respuesta
  • Error
  • 2 times Hello
  • 3 times Hello
  • No output will be produced
Mostrar resumen completo Ocultar resumen completo

Similar

Cantares Gallegos
anxosriv
Phrasal verbs
John Goalkeeper
Repaso de todos los temas de Literatura para Selectividad
Diego Santos
BELLAS ARTES
Benjamin Martinez
Pequeños Trucos para Leer Más en Menos Tiempo
Diego Santos
Sistema nervioso
Belén Lopera
E-UNAM-2012 HISTORIA DE MEXICO
ROSA MARIA ARRIAGA
Título I De los derechos y deberes fundamentales
Paco Tur Fornés
Parte General Código Penal
MJ Maza
Uso De Los Tiempos Verbales
Laura -
Medicina Forense
Alfonso Tester