Java Question Bank 1
Java Question Bank 1
Module 1
Module 2
1. Explain how objects are passed as function parameters with a suitable example
2. What are parameterized constructors? Is it possible to define a parameterized constructor
for a class without defining a parameter-less constructor?
3. Explain method overloading with the help of an example.
4. Discuss the different access specifiers used in java
5. Explain how inheritance is implemented in Java. What is the use of ‘super’ keyword?
Illustrate its usage with suitable examples
6. What are abstract classes?
7. Write briefly about any four features of Java
8. Differentiate between while and do while iterative statements
9. What are the role of a constructor?
10. Compare private, proctected and public acces modfiers
11. Write a java program to check whether a given number is prime or not
12. Show the use of different types of shift operators in java with the help of suitable
examples
13. Define a class Queue for representing a queue data structure. The class must define a
default constructor, a parameterized constructor and functions for en-queue, de-queue and
display operations. Write a Java program to implement this.
14. What is a constructor? What are its uses?
15. Why is the main method in java qualified as public, static, and void?
16. Is it possible create an object for a class A using, A ob = new A(); if the class contains
only parameterized constructor? Justify.
17. Differentiate between Abstract class and Interface
18. Demonstrate how polymorphism can be implemented using method overriding with
suitable example
19. Summarize the different data types in java
Module 3
Module 4
1. What are thread priorities? How can you assign priority values for threads
created in Java?
2. Write a Java program to create two threads: One for displaying all odd numbers
between 1 and 100 and second thread for displaying all even numbers between 1
and 100.
3. Draw the lifecycle of a thread showing the different states and methods invoked.
4. What are the uses of “synchronized” keyword?
5. Explain briefly about the Delegation Event model.
6. List any five event sources and their corresponding generated event typeand
listeners used.
7. Describe the different character extraction methods of String class along with
their syntax.
8. Write a java program to count the occurrence of a particular word within a
sentence using string handling methods.
9. Discuss any four methods used for string processing in Java
Module 5
1. What are layout managers? Explain any one layout manager with an example
2. Discuss the different steps involved in establishing a JDBC connectivity and query
processing with a suitable example.
3. What are the differences between a Java applet and a Java application?
4. What are the advantages of using Swings?
5. Explain any three graphics related methods along with their syntax.
6. Write the steps for connecting a java program to a database, executing a select query,
and fetching the results with sample code.
7. Summarize the features of swing API
8. List any four containers and component classes of swing API
9. Write a java program using JDBC API to verify the login credentials of a user.
10. How do you establish connection between a java program and database? Explain the steps
with suitable code
11. What are the advantages of using Swings?
12. Explain any three graphics related methods along with their syntax