Cuestiones
ayuda
option
Mi Daypo

TEST BORRADO, QUIZÁS LE INTERESEPractice Test (Sessions 1-4)

COMENTARIOS ESTADÍSTICAS RÉCORDS
REALIZAR TEST
Título del test:
Practice Test (Sessions 1-4)

Descripción:
Enviroments

Autor:
AVATAR

Fecha de Creación:
01/03/2024

Categoría:
Informática

Número preguntas: 40
Comparte el test:
Facebook
Twitter
Whatsapp
Comparte el test:
Facebook
Twitter
Whatsapp
Últimos Comentarios
No hay ningún comentario sobre este test.
Temario:
A program suffers a run-time error if the _____. program compiles but an error is thrown after the program runs program does not compile program has an empty main method program compiles but a warning is shown after the program runs program compiles but it produces incorrect results.
Given the fact that variable flightTime is larger that 60, which of the following can be used to replace /* missing code */ so that the flightTime can be displayed in hours and minutes? public class TestClass() { int flightTime = 130; int minutes = 0; int hours = 0; public static void main (String[] args) { /* missing code */ System.out.println("The flightTime is " + hours + " hours and " + minutes + " minutes long."); } } minutes = flightTime % 60; hours = hours + flightTime / 60; minutes = flightTime % 60; hours = flightTime / 60; hours = hours + flightTime % 60; minutes = flightTime / 60; minutes = flightTime + flightTime % 60;.
In Java, which keyword is used to create a subclass? subclass extends super implementation.
Which of the following Java features is used to achieve runtime polymorphism? Protected methods Method Hiding Method Overloading Method Overriding.
The extension name of a Java class file is .obj .class .java .txt .exe.
The extension name of a Java source file is .java .class .exe .obj .txt.
The program suffers a logic error if the _____. program compiles but it produces incorrect results program has an empty main method program compiles but a warning is shown after the program runs program does not compile program compiles but an error is thrown after the program runs.
What is the process of combining data and methods into a single unit called in Java? Inheritance Composition Encapsulation Association.
Which keyword is used to indicate that a variable or method belongs to the class, not to the instance in Java? abstract static final const.
Which keyword is used to prevent method overriding in Java? abstract final static comparable.
Which keyword is used to refer to the current object in Java? this super self none of them.
Which of the following access modifiers restricts access the least in Java? protected public private static.
Which of the following best describes encapsulation in Java? Hiding implementation details and only showing the necessary features of an object Allowing multiple instances of a class to be created None of them Exposing all internal details of an object.
Which of the following best describes method overloading in Java? Defining multiple methods with the same name and parameter types in the same class Defining multiple methods with the same name but different return types Defining methods that have different names and parameter types Defining methods that have different names but the same parameter types.
Which of the following concepts in Java allows a class to have multiple methods with the same name but different parameters? Polymorphism XP programming Overriding Overloading.
Which of the following is a correct syntax to call a constructor of the superclass in Java? super(); superclass.constructorName(); none of them super.constructorName();.
Which of the following is a feature of inheritance in Java? It restricts access to certain methods and fields It allows a class to inherit methods and fields from another class None of them It enables polymorphism.
Which of the following is a feature of polymorphism in Java? It allows a class to have multiple toString methods It allows a reference variable to refer to different types of objects at runtime It allows a class to have multiple constructors It allows methods to be defined with multiple signatures.
Which of the following is a rule for method overloading in Java? Methods must have the same return type Methods must have the same return type and same access modifier Methods must have the same access modifier Methods must have different parameter lists.
Which of the following is a type of relationship between two classes in Java where one class represents the "has-a" relationship with the other? Inheritance Overriding Polymorphism Association.
Which of the following is NOT a benefit of using inheritance in Java? None of them Improved code organization Code reusability Increased encapsulation.
Which of the following is NOT a principle of OOP? Complication Polymorphism Inheritance Encapsulation.
Which of the following is true about composition in Java? It allows a class to be composed of other classes It allows a class to inherit directly from another class none of them It is a type of inheritance.
Which of the following is true about constructor in Java? Constructors can have a return type Constructors are called automatically when an object is created Constructors cannot be overloaded Constructors are NOT called automatically when an object is created.
Which of the following is true regarding interfaces in Java? Interfaces can contain constructors Interfaces can contain method implementations Classes can implement exactly one interface Classes can implement multiple interfaces.
Which of the following keywords is used to make a variable constant and unchangeable in Java? final static private const.
Which of the following statements about abstract classes in Java is true? Abstract classes can have abstract methods Abstract classes must have only one abstract method Abstract classes can be instantiated Abstract classes cannot have any methods.
Which of the following statements is true regarding method overriding in Java? Overriding can only occur in subclasses Overriding must change the return type of the method Overriding can change the return type of the method Overriding allows a subclass to define a method with the same signature as in the superclass.
Which of the following throws an ArithmeticException? System.out.println(0 / 2 / 0.5); System.out.println(0 / 1); System.out.println(1 / 1.0000); System.out.println(1 / 0); System.out.println(Character.getNumericValue('c') / Character.getNumericValue('e'));.
Which of the following throws an ArrayIndexOutOfBoundsException? int[] varOne = {1,2,3,4,5,5}; System.out.println(varOne[5]); int[] varOne = new int[5]; System.out.println(varOne[4]); int[] varOne = {1,2,3,4,5}; System.out.println(varOne[3+varOne[0]]); int[] varOne; System.out.println(varOne[4]); int[] varOne = new int[5]; System.out.println(varOne[5]);.
Which of the following throws a NullPointerException? Object varOne; System.out.println(varOne.toString()); Object varOne; System.out.println(varOne); Object varOne = null; System.out.println(varOne.toString()); Object varOne = null; String varTwo = varOne; System.out.println(varTwo); Object varOne = null; System.out.println(varOne);.
Which of the following throws a StringIndexOutOfBoundsException? String varOne = "Java"; System.out.println(varOne.substring(0,4)); String varOne = "Java"; System.out.println(varOne.charAt(4)); String varOne = "Java" + Hello; System.out.println(varTwo.charAt(4)); String varOne = "Java"; System.out.println(varOne.charAt(3)); String varOne = "Java" + '!'; System.out.println(varTwo.charAt(4));.
Which of these Java reserved words is used to explicitly specify the exceptions that a particular method might throw? catch try None of the options throw finally.
Which of these Java reserved words must be used to handle the exception thrown by the try block? throw None of the options catch finally try.
Which one of the following best describes the 'super' keyword in Java? It is used to refer to the immediate child class It refers to the superclass of the current object It is used to call the constructor of the higher level class It is used to call the constructor of the superclass.
Which one of the following is used to implement multiple inheritances in Java? public classes inner classes abstract classes Interfaces.
Interfaces can contain method implementations Vertader Fals.
Interfaces can have constructors? Vertader Fals.
The keyword abstract is used to define a class that cannot be instantiated in Java Vertader Fals.
True or False: An object that implements the Comparator interface in Java can be used to sort a list of objects based on a specific criterion. Vertader Fals.
Denunciar test Consentimiento Condiciones de uso