Saturday, 13 May 2017

Today's java Quiz 2

This quiz comprises of very basic/intermediate level of java concept questions. See how much you score out of 10. 

Note : Answers to each question is given at the end.

1. You can call parent class constructor from child class using
  • this
  • final
  • super()
  • strictfp

2. This variable shares same memory space
  • final
  • instance 
  • strictfp
  • static

3. You can overload a method by
  • changing number of arguments
  • changing return type of method
  • changing data type of arguments
  • 1 & 3 option

4. CopyOnWriteArrayList is
  • fail safe
  • fail fast

5.  String a = "10";
     String b = a;
Which variable is eligible for garbage collection?
  • both a & b 

6. private class A{
         public static void main(String[] args){
              System.out.print("Success");
   }
}
What will be the outcome of this code snippet?
  • Success
  • run time error
  • compile time error
  • none

7. String class implements this interface
  • Cloneable
  • Serializable
  • Runnable
  • Random Access

8. In case you add duplicate key-value pair in HashMap, what will happen?
  • Exception will be thrown
  • duplicate key-value will override the previous entry
  • new entry will be created for duplicate 
  • none

9. Can we start a thread twice?
  • yes
  • no

10. What is default priority value of thread?
  • 1
  • 2
  • 5
  • 10

Answer:

1-super()     2-static    3-1&3 option    4-fail safe    5-a    6-compile time error   7-Serializable
8-duplicate key-value will override the previous entry   9-no    10-5




How was the quiz? 
How much you scored out of 10?
Please write in the comment box.

No comments:

Post a Comment

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
If you are looking for a reference book on java then we recommend you to go for → Java The Complete Reference
Click on the image link below to get it now.