Online Java Programming Test


Core Java


  1. Which interface provides the capability to store objects using a key-value pair?

  2. Java.util.Map

    Java.util.List

    Java.util.Set

    Java.util.Collection
  3. Which one creates an instance of an array?

  4. float fa = new float[20];

    char[ ] ca = "Some String";

    int[ ] ia = new int[15];

    int ia[ ] [ ] = { 4, 5, 6 }, { 1,2,3 };
  5. Which of the following statements about the hashcode() method are incorrect?

  6. The value returned by hashcode() is used in some collection

    The hashcode() method is required to return a positive int value.

    The hashcode() method in the String class is the one inherited from Object.

    Two new empty String objects will produce identical hashcodes.
  7. static int Count = 2; ++Count value?
  8. 0

    1

    2

    3
  9. Whar is the Default Thread Priority?

  10. 0

    10

    1

    5
  11. Which will contain the body of the thread?
  12. main();

    run();

    start();

    stop();
  13. Which is a invalid declarations of a String?

  14. String s1 = null;

    String s2 = new String("JavaStuff");

    String s3 = "JavaStuf";

    String s4 = (String) 'JavaStuff';
  15. Which statement is true?

  16. Any statement that can throw an Exception must be enclosed in a try block.

    Any statement that can throw an Error must be enclosed in a try block.

    The Error class is a RuntimeException.

    catch(X x) can catch subclasses of X where X is a subclass of Exception.
  17. How to call parent Class Constructor?

  18. this( );

    super.parent( );

    this( ). parent( );

    super( );
  19. Can we force Garbage Collection(gc) ?

  20. Yes

    No

    Can' Say

    Depend's on JVM

If you have any Test Questions please mail to sanjana@javastuff.in
                                              



Enter your email address to get our daily JOBS & INTERVIEW FAQ's Straight to your Inbox.

Make sure to activate your subscription by clicking on the activation link sent to your email