OOP_Assignment-2
OOP_Assignment-2
APJ Abdul
GL BAJAJ
Institute of Technologies & Management
Kalam Technical University, Lucknow, U.P., India]
Department of Applied Computational Science & Engineering
Greater Noida
Assignment-2
Subject: Object Oriented Programming with Java
Code: BCS-403
Q1. Explain the concept of exception handling in Java. How does it differ from traditional error
handling mechanisms?
Q2. Discuss the various types of exceptions in Java and provide examples of situations where
each type might occur.
Q3. Differentiate between checked and unchecked exceptions with examples for both.
Q4. Write a Java code or syntax snippet that demonstrates the use of try, catch, and finally
blocks for handling exceptions.
Q5. Evaluate the significance of the finally block in exception handling. Illustrate with
examples how finally ensures proper resource cleanup and why it's essential in exception
handling scenarios.
Q6. Describe the JVM's reaction to exceptions during program execution. How does the JVM
handle exceptions differently in various scenarios, such as checked and unchecked exceptions?
Q7. Explain how custom exceptions (user-defined exceptions) enhance code readability and
maintainability with suitable examples.
Q8. Propose a scenario where using the throw keyword would be advantageous in Java
exception handling.
Q9. Explain the difference between byte streams and character streams in Java I/O. When
would you prefer using character streams over byte streams, and vice versa? Justify your
answer.
Q10. Evaluate the performance implications of using byte streams versus character streams for
file I/O operations in Java. Discuss factors such as efficiency, readability, and cross-platform
compatibility.