Java Skill Assessment Test

23 Questions | Total Attempts: 7328

SettingsSettingsSettings
Java Skill Assessment Test - Quiz

This test will measure the applicants knowledge and competency in the technical field of Java development and programming


Questions and Answers
  • 1. 
    What is the size of a Char?
    • A. 

      4 bits

    • B. 

      7 bits

    • C. 

      8 bits

    • D. 

      16 bits

  • 2. 
    A class cannot be declared
    • A. 

      Static

    • B. 

      Private

    • C. 

      Default

  • 3. 
    Following code will result in: int a = 3.5;
    • A. 

      Compilation error

    • B. 

      Runtime error

    • C. 

      A being 3.5

    • D. 

      A being 3

  • 4. 
    Following code will result in: int a1 = 5; double a2 = (float)a1;
    • A. 

      Compilation error

    • B. 

      Runtime error

    • C. 

      No errors

  • 5. 
    Following code will result in: int a = 9/0;
    • A. 

      Compilation error: Divisions must be in a try block

    • B. 

      Compilation error: DivideByZeroException

    • C. 

      Runtime Exception

    • D. 

      No Error: a is NaN

  • 6. 
    Following code will result in: float a = 9/0;
    • A. 

      Compilation error: Divisions must be in a try block

    • B. 

      Compilation error: DivideByZeroException

    • C. 

      Runtime Exception

    • D. 

      No Error: a is NaN

  • 7. 
    A class can be transient
    • A. 

      True

    • B. 

      False

  • 8. 
    Following code will result in: class A { int b = 1; public static void main(String [] args) { System.out.println("b is " + b); }}
    • A. 

      Compilation error

    • B. 

      Runtime Error

    • C. 

      Runtime Exception

    • D. 

      Output of b is 1

  • 9. 
    Following code will result in: class A { public static void main(String [] args) {B b = new A(); }} class B extends A {}
    • A. 

      Compile error

    • B. 

      Runtime Exception

    • C. 

      No error

  • 10. 
    Following code will result in: class A { public static void main(String [] args) {A a = new B(); }} class B extends A {}
    • A. 

      Compiler error

    • B. 

      Runtime Exception

    • C. 

      No errors

  • 11. 
    Methods that are marked protected can be called in any subclass of that class.
    • A. 

      True

    • B. 

      False

  • 12. 
    An abstract class can have non-abstract methods.
    • A. 

      True

    • B. 

      False

  • 13. 
    Java keywords are written in lowercase as well as uppercase
    • A. 

      True

    • B. 

      False

  • 14. 
    What is an instanceof
    • A. 

      A methods in object

    • B. 

      An operator and keyword

  • 15. 
    Primitive datatypes are allocated on a stack.
    • A. 

      True

    • B. 

      False

  • 16. 
    Can you compare a boolean to an integer?
    • A. 

      Yes

    • B. 

      No

  • 17. 
    Integer a = new Integer(2); Integer b = new Integer(2); What happens when you do if (a==b)?
    • A. 

      Compiler error

    • B. 

      Runtime Exception

    • C. 

      True

    • D. 

      False

  • 18. 
    Synchronized is a keyword to tell a Thread to grab an Object lock before continuing execution.
    • A. 

      True

    • B. 

      False

  • 19. 
    The default statement of a switch is always executed
    • A. 

      By marking it private

    • B. 

      By marking it volatile

    • C. 

      By marking it transient

    • D. 

      You can not.

  • 20. 
    Which one does not extend java.lang.Number
    • A. 

      Integer

    • B. 

      Boolean

    • C. 

      Character

    • D. 

      Long

    • E. 

      Short

  • 21. 
    What is default layout manager for panels and applets?
    • A. 

      Flowlayout

    • B. 

      Gridlayout

    • C. 

      BorderLayout

  • 22. 
    Which of the following statements are true?
    • A. 

      When you construct an instance of File, if you do not use the filenaming semantics of the local machine, the constructor will throw an IOException.

    • B. 

      When you construct an instance of File, if the corresponding file does not exist on the local file system, one will be created.

    • C. 

      When an instance of File is garbage collected, the corresponding file on the local file system is deleted.

    • D. 

      None of the above

  • 23. 
    You execute the code below in an empty directory. What is the result? File f1 = new File("dirname"); File f2 = new File(f1, "filename");
    • A. 

      A new directory called dirname is created in the current working directory

    • B. 

      A new directory called dirname is created in the current working directory. A new file called filename is created in directory dirname

    • C. 

      A new directory called dirname and a new file called filename are created, both in the current working directory

    • D. 

      A new file called filename is created in the current working directory

    • E. 

      No directory is created, and no file is created

Back to Top Back to top