Java Question bank
MODULE-1
[Link] Questions Marks
1 Write the differences between Procedure oriented and Object
oriented languages
2 List and Explain features of Object oriented program.
3 Explain object oriented principles.
4 Describe the meaning of each of the keyword in “public static
void main”
5 Explain different lexical issues in JAVA.
6 How foreach is different from for loop. Develop a program to
show working of foreach loop.
7 Explain the following operations with examples. (i)<< (ii)>>
(iii)>>>(iv)/ (v)% (vi)& (vii)&& (viii) ||
8 Define Bytecode. Explain portability in Java.
9 Define Type casting. Explain Types of Type casting with an
example.
10 Develop a program to show working of switch case.
11 Demonstrate the working of enhanced for loop.
12 Write a program to sort the elements using for loop
13 Explain four different types of if statements in JAVA.
14 Write a Java program to sort the elements using a for loop.
15 Explain different types of if statements in JAVA
16 Define Array. Develop a Java program to add two matrices using
command line argument.
17 How to declare and initialize 1-D and 2-D arrays in Java. Give
examples
18 List the short circuit operators and show the concept using few
examples.
19 With a java program, illustrate the use of ternary operator to
find the greatest of three numbers.
20 Develop a Java program to demonstrate the working of for each
version of for loop. Initialize the 2D array with values and print
them using for each.
21 Discuss the different data types supported by Java along with the
default values and literals.
22 Develop a Java program to convert Celsius temperature to
Fahrenheit.
23 Justify the statement “Compile once and run anywhere” in Java.
24 Short Programs of each loops and jump statements from the PPT
25 Explain the various primitive data types used in [Link]
suitable examples
MODULE-2
1 What are constructors? Explain three types of constructors with
an example program.
2 Define recursion. Write a recursive program to find nth
Fibonacci number./ Factorial of n.
3 Explain the various access specifiers in Java
4 Explain call by value and call by reference with an example
program
5 Write a program to perform Stack operations using proper class
and Methods
6 Outline the use of this and Static in JAVA with an example
7 Illustrate java program to demonstrate static variable , methods
and blocks
8
9 Explain Method and Constructor overloading in Java with an
example
10 Illustrate with an example program to pass object as
arguments/parameters
11 Illustrate argument passing in java with a suitable example
program
12 Illustrate Recursion in java with suitable example . Also state
the advantage and disadvantage of recursion
13 Explain concept of class, object and method with the help of a
simple java program.
14 Explain the use of “this” constructor to invoke current class
method
15 Explain the use of “this” constructor to invoke current class
constructor
16 Explain the use of “this” constructor to refer current class
instance variable.
17 Explain concept of method with the help of a simple java
program.
18. A class called Employee, which models an employee with an ID,
name and salary, is designed as shown in the following class
diagram. The method raiseSalary (percent) increases the salary
by the given percentage. Develop the Employee class and
suitable main method for demonstration
19.
Write a note on final keyword.
Module-3(Inheritance, Interface)
1.
Define Inheritance. Explain the types of Inheritance in Java.
2. Example two uses of super keyword with example.
3.
What is single-level inheritance? Write a Java program to
implement single-level inheritance.
4.
What is the importance of the super keyword in inheritance?
Illustrate with a suitable example.
5. Example two uses of super keyword with example.
6.
What is abstract class and abstract method? Explain with an
example.
7. What is abstract class ? Explain with example.
8. What is abstract class and abstract method? Explain with an
example
9. Demonstrate dynamic dispatch using abstract class in JAVA.
10. Give example for method overriding.
11. Develop a program to show the use super keyword.
12. Distinguish between Method overloading and Method overriding
in Java.
13. Compare and contrast between overloading and overriding in
Java with example program for each.
14. Illustrate the usage of super keyword in Java with suitable
example. Also explain the dynamic method dispatch
15. Write a Java program to implement multilevel inheritance with
three levels of hierarchy.
16.
Explain how an interface is used to achieve multiple
Inheritances in Java.
17. Demonstrate the working of interface in Java.
18. Explain how an interface is used to achieve multiple inheritance
in Java.
19. Build a Java program to create an interface Resizable with
method resize(int radius) that allow an object should be resized.
Create a class Circle that implements Resizable interface and
implement the resize method.
20. Demonstrate the working of final class and final method in
JAVA.
Module-4(Package,exception Handling)
1. Define package. Explain the steps involved in creating a user-
defined package with an example.
2. Explain the concept of importing packages in Java and provide
an example demonstrating the usage of the import statement.
3. Write a program that contains one method that will throw an
IllegalAccessException and use proper exception handling so
that the exception should be printed.
4. Define an exception. What are the key terms used in exception
handling? Explain.
5. How do you create your own exception class? Explain with a
program.
6. Demonstrate the working of a nested try block with an example.
7. Examine the various levels of access protections available for
packages and their implications with suitable examples.
8. Build a Java program for a Banking application to throw an
exception, where the person tries to withdraw the amount even
though he/she has lesser than minimum balance (Create a custom
exception
9. Define Exception. Explain exception handling mechanism
provided in Java along with syntax and examples.
10. Build a Java program to create a package ‘Balance’ containing
Account class with displayBalance() method and import this
package in another program to access the method of Account
class
11. Compare throw and throws keyword by providing suitable
example program
12. Explain about the need for finally block.
13. Discuss about chained exceptions.
14. Examine the various levels of Access protection available for
packages implications with suitable example.
15. What is the importance of clause finally?
16. Module-5(Multithreading , Enumeration)
1 What do you mean by a thread? Explain the different ways of
creating threads.
2. What is multithreading? Write a program to create multiple
threads in JAVA.
3. Explain the two ways in which Java threads can be instantiated.
Support your explanation with a sample program
4. Define thread. Demonstrate creation of multiple threads with a
program.
5. What is the need of synchronization? Explain with an example
how synchronization is implemented in JAVA.
6. Explain with an example how inter-thread communication is
implemented in JAVA
7. Develop a program to demonstrate Thread priorities in Java.
8. Explain thread life cycle with a neat diagram.
9. What is Thread? Explain the two ways of creating a Thread in
Java.
10. Develop a program to show synchronization in Java.
11. Discuss values() and valueOf() methods in Enumerations with
suitable examples.
12. What is enumeration? Explain the methods values() and
valueOf().
13. Explain about type wrappers and auto boxing.
14. Explain Auto-boxing and Unboxing in expressions with suitable
examples.
15. Explain Wrapper classes in Java with suitable examples.