Java
Java
M2
1. What is method overloading? Illustrate the concept of method overloading using a
Java program.
2. Explain the role of "this" keyword and "static" keyword in Java.
3. Examine Java Garbage collection mechanism by classifying the 3 generations of
Java heap.
4. Define recursion. Write a recursive program to find the nth Fibonacci number.
5. Interpret the general form of a class. Explain call by value and call by
reference with examples.
6. Write a Java program to illustrate: (i) Passing object as parameters. (ii)
Returning objects.
7. Explain the constructor method and parameterized constructors methods with
suitable examples.
8. Develop a Java program to find the area of a rectangle, area of a circle, and
area of a triangle using the method overloading concept.
M3
1. Define inheritance and list the different types of inheritance in Java.
2. Explain the role of "Super" with an example Java program.
3. For any class and any method as an example, explain method overriding.
4. Explain the order of constructor execution in a multilevel class hierarchy.
5. Define dynamic method dispatch and write a code snippet in Java to demonstrate.
6. Briefly explain the final polymorphism concepts.
7. Define an interface. Briefly explain the general forms of an interface.
8. Discuss the significance of nested interfaces in Java.
9. Build a Java program to create a class named 'Shape'. Create 3 subclasses namely
circle, triangle, and square; each class has 2 methods named draw() and erase().
Demonstrate polymorphism concepts by developing suitable methods and main program.
10. Develop a Java program to create an interface Resizable with methods
resizeWidth(int width) and resizeHeight(int height) that allow objects to be
resized. Create a class Rectangle that implements this interface.
M4
1. Explain four categories of visibility for class members based on packages.
2. Give the general form of an exception handling block and write a Java program to
illustrate multiple catch classes.
3. Examine the various levels of access protections available for packages and
their implications with suitable examples.
4. With code snippets, explain the mechanism to create and import a package in
Java.
5. Write a Java program to create custom exception for Negative odd numbers.
6. Define Exception. Explain Exception handling mechanism provided in Java along
with syntax and example.
7. Enlist any three Java Built-in exceptions and explain. What is a chained
exception? Give an example that illustrates the mechanics of handling chained
exceptions.
8. What is a package? What are the steps involved in creating user-defined
packages? Explain.
9. Write a program to illustrate nested if statements.
10. Write a Java program to create chained exceptions with top-level exception is
Null Pointer Exception and its cause Arithmetic Exception.
M5
1. Explain various methods of the Thread class in Java. Write a program to create
multiple threads in Java.
2. Explain the use of Type wrappers in Java with examples. List and discuss the
Numeric type wrappers methods.
3. Explain the isAlive() and join() methods of Thread with example code snippets.
4. Explain the concept of autoboxing/unboxing in expressions and methods.
5. Write a Java program to create chained exceptions with the top-level exception
being a Null Pointer Exception and its cause being an Arithmetic Exception.
6. Define a thread. Also, discuss the different ways of creating a thread.
7. How can synchronization be achieved between threads in Java? Explain with an
example.
8. Discuss the significance of thread priorities in Java.
9. Write a Java program to create 4 threads, and each thread, when run, will sleep
for 500 milliseconds and print its name before "Before Quitting".
10. Write a Java program to demonstrate the use of the synchronized keyword.