Java Mock Quiz Excellence

10 Questions | Total Attempts: 311

SettingsSettingsSettings
Java Quizzes & Trivia

Java skills test


Questions and Answers
  • 1. 
    Which of the following process converts Java programming language code to a set of bytecodes?
    • A. 

      Bytecode verification

    • B. 

      Compilation

    • C. 

      Class loading

    • D. 

      Execution

  • 2. 
    Which of the following values is a type of the boolean data type?
    • A. 

      'true'

    • B. 

      "true"

    • C. 

      True

    • D. 

      Boolean

  • 3. 
    Your program needs to use the App class present in the foo.bar package. Which of the following statements imports the class to your program?
    • A. 

      Import App;

    • B. 

      Imports foo.bar.App;

    • C. 

      Import foo.bar.*;

    • D. 

      Import foo.*;

  • 4. 
    Consider the following statements:   Statement A: String is a primitive data type to represent a sequence of characters. Statement B: You can declare a String variable as:                   String str="I am a String";  Select the correct option for the preceding statements:
    • A. 

      Stetement A is true while Statement B is false.

    • B. 

      Both Statement A and Statement B are true.

    • C. 

      Statement A is false while Statement B is true.

    • D. 

      Both Statement A and Statement B are false.

  • 5. 
     Consider the following statements:   Statement A: A constructor must have the same name as that of the class. Statement B: The return type of a constructor must be void.  Select the correct option for the preceding statements:
    • A. 

      Both Statement A and Statement B are true.

    • B. 

      Both Statement A and Statement B are false.

    • C. 

      Statement A is true while Statement B is false.

    • D. 

      Statement A is false while Statement B is true.

  • 6. 
    Select the correct integer length for the int data type.
    • A. 

      8 bits

    • B. 

      16 bits

    • C. 

      32 bits

    • D. 

      64 bits

  • 7. 
    Which of the following is a valid Java identifier?
    • A. 

      $const

    • B. 

      Const

    • C. 

      Long

    • D. 

      new

  • 8. 
    The _____________ option of the compiler enables you to compile class files to a different directory than that of the source files.
    • A. 

      -cp

    • B. 

      -source

    • C. 

      -g

    • D. 

      -d

  • 9. 
    Select the correct option that shows the command to execute the MyApp Java class.
    • A. 

      Java class=MyApp

    • B. 

      Javac MyApp.java

    • C. 

      Java MyApp.java

    • D. 

      Java MyApp

  • 10. 
    To compile and execute Java programs, you need to set the PATH environment variable to ___________________.
    • A. 

      The working directory that contains the source files of the program.

    • B. 

      The java_root/lib directory, where java_root is the installation directory of the Java technology software.

    • C. 

      The java_root/bin directory, where java_root is the installation directory of the Java technology software.

    • D. 

      The installation directory of the Java technology software.

Back to Top Back to top