Technical Field Of Java Development And Programming

26 Questions | Total Attempts: 67

SettingsSettingsSettings
Java Quizzes & Trivia

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. 
    If class A implements an interface does it need to implement all methods of that interface?
    • A. 

      Yes, always

    • B. 

      No, not when A is abstract

  • 18. 
    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

  • 19. 
    The methods wait(), notify() and notifyAll() in Object need to be called from synchronized pieces of code
    • A. 

      True

    • B. 

      False

  • 20. 
    Inner classes can be defined within methods.
    • A. 

      True

    • B. 

      False

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

      True

    • B. 

      False

  • 22. 
    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.

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

      Integer

    • B. 

      Boolean

    • C. 

      Character

    • D. 

      Long

    • E. 

      Short

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

      Flowlayout

    • B. 

      Gridlayout

    • C. 

      BorderLayout

  • 25. 
    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

Back to Top Back to top