Question Bank
Question Bank
Unit 1:
Unit 2:
Unit 3:
1. What are class and an object? How it is created in java? Explain the difference between reference
and object.
2. What is constructor? Describe their types.
3. What is constructor overloading? How it is different from method overloading?
4. What is the use of “this” keyword in java? Show the different areas where we can use “this” keyword
with examples.
5. What is nested method? Explain with suitable example.
6. What is the use of static keyword? Explain static data, static method and static block with suitable
example.
7. Write a program to find the perimeter and area of a triangle having sides of 3, 4 and 5 units by
creating a class named “Triangle” without any parameter in its constructor.
8. Write a program to find the area of rectangle and square using constructor overloading. (hint: use
parameterized constructors to initialize the length and breadth of the shapes).
9. What is access control in java? Explain their types with examples.
10. What is recursion? Write a program to find the factorial of given number by using recursion.
11. How to pass value to methods in java. Differentiate between pass by value and pass by reference
method with suitable examples.
12. What do you mean by Anonymous inner class in java? Explain.
Unit 4:
1. Define inheritance. Discuss the benefits of using inheritance and discuss how can multiple
inheritance can be achieved in java?
2. What are different types of inheritance supported by java? Explain all with suitable diagrams and
examples.
3. What is the difference between inheritance and aggregation? Explain with suitable examples.
4. Explain the difference between abstraction and encapsulation with suitable examples.
5. Create a class named “Rectangle” with two data members „length‟ and „breadth‟ and two methods to
print the area and perimeter of the rectangle respectively. Its constructor must initialize these two
data members. Again create a new class “Square” inherits the class “Rectangle” class with its
constructor having a parameter for its side (suppose s) calling constructor of its parent class as
„super(s,s). Print he area and perimeter of a Rectangle and a Square.
6. What is method overriding? How it is differ from method overloading, explain with examples.
7. What is an interface? How it is different from class?
8. What is dynamic method dispatch and up-casting in inheritance? Explain with suitable examples.
9. What is package in java? Describe its types with suitable example.
10. Differentiate between this() and super() method in re-using constructors.
Unit 5:
Unit 6:
1. How can we make any string lower case and upper case using String methods?
2. How to compare two strings in java? Explain with example.
3. How to split string in java?
4. How to check whether two strings are equal or not?
5. How to count a number of vowels and consonants in a string?
6. Write a java program to compare a given string to the specified string buffer.
Unit 7:
1. What is a thread?
2. Describe the complete life cycle of a thread.
3. What is synchronization? When do we use it? Explain with example.
4. Write a program illustrating the thread priority.
5. How inter thread communication is possible between multiple threads. Explain with suitable
example. [hint: use wait and notify methods]
6. What is deadlock? Justify it with suitable example.
7. Differentiate between synchronized method and synchronized block with suitable example.
Unit 8:
1. What is IO stream?
2. What are FileInputStream and FileOutputStream classes?
3. What is serialization and deserialization? Explain with suitable example.
4. What is the difference between byte streams and character streams?
Unit 9:
Unit 10:
Unit 11:
Unit 12:
1. What is an Applet?
2. Explain the Lifecycle of an Applet.
3. Can we perform the programming in Applet in present? If not, why?
Unit 13:
1. What is JDBC?
2. What are Connection and Statement classes of java.sql package? Why are they used in database
connectivity in Java?
3. Write a complete procedure to connect the java application to mssql server with proper code.
4. Write a complete program;
a. To create a table
b. To insert data
c. To update data
d. To select data
e. To delete row data
5. What is ResultSet? What is ResultSet concurrency?
6. Why are absolute(), relative(), first(), last() methods used in ResultSet Concurrency?