Exception handling Interview Questions for Fresher and Experienced

1. What do you mean by Exception?
2. How many types of exceptions in java?
3. What is the difference between Exception and error?
4. What is the difference between checked Exception and un-checked Exception?
5. Checked exceptions are caused by?
6. Unchecked exceptions are caused by?
7. Errors are caused by?
8. Is it possible to handle Errors in java?
9. What the difference is between partially checked and fully checked Exception?
10. What do you mean by exception handling?
11. How many ways are there to handle the exception?
12. What is the root class of Exception handling?
13. Can you please write some of checked and un-checked exceptions in java?
14. What are the keywords present in Exception handling?
15. What is the purpose of try block?
16. In java is it possible to write try with out catch or not?
17. What is the purpose catch block?
18. What is the difference between try-catch?
19. Is it possible to write normal code in between try-catch blocks?
20. What are the methods used to print exception messages?
21. What is the purpose of printStackTrace( ) method?
22. What is the difference between printStackTrace( ) &getMessage()?v
23. What is the purpose of finally block?
24. If the exception raised in catch block what happened?
25. Independent try blocks are allowed or not allowed?
26. Once the control is out of try , is it remaining statements of try block is executed?
27. Try-catch , try-catch-catch , catch-catch , catch-try how many combinations are valid?
28. Try-catch-finally , try-finally ,catch-finally , catch-catch-finally how many combinations are valid?
29. Is possible to write code in between try-catch-finally blocks?
30. Is it possible to write independent catch blocks?
31. Is it possible to write independent finally block?
32. What is the difference between try-catch –finally?
33. What is the execution flow of try-catch?
34. If the exception raised in finally block what happened?
35. What are the situations finally block is executed?
36. What are the situations finally block is not executed?
37. What is the purpose of throws keyword?
38. What is the difference between try-catch blocks and throws keyword?
39. What do you mean by default exception handler and what is the purpose of default exception handler?
40. How to delegate responsibility of exception handling calling method to caller method?
41. What is the purpose of throw keyword?
42. If we are writing the code after throw keyword usage then what happened?
43. What is the difference between throw and throws keyword?
44. How to create user defined checked exceptions?
45. How to create user defined un-checked exceptions?
46. Where we placed clean-up code like resource release, databasecloseting inside the try or catch or finally and why ?
47. Write the code of ArithmeticException?
48. Write the code of NullPointerException?
49. Write the code of ArrayIndexOutOfBoundsException&StringIndexOutOfBoundsException?
50. Write the code of IllegalThreadStateException?
51. When we will get InputMisMatchException?
52. When we will get IllegalArgumantException?
53. When we will get ClassCastException?
54. When we will get OutOfMemoryError?
55. When we will get compilation error like “unreportedException must be catch”?
56. When we will get compilation error like “Exception XXXException has already been caught”?
57. When we will get compilation error like “try without catch or finally”?
58. How many approaches are there to create user defined unchecked exceptions and un-checked exceptions?
59. What do you mean by exception re-throwing?
60. How to create object of user defined exceptions?
61. How to handover user created exception objects to JVM?
62. What is the difference user defined checked and unchecked Exceptions?
63. Is it possible to handle different exceptions by using single catch block yes-->how nowhy?

Comments

Popular posts from this blog

Exception Handling

Wrapper Class

Collections Framework Interview Questions for Fresher and Experienced