OCAJP7 part 2

Descripción

Second part of previous quiz.
 .  .
Test por . ., actualizado hace más de 1 año
 .  .
Creado por . . hace alrededor de 8 años
46
0

Resumen del Recurso

Pregunta 1

Pregunta
Select the one most appropriate answer. What is the purpose of method parseInt defined in Integer class.
Respuesta
  • The method converts an integer to a String.
  • The method is used to convert String to an integer, assuming that the String represents an integer.
  • The method is used to convert String to Integer class, assuming that the String represents an integer.
  • The method converts the Integer object to a String.

Pregunta 2

Pregunta
What should be done to invoke the run() method on a thread for an object derived from the Thread class. Select the one correct answer.
Respuesta
  • The run() method should be directly invoked on the Object.
  • The start() method should be directly invoked on the Object.
  • The init() method should be directly invoked on the Object.
  • The creation of the object using the new operator would create a new thread and invoke its run() method.

Pregunta 3

Pregunta
Which of the following statements are correct. Select the four correct answers.
Respuesta
  • A Java program must have a package statement.
  • A package statement if present must be the first statement of the program (barring any comments).
  • If a Java program defines both a package and import statement, then the import statement must come before the package statement.
  • An empty file is a valid source file.
  • A Java file without any class or interface definitions can also be compiled.
  • If an import statement is present, it must appear before any class or interface definitions.

Pregunta 4

Pregunta
What would be the results of compiling and running the following class. Select the one correct answer. class test { public static void main() { System.out.println("test"); } }
Respuesta
  • The program compiles and runs but does not generate any output.
  • The program compiles and runs generating an output of "test"
  • The program compiles but does not run.
  • The program does not compile as there is no main method defined

Pregunta 5

Pregunta
Which of the following statements are true. Select the one correct answer.
Respuesta
  • Arrays in Java are essentially objects.
  • It is not possible to assign one array to another. Individual elements of array can however be assigned
  • Array elements are indexed from 1 to size of array.
  • If a method tries to access an array element beyond its range, a compile warning is generated.

Pregunta 6

Pregunta
The class java.lang.Exception is ?
Respuesta
  • protected
  • implements Throwable
  • implements Serializable
  • extends Throwable
Mostrar resumen completo Ocultar resumen completo

Similar

Java Week 5 Object Oriented Programming
Troy Bowlin
OCAJP7
. .
OCAJP7 part 3 - from book
. .
Java Practice 1
Ummm No
Java Practice 2
Ummm No
Servion - Java Questionnaire
rohit.benedict
Java Core. Basics
Gadget
Programming Review
Shannon Anderson-Rush
Useful String Methods
Shannon Anderson-Rush
Programming in Java
Faheem Ahmed
Object Oriented Programming Concepts
Cmagapu