Java QP - BCS306A
Java QP - BCS306A
Unit-1
Unit-2
Unit-3
Unit-4
1. What are the basic principles of exception handling in Java? Describe the role of
try and catch blocks.
2. Explain the difference between checked and unchecked exceptions. Provide
examples of each.
3. What is the purpose of the finally block in exception handling? When is it executed?
4. How do you create a custom exception subclass in Java? Provide a code example.
5. What is a package in Java, and why is it used? Provide an example of how to create
a package.
6. Explain the differences in member access levels (public, protected, default,
private) when using packages.
7. How do you import a package in Java? Provide an example using the import
statement.
8. What is the significance of the java.lang package, and why do you not need to
import it explicitly?
9. Develop a Java program that demonstrates multiple catch clauses and nested try
statements. Explain how each clause handles different exceptions.
10. Analyze the use of the throw and throws keywords in exception handling. How do
they contribute to the robustness of a Java application?
11. What are the steps to create a package and add classes to it in Java? Provide a
detailed example.
12. Describe how the protected access modifier works within and outside of packages.
13. Explain the difference between importing a single class and importing an entire
package in Java.
14. What is the purpose of the static import statement? How does it differ from the
regular import statement? Provide an example.
15. How does Java differentiate between runtime exceptions and compile-time
exceptions? Provide examples of each.
16. What is an uncaught exception, and what happens when it occurs in a Java
program?
17. Explain the significance of the throws keyword in method declarations. How does
it affect method callers?
18. Describe a scenario where the finally block is critical for resource management.
19. Program 9 and 10
Unit 5
1. What is the Java Thread Model, and how does it support concurrent execution?
2. Explain how to create a thread in Java using the Thread class. Provide a code
example.
3. What is the role of the main thread in a Java application? How can additional
threads be created?
4. How do the isAlive() and join() methods work in managing thread execution?
Provide examples.
5. Explain how thread priorities influence the execution of threads. How can you set
the priority of a thread?
6. What is synchronization in multithreading, and why is it important? Provide an
example of synchronized methods.
7. Describe the process of inter-thread communication in Java using wait(), notify(),
and notifyAll().
8. How can threads be suspended, resumed, and stopped in Java? Why are these
methods generally discouraged?
9. Explain how to obtain and interpret a thread’s state using the getState() method.
10. Describe how to create multiple threads and manage their execution. Provide an
example demonstrating concurrent execution.
11. What is an enumeration in Java, and how do you define one? Provide an example.
12. Explain the values() and valueOf() methods in enumerations. How are they used?
13. Describe the purpose of type wrappers in Java. List the common type wrapper
classes.
14. What is autoboxing in Java, and how does it simplify working with primitive types
and objects? Provide an example.
15. Explain how autoboxing/unboxing works in method calls. Provide a code example
demonstrating this concept.
16. How does autoboxing/unboxing occur in expressions? Provide an example
showing the interaction between primitive types and their wrapper classes.
17. Describe the process of autoboxing/unboxing Boolean and Character values.
Provide examples.
18. What are the key differences between primitive types and their corresponding
type wrappers?
19. Explain how enumerations can be used in switch statements. Provide an example.
20. How can you use type wrappers to convert between primitive types and their
string representations? Provide examples.
21. Program 11 and 12