Question Bank
Unit 2
1. Give the classification of exceptions
2. Differentiate between exceptions and errors in Java.
3. Describe the different types of exceptions in Java (checked exceptions,
unchecked exceptions, runtime exceptions).
4. Define exception? Explain about various keywords used in handling the
exceptions
5. What happens when an exception occurs during program execution in
Java? Describe how the JVM reacts to exceptions and errors.
6. In Java, is exception handling implicit or explicit or both? Explain with the
help of example Java programs
7. Discuss the concept of exception handling and its significance in software
development.
8. Discuss the roles of Checked and Unchecked Exceptions with your
supporting examples.
9. Explain the purpose of the try-catch-finally blocks in Java exception
handling.
Discuss the role of the throw and throws keywords in exception handling.
11.What are in-built exceptions in Java, and how are they used?
12.How can you define custom (user-defined) exceptions in Java?
13.Explain the concept of command- line argument with suitable program.
14. What are byte streams and character streams in Java I/O? Explain the
difference between byte streams and character streams.
15. How can you read data from a file using byte streams in Java? Provide an
example of reading a text file using FileInputStream and
BufferedInputStream.
16. How can you write data to a file using byte streams in Java? Provide an
example of writing to a text file using FileOutputStream and
BufferedOutputStream.
17. Provide examples of reading and writing text files using FileReader,
FileWriter,
BufferedReader, and BufferedWriter.
18. Explain creation of thread using run able interface with an example
19. Explain about inter –thread Communication with an example
20. Explain the life cycle of a thread and multithreading
21. Explain about thread interrupts with an example
22. Implementing Run able interface and extending Thread, which method
you prefer for multithreading and why?
23. With the help of an example, explain multithreading by extending
Thread class ?
24. What are daemon threads, and how are they different from user
threads?
25. Write a Java program that creates three threads. First thread displays
OOPS, the second thread displays Through and the third thread Displays
JAVA by using Runnable interface
26. Write a java program which accepts withdraw amount from the user and
throws an exceptionIn Sufficient Funds when withdraw amount more than
available amount. Write a java program to illustrate finally block.