0% found this document useful (0 votes)
3 views7 pages

Java

The document is a predicted question bank for the Object-Oriented Programming using Java course (24CSH-207) at Chandigarh University for the 4th semester of EST 2026. It includes short, medium, and long answer questions categorized by units covering Java fundamentals, I/O streams, multithreading, event handling, AWT/Swing, and JDBC. Each unit features a variety of questions designed to test knowledge and application of Java concepts, with a focus on practical programming skills.

Uploaded by

rishabhmangal117
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views7 pages

Java

The document is a predicted question bank for the Object-Oriented Programming using Java course (24CSH-207) at Chandigarh University for the 4th semester of EST 2026. It includes short, medium, and long answer questions categorized by units covering Java fundamentals, I/O streams, multithreading, event handling, AWT/Swing, and JDBC. Each unit features a variety of questions designed to test knowledge and application of Java concepts, with a focus on practical programming skills.

Uploaded by

rishabhmangal117
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

OOP using Java (24CSH-207) · 4th Sem EST 2026 Follow My Instagram · Click Here

CHANDIGARH UNIVERSITY · UIE · CSE · 4th SEMESTER · EST 2026


Object-Oriented Programming using Java
Subject Code: 24CSH-207
Predicted Question Bank — By MrDnobody
Lectures 1.1–1.10 (Unit 1) · 2.1–2.5 (Unit 2) · 3.1.1–3.1.3 (Unit 3)

Credit: MrDnobody

..............Short Answer Questions


2 Marks...5 × 2 = 10 Marks · BT Level 1–2 · 30 Questions Total (10 per Unit)

• UNIT 1 — Java Fundamentals & OOP Concepts Lectures 1.1–1.10 · CO1, CO2 · JVM ·
Classes · Inheritance · Exceptions

Q1 Recall the purpose of JVM and its role in running a Java program. What is the
difference between JDK, JRE, and JVM? ⋆
[CO1] [BT1] ▶ VERY HOT

Q2 List any four features of Java that distinguish it from C++.


[CO1] [BT1]

Q3 Define a constructor in Java. State how it differs from a regular method.


[CO1] [BT1] ▶ HOT

Q4 Define encapsulation. State why getter and setter methods are used in Java.
[CO1] [BT1]

Q5 What is method overloading? Give one example to justify it qualifies as compile-time


polymorphism.
[CO2] [BT2] ▶ HOT

Q6 Differentiate between abstract class and interface in Java. Can an abstract class
be instantiated? ⋆
[CO2] [BT2] ▶ VERY HOT

Q7 State the use of the super keyword in Java with a one-line example.
[CO1] [BT1]

Q8 Distinguish between throw and throws in Java exception handling. ⋆


[CO2] [BT2] ▶ HOT

Q9 Define an inner class in Java. Name its four types.


[CO1] [BT1]

Q10 State the difference between the this keyword in Java versus pointers in C++. ⋆
[CO1] [BT2] ▶ HOT

Predicted Question Bank · Based on Analysis of Syllabus


1 by MrDnobody Credit: MrDnobody
OOP using Java (24CSH-207) · 4th Sem EST 2026 Follow My Instagram · Click Here

• UNIT 2 — I/O Streams & Multithreading Lectures 2.1–2.5 · CO3 · Streams · Serialization ·
Threads · Synchronization

Q11 Define a stream in Java. Distinguish between byte-based streams and character-based
streams.
[CO3] [BT1] ▶ HOT

Q12 State the difference between FileInputStream and FileOutputStream with respect
to data flow direction.
[CO3] [BT2]

Q13 Define serialization in Java. Which interface must a class implement to be serializ-
able? ⋆
[CO3] [BT1] ▶ HOT

Q14 Differentiate between FileReader and FileWriter in Java. When is each used?
[CO3] [BT2] ▶ HOT

Q15 Summarize the differences between a thread and a process in Java. ⋆


[CO3] [BT2] ▶ VERY HOT

Q16 List all states in the Java thread lifecycle (New → Runnable → Running → Blocked
→ Dead).
[CO3] [BT1] ▶ HOT

Q17 Define thread synchronization. Why is it necessary in multithreaded programs?


[CO3] [BT1]

Q18 State the difference between creating a thread using Thread class versus Runnable
interface. Which is preferred and why? ⋆
[CO3] [BT2] ▶ HOT

Q19 Define the transient keyword in Java. How does it affect serialization?
[CO3] [BT1]

Q20 Define ByteArrayInputStream and state one use case where it is preferred over
FileInputStream.
[CO3] [BT1]

• UNIT 3 — Event Handling, AWT/Swing & JDBC Lectures 3.1.1–3.1.3 · CO4, CO5 · AWT ·
Event Handling · JDBC · Statements

Q21 Name the three main layout managers in Java AWT. State the default layout for
Frame. ⋆
[CO4] [BT1] ▶ HOT

Q22 Define event handling in Java. What is the role of ActionListener?


[CO4] [BT1]

Predicted Question Bank · Based on Analysis of Syllabus


2 by MrDnobody Credit: MrDnobody
OOP using Java (24CSH-207) · 4th Sem EST 2026 Follow My Instagram · Click Here

Q23 List the steps to establish a JDBC connection to a database in Java. ⋆


[CO5] [BT1] ▶ VERY HOT

Q24 State the difference between Statement and PreparedStatement in JDBC. Which
performs better and why? ⋆
[CO5] [BT2] ▶ HOT

Q25 Differentiate between AWT and Swing in Java GUI programming.


[CO4] [BT2]

Q26 Define a Container in AWT. Name its two subclasses with one use each.
[CO4] [BT1]

Q27 State the purpose of DriverManager class in JDBC. Write its syntax to get a connec-
tion.
[CO5] [BT1]

Q28 Define CallableStatement in JDBC. When is it used over PreparedStatement?


[CO5] [BT1]

Q29 Illustrate the concept of paint() method in Java AWT with its method signature. ⋆
[CO4] [BT2] ▶ HOT

Q30 Name any four AWT components and state the purpose of the setBounds() method.
[CO4] [BT1]

Predicted Question Bank · Based on Analysis of Syllabus


3 by MrDnobody Credit: MrDnobody
OOP using Java (24CSH-207) · 4th Sem EST 2026 Follow My Instagram · Click Here

Section B — Medium Answer Questions


5 Marks4 × 5 = 20 Marks · BT Level 3–4 · 15 Questions Total (5 per Unit)

• UNIT 1 — Java Fundamentals & OOP Concepts Demonstrate · Illustrate · Compare ·


Analyze

Q1 Implement method overloading to create multiple add() methods that handle different
parameter types (int, float, int+double). Explain how it achieves compile-time polymor-
phism. ⋆
[CO2] [BT3] ▶ VERY HOT

Q2 Compare abstract classes and interfaces in Java with respect to: instantiation, method
types, multiple inheritance, and use cases. Provide a code example demonstrating both. ⋆
[CO2] [BT4] ▶ VERY HOT

Q3 Demonstrate exception handling in Java using try, catch, finally, throw, and
throws. Write a program that also creates a user-defined exception. ⋆
[CO2] [BT3] ▶ VERY HOT

Q4 Illustrate different types of inheritance in Java — single, multilevel, and hierarchical


— with examples. Explain why Java does not support multiple inheritance through classes.
[CO2] [BT3] ▶ HOT

Q5 Explain encapsulation and data hiding in Java with a program demonstrating private
fields, public getters/setters. Also explain access modifiers: public, private, protected,
default.
[CO1] [BT3]

• UNIT 2 — I/O Streams & Multithreading Classify · Demonstrate · Compare · Write Programs

Q6 Illustrate the Java I/O stream hierarchy. Analyze the differences between
FileInputStream and BufferedInputStream in terms of performance and buffering, and
support with code. ⋆
[CO3] [BT4] ▶ VERY HOT

Q7 Demonstrate how to create, write, and read from a text file in Java us-
ing FileWriter and BufferedReader. Explain why buffered I/O is preferred over un-
buffered. ⋆
[CO3] [BT3] ▶ HOT

Q8 Demonstrate how threads are created using both (i) extending Thread class and (ii)
implementing Runnable interface. Write programs for both and compare. ⋆
[CO3] [BT3] ▶ VERY HOT

Q9 Explain thread synchronization in Java using the synchronized keyword. Write a


program demonstrating a race condition and its fix using synchronization. ⋆
[CO3] [BT4] ▶ HOT

Predicted Question Bank · Based on Analysis of Syllabus


4 by MrDnobody Credit: MrDnobody
OOP using Java (24CSH-207) · 4th Sem EST 2026 Follow My Instagram · Click Here

Q10 Explain object serialization and deserialization in Java with a complete code exam-
ple. Also demonstrate the effect of the transient keyword on serialized objects. ⋆
[CO3] [BT3] ▶ HOT

• UNIT 3 — Event Handling, AWT/Swing & JDBC Demonstrate · Analyze · Design Programs

Q11 Explain the JDBC architecture with a neat diagram. Discuss the four types of JDBC
drivers and explain why Type 4 (Thin Driver) is preferred for pure Java applications. ⋆
[CO5] [BT4] ▶ VERY HOT

Q12 Demonstrate how to connect to a database using JDBC and perform INSERT and
SELECT operations using PreparedStatement and ResultSet. ⋆
[CO5] [BT3] ▶ VERY HOT

Q13 Compare and differentiate Statement, PreparedStatement, and CallableStatement


interfaces in JDBC with respect to performance, use case, and syntax. ⋆
[CO5] [BT4] ▶ HOT

Q14 Illustrate event handling in Java AWT using ActionListener. Write a program with
Button, TextField, and Label components that responds to button click events. ⋆
[CO4] [BT3] ▶ HOT

Q15 Explain the roles of JPanel, JFrame, and JButton in a Java Swing application. Write
a program to create a simple login form using Swing components. ⋆
[CO4] [BT3] ▶ HOT

Predicted Question Bank · Based on Analysis of Syllabus


5 by MrDnobody Credit: MrDnobody
OOP using Java (24CSH-207) · 4th Sem EST 2026 Follow My Instagram · Click Here

Section C — Long Answer / Program-Based Questions


10 Marks
3 × 10 = 30 Marks · BT Level 4–5 · 9 Questions Total (3 per Unit)

• UNIT 1 — Java Fundamentals & OOP Concepts Analyze · Evaluate · Design · BT4–BT5

Q1 Critique the design of a Java program using only inheritance versus one using
both inheritance and interfaces. Design a Java program for a School Management System
(Teacher, Student, CollegeStudent classes) that demonstrates: multilevel inheritance, in-
terface implementation for multiple behaviour, and method overriding. Justify your design
choices. ⋆
[CO4] [BT5] ▶ VERY HOT · EXPECTED

Q2 Design a Java program demonstrating all four OOP pillars: encapsulation (private
fields + getters/setters), inheritance (base and derived class), polymorphism (method over-
riding + overloading), and abstraction (abstract class or interface). Evaluate the benefits
of each pillar in the context of code maintainability. ⋆
[CO5] [BT5] ▶ HOT

Q3 Critically evaluate Java’s exception handling mechanism. Write a Java program


that demonstrates: (i) checked vs unchecked exceptions, (ii) user-defined exception with
custom message, (iii) multi-catch block, (iv) finally block behaviour, and (v) exception
propagation using throws. Analyse what happens when finally contains a return state-
ment.
[CO4] [BT5] ▶ HOT

• UNIT 2 — I/O Streams & Multithreading Analyze · Evaluate · Design Programs · BT4–BT5

Q4 Analyse the differences between FileInputStream and BufferedInputStream in


terms of performance, use cases, and internal mechanism. Write a Java program that:
(i) reads a file using FileInputStream byte by byte, (ii) reads the same file using
BufferedInputStream, and (iii) compares the time/efficiency of both approaches. ⋆
[CO4] [BT4] ▶ VERY HOT · EXPECTED

Q5 Design a multithreaded Java program that reads data from a file and updates a
database simultaneously using two separate threads. Demonstrate the use of synchronized
method/block to prevent data inconsistency. Also illustrate the thread lifecycle during
program execution. ⋆
[CO5] [BT5] ▶ VERY HOT · EXPECTED

Q6 Evaluate the concept of object serialization and deserialization in Java. Write


a program that: (i) creates a class implementing Serializable, (ii) serializes an object
to a file using ObjectOutputStream, (iii) deserializes the object back, and (iv) demon-
strates the effect of transient variables. Justify when you would use serialization in real
applications. ⋆
[CO4] [BT5] ▶ HOT

• UNIT 3 — Event Handling, AWT/Swing & JDBC Evaluate · Design · Build Applications ·
BT4–BT5

Predicted Question Bank · Based on Analysis of Syllabus


6 by MrDnobody Credit: MrDnobody
OOP using Java (24CSH-207) · 4th Sem EST 2026 Follow My Instagram · Click Here

Q7 Justify the effectiveness of AWT event handling in managing GUI applications.


Write a Java AWT program that: (i) creates a Frame with multiple components (Button,
TextField, Label, Choice), (ii) uses ActionListener and ItemListener, and (iii) responds
to different events. Critically analyse the advantages and limitations of AWT over Swing. ⋆
[CO4] [BT5] ▶ VERY HOT · EXPECTED

Q8 Design a complete JDBC application that: (i) registers the JDBC driver and estab-
lishes connection using DriverManager, (ii) creates a Student table, (iii) inserts records
using PreparedStatement with parameterised queries, (iv) retrieves all records using
ResultSet, and (v) handles SQL exceptions properly. Justify why PreparedStatement
is preferred over Statement for insert operations.
[CO5] [BT5] ▶ VERY HOT · EXPECTED

Q9 Analyse the differences between Statement, PreparedStatement, and


CallableStatement in JDBC with respect to: SQL injection vulnerability, precom-
pilation, performance, and use case. Write separate code examples for each interface.
Evaluate which interface should be used for a banking application with frequent
parameterised queries. ⋆
[CO5] [BT4] ▶ HOT

Object-Oriented Programming using Java · 24CSH-207 · 4th Semester · Chandigarh University · EST
2026
Credit: MrDnobody

Predicted Question Bank · Based on Analysis of Syllabus


7 by MrDnobody Credit: MrDnobody

You might also like