ARASU ENGINEERING COLLEGE, KUMBAKONAM-612 501
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
Question Bank
Sub. Code &Name: CS25C09 & Java Programming
Year/Sem/Branch : II/III/CSE-B Regulation: 2025 Academic year: 2026-2027 (Odd)
Staff Name : Mrs. R. Priyadharshini
UNIT –I-FOUNDATIONS OF OOP AND JAVA
PART – A (1 MARK)
1.A software company wants to hide the internal details of a bank account while allowing
customers to access only the required operations such as deposit and withdraw. Which OOP
principle best supports this requirement?
A) Inheritance
B) Encapsulation
C) Polymorphism
D) Abstraction
2. A class named Vehicle is created, and another class Car derives all its properties and methods
from it. Which OOP feature is demonstrated here?
A) Encapsulation
B) Method Overloading
C) Inheritance
D) Constructor Chaining
3. A Java programmer wants to write the source code, compile it into bytecode, and execute it on
different operating systems without changing the program. Which Java feature makes this
possible?
A) Dynamic Memory Allocation
B) Platform Independence
C) Method Overriding
D) Garbage Collection
4. A student writes the following declaration:
double salary = 35000.75; What is the data type of the variable salary?
A) float
B) int
C) double
D) long
5. A Java application stores marks of 100 students using a single variable name with indexed
positions. Which Java feature is most suitable?
A) Constructor
B) Array
C) Package
D) Interface
6. Which of the following Java operators is used to compare whether two values are equal instead
of assigning one value to another?
A) =
B) ==
C) !=
D) +=
7. A programmer wants to execute a block of code repeatedly until a specified condition becomes
false, but the loop must execute at least once. Which looping statement should be used?
A) for
B) while
C) do-while
D) switch
8. Which control statement is most appropriate when a program has to choose one among many
possible options based on the value of a variable?
A) if
B) while
C) switch
D) continue
9. A Java developer creates a class named Employee containing variables and methods. Later,
multiple employee objects are created from this class. What does the class represent?
A) Instance
B) Blueprint
C) Package
D) Variable
10. Which statement correctly creates an object named student for the class Student?
A) Student student();
B) Student = new student();
C) Student student = new Student();
D) new Student student;
11. A constructor is automatically executed whenever an object is created. What is its primary
purpose?
A) Destroy an object
B) Initialize object data
C) Execute loops
D) Import packages
12. Which statement about constructors is TRUE?
A) Constructors have a return type.
B) Constructors can be inherited.
C) Constructors have the same name as the class.
D) Constructors are declared using the keyword constructor.
13.A Java class contains three constructors with different parameter lists. This feature is known as
A) Method Overriding
B) Constructor Overloading
C) Multiple Inheritance
D) Abstraction
14. A subclass provides its own version of a method already available in its superclass with the
same method signature. This process is called
A) Method Overloading
B) Method Overriding
C) Constructor Overloading
D) Data Hiding
15. Which annotation helps the compiler verify that a method is correctly overriding a superclass
method?
A) @Method
B) @Override
C) @OverrideMethod
D) @Super
16. Which access specifier allows a class member to be accessed only within the same class?
A) public
B) protected
C) private
D) default
17. A method declared using the public access specifier can be accessed
A) Only within the same package
B) Only by subclasses
C) From anywhere in the program
D) Only inside the same class
18. Which keyword is used to declare a class variable that is shared among all objects of the class?
A) final
B) static
C) constant
D) global
19. If ten objects are created for a class containing one static variable, how many copies of the
static variable exist?
A) 10
B) 5
C) 1
D) Depends on memory
20. Which keyword is used to inherit one Java class from another?
A) extends
B) implements
C) inherit
D) super
21. Which type of inheritance is directly supported by Java through classes?
A) Multiple
B) Hybrid
C) Single
D) Circular
22. Which keyword refers to the current object of a class?
A) self
B) current
C) this
D) object
23. Which keyword is used to access the constructor or members of the immediate superclass?
A) parent
B) super
C) this
D) extends
24. Which of the following is not a primitive data type?
A) char
B) boolean
C) String
D) byte
25. What will be the value of x after execution?
int x = 10;
x++;
A) 9
B) 10
C) 11
D) 12
26. Which Java keyword prevents a variable from being modified after initialization?
A) static
B) final
C) const
D) fixed
27. Which memory area stores local variables declared inside methods?
A) Heap Memory
B) Stack Memory
C) ROM
D) Cache
28. The Java compiler converts source code into
A) Machine Code
B) Bytecode
C) Binary File
D) Assembly Language
29. Which of the following is not an advantage of Object-Oriented Programming?
A) Code Reusability
B) Data Security
C) Modularity
D) Increased Program Size
30. A university management system creates classes such as Student, Faculty, and Department,
each containing data and methods. Which programming paradigm is best suited for designing such
a system?
A) Procedural Programming
B) Functional Programming
C) Object-Oriented Programming
D) Assembly Programming
PART - B ( 3 MARKS)
1. Define Object-Oriented Programming (OOP). List the four basic [CO1, LOT, K2]
principles of OOP.
2. What is Encapsulation? Explain with suitable example. [CO1, LOT, K2]
3. Define Procedure-Oriented Programming (POP) and Object-Oriented [CO1, LOT, K1]
Programming (OOP).
4. Define JDK, JRE, and JVM. [CO1, LOT, K1]
5. What is the Java Program Execution Process from source code to [CO1, LOT, K2]
execution.
6. Define Primitive and Non-Primitive Data Types in Java with examples. [CO1, LOT, K2]
7. What is variables in Java? List the types. [CO1, LOT, K1]
8. Explain how to declare, create, and initialize an array in Java with an [CO1, LOT, K2]
example.
9. List the different types of operators available in Java. [CO1, LOT, K1]
10. Illustrate the purpose of the Assignment Operator (=) and the Equality [CO1, LOT, K2]
Operator (==).
11. What is Conditional Statements in Java? List the types of Conditional [CO1, LOT, K2]
Statements in Java.
12. Illustrate the working of the for, while, and do-while loops with examples. [CO1, LOT, K2]
13. Summarize the purpose of the break and continue statements with [CO1, LOT, K2]
examples.
14. Define a Class and an Object with suitable examples. [CO1, LOT, K1]
15. Outline the process of creating an object in Java with an example. [CO1, LOT, K2]
16. What is a Constructor? State its characteristics. [CO1, LOT, K2]
17. Define Default Constructor and Parameterized Constructor. [CO1, LOT, K1]
18. What is Constructor Overloading? Give an example. [CO1, LOT, K2]
19. Define Method Overriding. State its rules. [CO1, LOT, K2]
20. Define Method Overloading and Method Overriding. [CO1, LOT, K1]
21. Summarize the four Access Specifiers in Java. [CO1, LOT, K2]
22. Define Static Members and Instance Members. [CO1, LOT, K1]
23. What is the purpose of the static keyword. Discuss with an example. [CO1, LOT, K2]
24. Define Inheritance. List the different types of inheritance supported in [CO1, LOT, K2]
Java.
25. Explain the use of the extends and super keywords with suitable [CO1, LOT, K2]
examples.
PART C
1. Discuss in detail the principles of Object-Oriented Programming [CO1, HOT, K3]
(OOP) with relevant examples.
2. Explain the Java Program Execution Process in detail. [CO1, HOT, K3]
3. Explain Java data types, variables, and arrays with examples. [CO1, HOT, K3]
4. Explain the different operators in Java with suitable examples. [CO1, HOT, K3]
5. Explain the different control statements available in Java with [CO1, HOT, K3]
examples.
6. Explain Classes and Objects with a simple Java program. [CO1, HOT, K3]
7. Explain constructors in Java. With examples, explain the various types [CO1, HOT, K3]
of constructors.
8. Explain Method Overriding with a simple Java program. [CO1, HOT, K3]
9. Explain the different Access Specifiers with examples. [CO1, HOT, K4]
10. Explain Static Members in Java with a suitable program. [CO1, HOT, K4]
11. Discuss the concept of Inheritance and its types in Java. Write a simple [CO1, HOT, K5]
program to implement Single Inheritance.
12. Differentiate Method Overloading and Method Overriding with [CO1, HOT, K4]
examples.
13. Develop a Java program to create an Employee class with employee [CO1, HOT, K6]
ID, name, and salary. Initialize the values using a parameterized
constructor and display the details.
14. a) Write a Java program to demonstrate the use of static members. [CO1, HOT, K4]
b) Write a Java program to find the largest and smallest element [CO1, HOT, K4]
in an array.
15. Create a Java program to perform matrix addition using two- [CO1, HOT, K6]
dimensional arrays.
ARASU ENGINEERING COLLEGE, KUMBAKONAM-612 501
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
Question Bank
Sub. Code &Name: CS25C09 & Java Programming
Year/Sem/Branch : II/III/CSE-B Regulation: 2025 Academic year: 2026-2027 (Odd)
Staff Name : Mrs. R. Priyadharshini
UNIT II- JAVA CONCEPTUAL FOUNDATIONS AND CAPABILITIES
1. A Java package mainly helps to
A) Increase execution speed
B) Organize related classes and interfaces
C) Create objects
D) Handle exceptions
2. Which package is imported automatically in every Java program?
A) [Link]
B) [Link]
C) [Link]
D) [Link]
3. Which statement is correct about interfaces?
A) An interface can be instantiated directly.
B) An interface provides complete implementation.
C) A class can implement multiple interfaces.
D) An interface contains constructors.
4. Which keyword is used to define an interface?
A) class
B) interface
C) Interface
D) implements
5. Which of the following is NOT a benefit of using packages?
A) Prevents naming conflicts
B) Provides access protection
C) Organizes related classes
D) Increases memory usage
6. Which block contains code that may generate an exception?
A) catch
B) finally
C) try
D) throw
7. Which keyword is used to create a user-defined exception?
A) catch
B) throw
C) extends
D) package
8. Which exception is a checked exception?
A) ArithmeticException
B) IOException
C) NullPointerException
D) ArrayIndexOutOfBoundsException
9. Which exception occurs when converting an invalid string to an integer?
A) IOException
B) NumberFormatException
C) ArithmeticException
D) NullPointerException
10. Which block is optional in exception handling?
A) try
B) catch
C) finally
D) Both catch and finally (one of them must be present)
11. Multithreading allows a program to
A) Run only one task
B) Execute multiple tasks simultaneously
C) Compile faster
D) Reduce memory size
12. Which method pauses the execution of the current thread for a specified time?
A) stop()
B) wait()
C) sleep()
D) suspend()
13. Which thread is created automatically when a Java program starts?
A) Child thread
B) Daemon thread
C) Main thread
D) Runnable thread
14. Which method waits for one thread to finish before another continues?
A) sleep()
B) wait()
C) join()
D) run()
15. Which interface should be implemented to create a thread without extending the Thread class?
A) Serializable
B) Runnable
C) Comparable
D) Cloneable
16. Which keyword is used to declare an enumeration?
A) constant
B) enum
C) final
D) static
17. An enum is mainly used to represent
A) Variables
B) Fixed set of constants
C) Arrays
D) Objects
18. Which process converts a wrapper object into its corresponding primitive type automatically?
A) Autoboxing
B) Unboxing
C) Casting
D) Parsing
19. Which wrapper class corresponds to the primitive type double?
A) Double
B) Float
C) Integer
D) Long
20. Which annotation indicates that a method should not be used because it is outdated?
A) @Override
B) @FunctionalInterface
C) @Deprecated
D) @SafeVarargs
21. Which annotation is used to declare that an interface contains only one abstract method?
A) @Override
B) @Deprecated
C) @FunctionalInterface
D) @SuppressWarnings
22. What is the main advantage of Generics?
A) Slower execution
B) Type safety
C) Increased memory usage
D) Automatic inheritance
23. Which collection class commonly uses Generics?
A) ArrayList
B) Scanner
C) Math
D) System
24. Which declaration correctly creates a generic ArrayList of Strings?
A) ArrayList list = new ArrayList();
B) ArrayList<String> list = new ArrayList<String>();
C) ArrayList(int) list;
D) String<ArrayList> list;
25. Lambda expressions were introduced in Java
A) Java 5
B) Java 6
C) Java 7
D) Java 8
26. Lambda expressions mainly work with
A) Functional Interfaces
B) Packages
C) Arrays
D) Exceptions
27. Which of the following is a valid lambda expression?
A) (x)->x*x
B) lambda(x)
C) => x*x
D) function(x)
28. Which feature reduces the amount of code required for implementing interfaces with one abstract
method?
A) Threads
B) Packages
C) Lambda Expressions
D) Arrays
29. Which of the following Java features improves code reusability and type safety?
A) Exception Handling
B) Generics
C) Packages
D) Threads
30. Which of the following topics was introduced in Java 8?
A) Packages
B) Interfaces
C) Lambda Expressions
D) Exceptions
PART B
1. Define a package. What are its advantages? [CO2, LOT, K2]
2. Identify the purpose of the import statement. Give an example. [CO2, LOT, K2]
3. Differentiate between a package and an interface. [CO2, LOT, K2]
4. What is an interface? State its features. [CO2, LOT, K2]
5. Differentiate between an abstract class and an interface. [CO2, LOT, K2]
6. Mention the use of implements and extends keywords with respect to [CO2, LOT, K1]
interfaces.
7. What is an exception? Why is exception handling needed? [CO2, LOT, K2]
8. Write the purpose of the try, catch, and finally blocks. [CO2, LOT, K2]
9. Differentiate between checked exceptions and unchecked exceptions. [CO2, LOT, K2]
10. Give the use of throw and throws keywords with examples. [CO2, LOT, K2]
11. List any four common exceptions in Java and state when they occur. [CO2, LOT, K2]
12. What is a thread? Mention its advantages. [CO2, LOT, K2]
13. Mention the two ways of creating a thread in Java. [CO2, LOT, K1]
14. Differentiate between the start() method and the run() method. [CO2, LOT, K2]
15. What is the purpose of the sleep() and join() methods? [CO2, LOT, K2]
16. State any three advantages of multithreading. [CO2, LOT, K2]
17. What is an Enumeration (enum)? Write a simple example. [CO2, LOT, K3]
18. Define Autoboxing and Unboxing . [CO2, LOT, K1]
19. What are wrapper classes? Name any four wrapper classes. [CO2, LOT, K1]
20. What are annotations? Mention any three commonly used annotations in [CO2, LOT, K1]
Java.
21. What are Generics? State their advantages. [CO2, LOT, K2]
22. Give the syntax of a generic class with an example. [CO2, LOT, K2]
23. Why are Generics used in Java? Mention any three benefits. [CO2, LOT, K2]
24. What is a Lambda Expression? Write its basic syntax. [CO2, LOT, K2]
25. List the advantages of Lambda Expressions. Give a simple example. [CO2, LOT, K2]
PART C
1. Explain the concept of Packages in Java with suitable examples. [CO2, HOT, K4]
2. Explain Interfaces in Java. Describe their features, advantages, and [CO2, HOT, K4]
implementation with a suitable Java program.
3. Explain Packages and Interfaces in detail. Compare them with suitable [CO2, HOT, K4]
examples.
4. Explain Exception Handling in Java. Discuss the use of try, catch, [CO2, HOT, K4]
throw, throws, and finally with examples.
5. Write a Java program to simulate an online payment system. If the [CO2, HOT, K6]
payment amount is less than the total bill amount, throw an exception
and handle it appropriately.
6. Describe the different types of exceptions in Java. [CO2, HOT, K3]
7. Explain Multithreaded Programming in Java. Describe the two [CO2, HOT, K4]
methods of creating threads with suitable programs.
8. Explain the Thread Life Cycle. Discuss the use of start(), run(), [CO2, HOT, K3]
sleep(), and join() methods with examples.
9. Explain Enumerations (enum) in Java. Write a Java program to [CO2, HOT, K4]
demonstrate the use of an enumeration.
10. Explain Autoboxing and Unboxing. Discuss the role of wrapper classes [CO2, HOT, K4]
with suitable examples.
11. What are Annotations? Explain the commonly used annotations [CO2, HOT, K4]
(@Override, @Deprecated, and @FunctionalInterface) with examples.
12. Explain Generics in Java. Discuss their advantages and write a program [CO2, HOT, K4]
using a generic class or generic method.
13. Explain Lambda Expressions in Java. Describe their syntax, [CO2, HOT, K4]
advantages, and applications with suitable examples.
14. Write a Java program that demonstrates the use of Packages, Interfaces, [CO2, HOT, K4]
and Exception Handling. Explain the program and its output.
15. Develop a Java application that demonstrates Multithreading, Generics, [CO2, HOT, K4]
and Lambda Expressions. Explain with an example program.
ARASU ENGINEERING COLLEGE, KUMBAKONAM-612 501
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
Question Bank
Sub. Code &Name: CS25C09 & Java Programming
Year/Sem/Branch : II/III/CSE-B Regulation: 2025 Academic year: 2026-2027 (Odd)
Staff Name : Mrs. R. Priyadharshini
Unit III - Java Core Libraries
PART A
1. Which class is used to represent a sequence of characters in Java?
A) Character
B) String
C) StringBuffer
D) StringBuilder
2. Which package contains the String class?
A) [Link]
B) [Link]
C) [Link]
D) [Link]
3. Which method is used to find the length of a string?
A) size()
B) length()
C) count()
D) getLength()
4. Which method is used to compare two strings for equality?
A) compare()
B) equals()
C) match()
D) equal()
5. Which class allows modification of string contents without creating a new object?
A) String
B) Character
C) StringBuffer
D) Integer
6. Which package is imported automatically in every Java program?
A) [Link]
B) [Link]
C) [Link]
D) [Link]
7. Which class in [Link] is used to perform mathematical operations?
A) System
B) Math
C) Integer
D) Double
8. Which method of the System class is used to display output on the console?
A) [Link]()
B) [Link]()
C) [Link]()
D) [Link]()
9. Which utility package contains the Scanner class?
A) [Link]
B) [Link]
C) [Link]
D) [Link]
10. Which utility class is commonly used to generate random numbers?
A) Random
B) Math
C) Scanner
D) Date
11. Which package provides classes for file handling in Java?
A) [Link]
B) [Link]
C) [Link]
D) [Link]
12. Which class is used to read data from a file character by character?
A) FileReader
B) FileWriter
C) Scanner
D) PrintWriter
13. Which class is used to write characters into a file?
A) FileReader
B) BufferedReader
C) FileWriter
D) InputStream
14. Which event is generated when a button is clicked?
A) MouseEvent
B) ActionEvent
C) KeyEvent
D) WindowEvent
15. Which interface is implemented to handle button click events?
A) MouseListener
B) KeyListener
C) ActionListener
D) WindowListener
16. Which AWT control is used to receive a single line of text from the user?
A) Label
B) TextField
C) TextArea
D) Button
17. Which AWT control is used to display non-editable text?
A) Label
B) TextField
C) Checkbox
D) Choice
18. Which layout manager is the default layout for a Frame?
A) GridLayout
B) BorderLayout
C) FlowLayout
D) CardLayout
19. Which layout manager arranges components from left to right?
A) GridLayout
B) BorderLayout
C) FlowLayout
D) CardLayout
20. Which layout manager arranges components in rows and columns of equal size?
A) BorderLayout
B) GridLayout
C) FlowLayout
D) GridBagLayout
PART B
1. What is a String in Java? Mention its characteristics. [CO3, LOT,K1]
2. Differentiate between String and StringBuffer. [CO3, LOT,K2]
3. List any three commonly used String methods with examples. [CO3, LOT,K1]
4. Differentiate between the equals() method and the == operator for [CO3, LOT,K2]
strings.
5. What is the [Link] package? Name any four classes available in it. [CO3, LOT,K1]
6. What is the purpose of the Math class? Give some examples. [CO3, LOT,K2]
7. Write short notes on the System class. [CO3, LOT,K2]
8. What are Utility Classes in Java? Name any four utility classes. [CO3, LOT,K1]
9. Mention the use of the Scanner class with an example. [CO3, LOT,K2]
10. What is the purpose of the Random class? Give a simple example. [CO3, LOT,K2]
11. What is the [Link] package? Mention its uses. [CO3, LOT,K1]
12. Differentiate between FileReader and FileWriter. [CO3, LOT,K2]
13. Write the purpose of BufferedReader and BufferedWriter. [CO3, LOT,K2]
14. What is File Handling? List the commonly used file handling classes [CO3, LOT,K1]
in Java.
15. What is an Event in Java? Mention the steps involved in event [CO3, LOT,K1]
handling.
16. What is an ActionEvent? Explain the role of the ActionListener [CO3, LOT,K1]
interface.
17. Write any four AWT controls with their uses. [CO3, LOT,K1]
18. Differentiate between TextField and TextArea. [CO3, LOT,K2]
19. What is a Layout Manager? Explain any three layout managers used [CO3, LOT,K1]
in Java.
20. Differentiate between FlowLayout, BorderLayout, and GridLayout. [CO3, LOT,K2]
PART C
1. Explain String Handling in Java. Discuss the various string methods [CO3, HOT, K4]
and classes with suitable examples.
2. Discuss the various classes available in [Link] package with [CO3, HOT, K4]
suitable examples.
3. Explain the purpose of various Utility Classes in Java with suitable [CO3, HOT, K4]
examples.
4. Explain the [Link] package in detail. Discuss the commonly used [CO3, HOT, K4]
classes for file input and output with suitable Java programs.
5. Explain Event Handling in Java. Describe the Event Delegation Model [CO3, HOT, K4]
and explain the use of ActionListener with a suitable program.
6. Explain the different AWT Controls. Describe the purpose of each [CO3, HOT, K4]
controls with suitable examples.
7. Explain the different Layout Managers in Java. Compare FlowLayout, [CO3, HOT, K4]
BorderLayout, GridLayout, and CardLayout with suitable examples.
8. Create a Java program to demonstrate String handling, file handling, [CO3, HOT, K4]
and event handling. Explain the program and its output.
9. Develop a Java application using AWT Controls and Layout Managers. [CO3, HOT, K5]
Explain the working of the program with a neat diagram and output.
10. a. 10.a. Develop a Java-based student registration form using appropriate [CO3, HOT, K6]
AWT controls..
b. Develop a Java GUI application that performs addition of two numbers [CO3, HOT, K6]
when the user clicks a button
ARASU ENGINEERING COLLEGE, KUMBAKONAM-612 501
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
Question Bank
Sub. Code &Name: CS25C09 & Java Programming
Year/Sem/Branch : II/III/CSE-B Regulation: 2025 Academic year: 2026-2027 (Odd)
Staff Name : Mrs. R. Priyadharshini
Unit IV - I/O and GUI Programming in Java
PART A
1. Which class is commonly used to read input from the keyboard in Java?
A) FileReader
B) Scanner
C) FileWriter
D) Random
2. Which package contains the Scanner class?
A) [Link]
B) [Link]
C) [Link]
D) [Link]
3. Which method is used to read an integer using the Scanner class?
A) readInt()
B) nextInteger()
C) nextInt()
D) getInt()
4. Which stream is used to display output on the console?
A) [Link]
B) [Link]
C) [Link]
D) [Link]
5. Which package provides classes for file input and output?
A) [Link]
B) [Link]
C) [Link]
D) [Link]
6. Which class is used to read characters from a file?
A) FileWriter
B) FileReader
C) Scanner
D) PrintWriter
7. Which class is used to write characters into a file?
A) FileReader
B) BufferedReader
C) FileWriter
D) InputStream
8. Which exception is commonly associated with file operations?
A) ArithmeticException
B) IOException
C) NullPointerException
D) ArrayIndexOutOfBoundsException
9. Which Swing package contains GUI components?
A) [Link]
B) [Link]
C) [Link]
D) [Link]
10. Which Swing component is used to create a window?
A) JPanel
B) JFrame
C) JLabel
D) JButton
11. Which Swing component is used to display text that cannot be edited?
A) JTextField
B) JTextArea
C) JLabel
D) JButton
12. Which Swing component is used to receive a single line of text from the user?
A) JLabel
B) JTextField
C) JTextArea
D) JCheckBox
13. Which Swing component is used to create a clickable button?
A) JButton
B) JLabel
C) JMenu
D) JPanel
14. Which Swing component is used to display multiple lines of text?
A) JTextField
B) JTextArea
C) JLabel
D) JMenuBar
15. Which class is used to create a menu bar in Swing?
A) JMenu
B) JMenuItem
C) JMenuBar
D) JPanel
16. Which class represents a menu in Swing?
A) JMenuBar
B) JMenu
C) JMenuItem
D) JFrame
17. Which class represents an item inside a menu?
A) JMenuBar
B) JMenu
C) JMenuItem
D) JButton
18. Swing components are mainly derived from which class?
A) JFrame
B) JComponent
C) Object
D) Container
19. Which statement is used to close a Swing window when the user clicks the close button?
A) setVisible(false);
B) dispose();
C) setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
D) close();
20. Which of the following is an advantage of Swing over AWT?
A) Platform dependent
B) Lightweight components
C) Does not support GUI
D) Uses only native components
PART B
1. What is Console I/O in Java? Mention its uses. [CO3, LOT,K1]
2. Implement the Scanner class with a simple example. [CO3, LOT,K3]
3. Differentiate between [Link] and [Link]. [CO3, LOT,K2]
4. List any three methods of the Scanner class. [CO3, LOT,K1]
5. Write a short note on BufferedReader. [CO3, LOT,K2]
6. What is File Handling? Why is it used in Java? [CO3, LOT,K1]
7. Differentiate between FileReader and FileWriter. [CO3, LOT,K2]
8. Write the purpose of the File class in Java. [CO3, LOT,K2]
9. What is IOException? When does it occur? [CO3, LOT,K1]
10. List any four classes available in the [Link] package and mention [CO3, LOT,K1]
their uses.
11. What is Swing? Mention its advantages over AWT. [CO3, LOT,K1]
12. Explain the purpose of JFrame and JPanel. [CO3, LOT,K2]
13. Differentiate between JLabel and JTextField. [CO3, LOT,K2]
14. Mention the uses of JButton, JTextArea, and JCheckBox. [CO3, LOT,K2]
15. List any six commonly used Swing components and state their [CO3, LOT,K1]
purpose.
16. What is a Menu in Java Swing? Name its main components. [CO3, LOT,K1]
17. Differentiate between JMenuBar, JMenu, and JMenuItem. [CO3, LOT,K2]
18. List the steps involved in creating a menu in a Swing application. [CO3, LOT,K2]
19. Write a short note on Popup Menu (JPopupMenu). [CO3, LOT,K2]
20. Explain how ActionListener is used with menu items in Swing. [CO3, LOT,K2]
PART C
1. Explain Console Input and Output in Java. Write a program using the [CO3, HOT,K4]
Scanner class.
2. Explain File Handling in Java. Write a program to read data from a file [CO3, HOT,K4]
and write data into a file.
3. Explain the [Link] package. Describe the commonly used file handling [CO3, HOT,K4]
classes with examples.
4. Explain Swing in Java. Write a simple program to create a GUI using [CO3, HOT,K4]
JFrame and JButton.
5. Explain the commonly used Swing components such as JFrame, JPanel, [CO3, HOT,K4]
JLabel, JTextField, JButton, and JTextArea with examples.
6. Explain Menus in Java Swing. Write a program to create a menu using [CO3, HOT,K4]
JMenuBar, JMenu, and JMenuItem.
7. Develop a Java application using Swing. Include labels, text fields, [CO3, HOT,K6]
buttons, and text areas, and explain the output.
8. Explain the difference between AWT and Swing. Give suitable [CO3, HOT,K4]
examples.
9. Write a Java program to create a GUI application with a menu and [CO3, HOT,K4]
perform a simple action when a menu item is selected.
10. Explain Console I/O, File Handling, Swing, and Menus with suitable [CO3, HOT,K4]
examples.
ARASU ENGINEERING COLLEGE, KUMBAKONAM-612 501
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
Question Bank
Sub. Code &Name: CS25C09 & Java Programming
Year/Sem/Branch : II/III/CSE-B Regulation: 2025 Academic year: 2026-2027 (Odd)
Staff Name : Mrs. R. Priyadharshini
Unit V -Database Connectivity Using Java (JDBC)
1. What does JDBC stand for?
A) Java Database Connectivity
B) Java Data Base Connection
C) Java Driver Connectivity
D) Java Dynamic Connection
2. Which package provides JDBC classes and interfaces?
A) [Link]
B) [Link]
C) [Link]
D) [Link]
3. What is the main purpose of JDBC?
A) To create GUI applications
B) To connect Java applications with databases
C) To create threads
D) To handle exceptions
4. Which interface is used to establish a connection with a database?
A) Driver
B) Connection
C) Statement
D) ResultSet
5. Which class is used to establish a JDBC connection?
A) Driver
B) DriverManager
C) Connection
D) Statement
6. How many types of JDBC drivers are available?
A) Two
B) Three
C) Four
D) Five
7. Which JDBC driver is also called the JDBC-ODBC Bridge Driver?
A) Type 1
B) Type 2
C) Type 3
D) Type 4
8. Which JDBC driver is known as the Native API Driver?
A) Type 1
B) Type 2
C) Type 3
D) Type 4
9. Which JDBC driver is known as the Network Protocol Driver?
A) Type 1
B) Type 2
C) Type 3
D) Type 4
10. Which JDBC driver is known as the Thin Driver?
A) Type 1
B) Type 2
C) Type 3
D) Type 4
11. Which method is used to load a JDBC driver?
A) loadDriver()
B) [Link]()
C) [Link]()
D) connect()
12. Which interface is used to execute SQL queries?
A) Connection
B) Statement
C) Driver
D) ResultSet
13. Which method executes a SELECT query?
A) execute()
B) executeQuery()
C) executeUpdate()
D) executeSelect()
14. Which method is used for INSERT, UPDATE, and DELETE operations?
A) executeQuery()
B) executeUpdate()
C) execute()
D) executeSelect()
15. Which object stores the result returned by a SELECT query?
A) Connection
B) Statement
C) ResultSet
D) Driver
16. Which method moves the cursor to the next row in a ResultSet?
A) next()
B) move()
C) row()
D) first()
17. Which method is used to close a database connection?
A) stop()
B) end()
C) close()
D) disconnect()
18. Which package contains the DriverManager class?
A) [Link]
B) [Link]
C) [Link]
D) [Link]
19. Which SQL statement is used to retrieve data from a database?
A) INSERT
B) UPDATE
C) SELECT
D) DELETE
20. Which SQL statement is used to add new records?
A) INSERT
B) SELECT
C) UPDATE
D) CREATE
21. Which SQL statement is used to modify existing records?
A) INSERT
B) UPDATE
C) SELECT
D) DELETE
22. Which SQL statement is used to remove records from a table?
A) DROP
B) DELETE
C) REMOVE
D) ERASE
23. Which interface represents an active connection between Java and the database?
A) Statement
B) Connection
C) Driver
D) ResultSet
24. Which JDBC component sends SQL statements to the database?
A) DriverManager
B) Connection
C) Statement
D) ResultSet
25. Which method is commonly used to obtain data from a ResultSet?
A) getString()
B) getResult()
C) getValue()
D) getData()
26. Which method is used to establish a database connection?
A) [Link]()
B) [Link]()
C) [Link]()
D) [Link]()
27. Which JDBC interface is used for executing precompiled SQL statements?
A) Statement
B) PreparedStatement
C) CallableStatement
D) Driver
28. Which JDBC interface is used to execute stored procedures?
A) Statement
B) PreparedStatement
C) CallableStatement
D) ResultSet
29. Which JDBC driver type is considered the fastest?
A) Type 1
B) Type 2
C) Type 3
D) Type 4
30. What is the correct sequence of JDBC operations?
A) Execute Query → Load Driver → Close Connection → Establish Connection
B) Load Driver → Establish Connection → Create Statement → Execute Query → Process Result →
Close Connection
C) Create Statement → Load Driver → Execute Query → Connect Database
D) Load Driver → Execute Query → Process Result → Establish Connection
PART B
1. What is JDBC? Mention its advantages. [CO4,LOT,K2]
2. List the components available in the architecture of JDBC. [CO4,LOT,K2]
3. What are the applications of JDBC? [CO4,LOT,K2]
4. List the steps involved in connecting a Java application to a database using [CO4,LOT,K2]
JDBC.
5. What is the role of the DriverManager class? [CO4,LOT,K2]
6. List the four types of JDBC drivers. [CO4,LOT,K1]
7. Differentiate between Type 1 (JDBC-ODBC Bridge) and Type 4 (Thin [CO4,LOT,K2]
Driver).
8. Which JDBC driver is most commonly used today? Why? [CO4,LOT,K2]
9. State the advantages and disadvantages of the JDBC-ODBC Bridge [CO4,LOT,K2]
Driver.
10. What is the [Link] package? Mention any four classes or interfaces [CO4,LOT,K1]
available in it.
11. Mention the purpose of the following JDBC interfaces: [CO4,LOT,K2]
Connection
Statement
ResultSet
12. What is the purpose of the PreparedStatement interface? [CO4,LOT,K2]
13. What is the JDBC API? Mention its main components. [CO4,LOT,K1]
14. Differentiate between Statement and PreparedStatement. [CO4,LOT,K2]
15. Give the purpose of the ResultSet interface. [CO4,LOT,K2]
16. Differentiate between executeQuery() and executeUpdate() methods. [CO4,LOT,K2]
17. What is the JDBC-ODBC Bridge Driver? Mention its uses. [CO4,LOT,K1]
18. List the steps involved in associating the JDBC-ODBC Bridge with a [CO4,LOT,K2]
database.
19. How is a database connection established using JDBC? [CO4,LOT,K2]
20. Explain how to retrieve data from a database using JDBC. [CO4,LOT,K2]
21. Explain how to insert records into a database using JDBC. [CO4,LOT,K2]
22. Explain how to update and delete records using JDBC. [CO4,LOT,K2]
23. Discuss briefly on Connection, Statement, and ResultSet. [CO4,LOT,K2]
24. What is the purpose of the close() method in JDBC? Why is it important? [CO4,LOT,K2]
25. Explain the complete JDBC workflow from loading the driver to closing [CO4,LOT,K2]
the database connection.
PART C
1. Explain JDBC architecture. Describe the steps involved in connecting a [CO4, HOT, K3]
Java application to a database with a neat diagram.
2. Explain JDBC in detail. Write a Java program to connect a database using [CO4, HOT, K3]
JDBC.
3. Explain the four types of JDBC drivers. Compare their advantages and [CO4, HOT, K3]
disadvantages.
4. Explain the JDBC API. Describe the important classes and interfaces such [CO4, HOT, K3]
as DriverManager, Connection, Statement, PreparedStatement, and
ResultSet.
5. Explain the [Link] package. Describe the commonly used classes and [CO4, HOT, K3]
interfaces with suitable examples.
6. Explain how to establish a database connection using JDBC. Write a Java [CO4, HOT, K3]
program to connect to a database.
7. Explain the steps involved in executing SQL statements using JDBC. [CO4, HOT, K4]
Write programs for INSERT, UPDATE, DELETE, and SELECT
operations.
8. Explain the Statement, PreparedStatement, and CallableStatement [CO4, HOT, K3]
interfaces. Compare them with suitable examples.
9. Explain the ResultSet interface. Describe how records are retrieved and [CO4, HOT, K3]
processed from a database using JDBC.
10. Explain the JDBC-ODBC Bridge Driver. Describe the procedure for [CO4, HOT, K3]
associating the JDBC-ODBC Bridge with a database.
11. Create a Java program to perform database operations. Explain how to [CO4, HOT, K6]
insert, update, delete, and retrieve records using JDBC.
12. Develop a Java application using JDBC. Connect to a database and display [CO4, HOT, K6]
all records from a table. Explain the program and output.
13. Explain the complete JDBC workflow. Describe the process from loading [CO4, HOT, K4]
the driver to closing the database connection.
14. Write short notes on JDBC packages and drivers. [CO4, HOT, K4]
15. Explain Database Connectivity using Java. Discuss JDBC drivers, [CO4, HOT, K4]
packages, database connection, and SQL operations with suitable
examples.
ARASU ENGINEERING COLLEGE, KUMBAKONAM-612 501
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
Question Bank
Sub. Code &Name: CS25C09 & Java Programming
Year/Sem/Branch : II/III/CSE-B Regulation: 2025 Academic year: 2026-2027 (Odd)
Staff Name : Mrs. R. Priyadharshini
Unit 6 - Java Collection Frame Work
1. What is the main purpose of the Java Collection Framework?
A) To create GUI applications
B) To store and manipulate groups of objects
C) To connect to databases
D) To handle exceptions
2. Which package contains the Collection Framework?
A) [Link]
B) [Link]
C) [Link]
D) [Link]
3. Which interface is the root interface of the Collection Framework?
A) List
B) Set
C) Collection
D) Map
4. Which Collection allows duplicate elements?
A) Set
B) HashSet
C) List
D) TreeSet
5. Which Collection does NOT allow duplicate elements?
A) ArrayList
B) LinkedList
C) HashSet
D) Vector
6. Which class implements the List interface?
A) HashMap
B) ArrayList
C) HashSet
D) TreeMap
7. Which class implements the Set interface?
A) LinkedList
B) Vector
C) HashSet
D) ArrayList
8. Which method is used to add an element to a collection?
A) put()
B) insert()
C) add()
D) append()
9. Which method is used to remove an element from a collection?
A) delete()
B) remove()
C) clear()
D) erase()
10. Which regular expression symbol matches any single character?
A) *
B) +
C) .
D) ?
11. Which regular expression symbol represents zero or more occurrences?
A) +
B) *
C) ?
D) .
12. Which class is used to work with regular expressions in Java?
A) Scanner
B) Pattern
C) StringBuffer
D) Random
13. Which method is used to compare a string with a regular expression?
A) compare()
B) equals()
C) matches()
D) contains()
14. Which class in [Link] is used to read user input?
A) Random
B) Scanner
C) Arrays
D) Date
15. Which utility class provides methods for sorting arrays?
A) Math
B) Arrays
C) String
D) System
16. Which method is used to sort an array?
A) [Link]()
B) sortArray()
C) [Link]()
D) [Link]()
17. Which utility class provides methods for sorting collections?
A) Arrays
B) Collections
C) Scanner
D) Random
18. Which interface stores data as key-value pairs?
A) List
B) Set
C) Collection
D) Map
19. Which class implements the Map interface?
A) ArrayList
B) LinkedList
C) HashMap
D) HashSet
20. Which method is used to insert data into a Map?
A) add()
B) put()
C) insert()
D) append()
21. Which interface is used to traverse elements of a collection?
A) Enumeration
B) Iterator
C) Collection
D) List
22. Which method checks whether an Iterator has more elements?
A) next()
B) hasNext()
C) hasMore()
D) check()
23. Which method returns the next element in an Iterator?
A) next()
B) get()
C) read()
D) fetch()
24. What is the main advantage of Generics?
A) Reduces type safety
B) Increases memory usage
C) Provides compile-time type checking
D) Slows program execution
25. Which syntax is used to declare a generic class?
A) class Box<T> { }
B) class Box() { }
C) class<T> Box { }
D) generic class Box { }
PART B
1. What is the Java Collection Framework? Mention its advantages. [C05, LOT, K1]
2. Mention the use of Collection interface. List any four classes that [C05, LOT, K1]
implement it.
3. Differentiate between List and Set. [C05, LOT, K1]
4. Differentiate between ArrayList and LinkedList. [C05, LOT, K1]
5. Explain the HashSet class with its features. [C05, LOT, K1]
6. Differentiate between List, Set, and Map. [C05, LOT, K1]
7. What is the purpose of the Collections class? Mention any three methods. [C05, LOT, K1]
8. What is a Regular Expression (Regex)? Mention its uses. [C05, LOT, K1]
9. List the purpose of the Pattern and Matcher classes. [C05, LOT, K1]
10. Describe the matches() method with an example. [C05, LOT, K1]
11. What is the [Link] package? Name any five classes available in it. [C05, LOT, K1]
12. Demonstrate the Scanner class with a simple example. [C05, LOT, K1]
13. What is Arrays class? Mention any four commonly used methods. [C05, LOT, K1]
14. Differentiate between Arrays and Collections. [C05, LOT, K1]
15. What is the purpose of [Link]() and [Link]()? [C05, LOT, K1]
16. Explain how to perform search and sort elements in an array. [C05, LOT, K1]
17. What is the Map interface? Mention its features. [C05, LOT, K1]
18. Differentiate between HashMap and Hashtable. [C05, LOT, K1]
19. Mention the use of put(), get(), and remove() methods of the Map [C05, LOT, K1]
interface.
20. List the advantages of using HashMap. [C05, LOT, K1]
21. What is an Iterator? Mention its advantages. [C05, LOT, K1]
22. Define the hasNext(), next(), and remove() methods of the Iterator [C05, LOT, K1]
interface.
23. What are Generics? Mention their advantages. [C05, LOT, K1]
24. Explain the syntax of a Generic Class with a simple example. [C05, LOT, K1]
25. Differentiate between Generic Classes and Generic Methods. [C05, LOT, K1]
PART C
1. Explain the Java Collection Framework. Describe its architecture, [CO5, HOT,K4]
interfaces, classes, and advantages with suitable examples.
2. Explain the Collection Framework interfaces. Discuss List, Set, Queue, and [CO5, HOT,K4]
Map with suitable examples.
3. Explain the List interface. Compare ArrayList, LinkedList, and Vector with [CO5, HOT,K4]
suitable examples.
4. Explain the Set interface. Describe HashSet, LinkedHashSet, and TreeSet [CO5, HOT,K4]
with suitable examples.
5. Explain Regular Expressions (Regex) in Java. Describe the Pattern and [CO5, HOT,K4]
Matcher classwith suitable examples.
6. Explain the [Link] package. Describe the commonly used classes such as [CO5, HOT,K4]
Scanner, Arrays, Collections, Random, and Date with examples.
7. Explain Arrays and Collections in Java. Compare them and describe the [CO5, HOT,K4]
methods used for sorting and searching.
8. Explain the Map interface. Describe HashMap, LinkedHashMap, and [CO5, HOT,K4]
TreeMap with suitable examples.
9. Explain the Iterator interface. Describe the methods hasNext(), next(), and [CO5, HOT,K4]
remove()with a simple program.
10. Explain Generics in Java. Describe Generic Classes and Generic Methods [CO5, HOT,K4]
with suitable examples.
11. Create a Java program using ArrayList. Perform operations such as adding, [CO5, HOT,K4]
removing, searching, and displaying elements. Explain the output.
12. Develop a Java program using HashMap. Perform insert, search, update, [CO5, HOT,K4]
and delete operations. Explain the output.
13. Develop a Java application using the Collection Framework. Demonstrate [CO5, HOT,K6]
the use of ArrayList, HashSet, and HashMap in one program.
14. Write a Java program to validate an email or mobile number using Regular [CO5, HOT,K4]
Expressions (Regex). Explain the program and output.
15. Explain the Java Collection Framework in detail. Discuss Collections, [CO5, HOT,K4]
Regex, the [Link] package, Arrays, Map, Iterators, and Generics with
suitable examples