GITA AUTONOMOUS COLLEGE, BHUBANESWAR
QUESTION BANK
Sem: 2nd Semester
Branch: CSE
Sub: Object Oriented Programing using JAVA
Part-1(72 Questions)
Modul
[Link] Short Answer Type Questions (2 marks) BL CO
e
1 What is Object-Oriented Programming? 1 1 CO1
2 Differentiate between compiler and interpreter. 1 1 CO1
3 List any four features of Java. 1 1 CO1
4 Why is Java platform-independent? 1 1 CO1
5 Define JVM. Why is it important? 1 1 CO1
6 Mention the differences between C++ and Java. 1 1 CO1
What are Java tokens? List any three with
7 1 CO1
examples. 1
8 What is typecasting in Java? 1 2 CO1
9 What is a loop? Name any two loop types in Java. 1 1 CO1
10 Write a syntax to take input using Scanner class. 1 3 CO1
What is a multidimensional array? Give a Java
11 2 CO1
syntax example. 1
12 Define command-line arguments. 1 2 CO1
What is the role of the BufferedReader class in
13 2 CO1
Java? 1
Mention any two conditional control statements
14 2 CO1
with examples. 1
15 Define class and object with examples. 2 1 CO2
16 What is the use of the this keyword in Java? 2 2 CO2
17 Define constructor. Mention its types. 2 2 CO2
Differentiate between data hiding and
18 2 CO2
encapsulation. 2
19 What is method overloading? 2 2 CO2
20 List the types of inheritance supported in Java. 2 1 CO2
21 What is the use of the super keyword? 2 2 CO2
22 Define polymorphism with an example. 2 2 CO2
23 Explain constructor overloading with syntax. 2 2 CO2
Differentiate between method overriding and
24 4 CO2
overloading. 2
25 What is dynamic method dispatch? 2 2 CO2
26 What are access modifiers? Name all. 2 1 CO2
27 What is an array of objects? 2 2 CO2
28 Why do we need static methods or variables? 2 2 CO2
29 Differentiate between String and StringBuffer. 3 2 CO3
30 Define wrapper classes with examples. 3 1 CO3
31 What is autoboxing and unboxing? 3 2 CO3
32 List the advantages of using interfaces. 3 2 CO3
Define abstract class. How is it different from a
33 2 CO3
concrete class? 3
What is multiple inheritance in Java? How is it
34 2 CO3
achieved? 3
35 Mention any two Java built-in packages. 3 1 CO3
36 What is exception handling in Java? 3 2 CO3
Differentiate between checked and unchecked
37 2 CO3
exceptions. 3
38 Define try-catch block with syntax. 3 3 CO3
What is the use of the finally block in exception
39 2 CO3
handling? 3
40 Define custom exception with example. 3 3 CO3
Name any two commonly used exception classes
41 1 CO3
in Java. 3
42 What is the use of the throws keyword? 3 2 CO3
43 What is a thread? 4 1 CO4
44 Differentiate between process and thread. 4 2 CO4
45 What are the two ways to define a thread in Java? 4 2 CO4
46 What is the use of the join() and sleep() methods? 4 2 CO4
47 Define synchronization in Java. Why is it needed? 4 2 CO4
48 What is a daemon thread? 4 1 CO4
49 List the types of inner classes in Java. 4 2 CO4
50 What is inter-thread communication? 4 2 CO4
Differentiate between byte stream and character
51 2 CO4
stream. 4
52 Define serialization in Java. 4 2 CO4
53 What are RandomAccessFiles used for? 4 3 CO4
Mention two important classes from the [Link]
54 1 CO4
package. 4
55 What is an anonymous inner class? 4 2 CO4
56 State one use case of using multithreading. 4 4 CO4
List any three interfaces from the Java Collections
57 1 CO5
Framework. 5
58 Differentiate between List and Set interfaces. 5 2 CO5
59 What is the use of the Map interface? 5 2 CO5
Mention any two classes that implement the List
60 1 CO5
interface. 5
61 What is an applet in Java? 5 2 CO5
62 What is the life cycle of an applet? 5 2 CO5
63 Define Swing. How is it different from AWT? 5 2 CO5
64 What is the use of the [Link] package? 5 2 CO5
65 Mention any two Swing components with use. 5 2 CO5
66 Write a simple syntax to create a JButton. 5 3 CO5
67 What is event handling in Swing? 5 2 CO5
68 Define GUI programming. 5 1 CO5
What is the difference between JTextField and
69 2 CO5
JTextArea? 5
List any two benefits of using the Collections
70 2 CO5
framework. 5
What are the default packages imported in a Java
71 1 CO5
Swing application? 5
How do you create a simple GUI frame using
72 3 CO5
Swing? 5
Part-2(60 Questions)
Focused Short Answer Type Questions Modul
[Link] BL CO
(4marks) e
Write a Java program to find the factorial of a
2 2 CO1
number using a for loop. 1
Compare and contrast Java with C++. Discuss at
3 2 CO1
least 5 differences. 1
Explain the working of JVM with the help of its
4 3 CO1
architecture. 1
Write a Java program that accepts 5 integers using
5 1 CO1
Scanner and prints the average. 1
Describe the different types of operators in Java
6 2 CO1
with examples. 1
Explain the use of if, switch, and ternary operator
7 3 CO1
with examples. 1
Trace the output of a Java program with nested for
8 2 CO1
loops and array access. 1
Explain the differences between Scanner,
9 3 CO1
BufferedReader, and Command-line input in Java. 1
Write a Java program to search an element in a
10 2 CO1
2D array. 1
Explain typecasting in Java with a program that
11 3 CO1
casts float to int. 1
Write a Java program that takes two numbers and
12 1 CO1
performs all arithmetic operations. 1
Discuss the importance of object-oriented
13 3 CO2
programming over procedural programming. 1
Write a Java class Student with data members,
14 2 CO2
constructors, and a display method. 2
What is inheritance? Explain all types of
15 2 CO2
inheritance with class diagrams. 2
Explain method overloading and overriding with
16 3 CO2
examples. 2
Write Java code to demonstrate the use of super
17 3 CO2
and this keyword. 2
Write a Java program to demonstrate dynamic
18 2 CO2
method dispatch. 2
How is encapsulation achieved in Java? Give an
19 1 CO2
example. 2
Differentiate between public, private, protected,
20 3 CO2
and default access specifiers. 2
Create a class Employee with overloaded
21 2 CO2
constructors to initialize ID and name. 2
Discuss the concept of static members in Java
22 3 CO2
with examples. 2
Trace the output of a Java program with a base
23 3 CO2
and derived class having same method names. 2
24 What is constructor chaining? Illustrate with code. 2 4 CO2
Explain the importance of polymorphism in
25 3 CO3
software design. 2
Write a Java program to count vowels in a string
26 2 CO3
using StringBuilder. 3
Explain wrapper classes with code demonstrating
27 2 CO3
autoboxing and unboxing. 3
Differentiate between abstract classes and
28 3 CO3
interfaces with real-life examples. 3
Write Java code that implements an interface
29 3 CO3
Drawable with a draw() method. 3
What are user-defined exceptions? Write Java
30 2 CO3
code to create and handle one. 3
Describe Java's exception hierarchy and show
31 3 CO3
how try-catch-finally blocks are used. 3
Write Java code using StringTokenizer to split a
32 3 CO3
sentence into words. 3
Create a Java package with at least two classes
33 2 CO3
and demonstrate its use. 3
Compare checked and unchecked exceptions with
34 3 CO3
suitable examples. 3
Predict the output of a code that throws and
35 4 CO3
catches ArrayIndexOutOfBoundsException. 3
Discuss the real-world application of interfaces in
36 3 CO3
software design. 3
Write a program that reads a string and prints each
37 3 CO4
word in a new line. 3
Write Java code to implement threading by
38 2 CO4
extending Thread class. 4
Compare and contrast thread creation using
39 4 CO4
Runnable vs Thread. 4
Write Java code demonstrating inter-thread
40 2 CO4
communication using wait() and notify(). 4
41 Explain daemon threads with an example. 4 3 CO4
Write Java code using join() and sleep() methods
42 3 CO4
to control execution flow. 4
Write Java code to demonstrate anonymous inner
43 3 CO4
class. 4
Explain serialization in Java with code using
44 2 CO4
ObjectOutputStream. 4
Differentiate between byte stream and character
45 3 CO4
stream with code. 4
Write Java code to read content from a file and
46 4 CO4
print it on the console. 4
Trace the output of a program with multiple
47 2 CO4
threads and synchronization. 4
48 Discuss the life cycle of a thread in Java. 4 3 CO4
Write a Java program to list all files in a folder
49 3 CO5
using File class. 4
Write a Java program to store and sort integers
50 2 CO5
using ArrayList. 5
Differentiate between HashMap and TreeMap
51 3 CO5
with example code. 5
Write Java code using HashSet to eliminate
52 3 CO5
duplicates from a list. 5
Write an applet code that displays "Hello Java" in
53 2 CO5
a browser window. 5
Compare AWT and Swing with at least 3
54 3 CO5
differences and examples. 5
Write Java code to create a simple Swing GUI
55 2 CO5
with a JLabel, JButton, and JTextField. 5
Explain the use of any four Swing components
56 3 CO5
with code snippets. 5
Trace the output of a Swing program with button
57 2 CO5
click event handling. 5
Describe the role of the [Link] package in
58 4 CO5
GUI development. 5
Discuss how Java Collection Framework supports
59 3 CO5
reusability and scalability. 5
Write Java code to demonstrate use of Iterator
60 4 CO5
with a LinkedList. 5
Part-3(24 Questions) 5 2 CO1
Modul
[Link] Long Answer Type Questions (10 marks) BL CO
e
Design a GUI form using Swing to accept user
1 3 CO1
name and age and display them on button click. 1
Explain the architecture of Java Virtual Machine
2 (JVM). Write and explain the compilation and 4 CO1
execution process. 1
Develop a Java program that accepts an array of
3 integers and finds the maximum, minimum, and 4 CO1
average. 1
Design a Java program to display a pattern using
4 3 CO1
nested loops. 1
Compare procedural and object-oriented
5 4 CO2
programming paradigms with suitable examples. 1
Write a complete Java program that takes student
6 details and computes grade using conditional 3 CO2
statements. 2
Create a class hierarchy for a university system
7 using inheritance. Include classes like Person, 2 CO2
Student, and Faculty. 2
Write a Java program to demonstrate method
8 overriding and dynamic method dispatch. Explain 4 CO2
the output. 2
Discuss all four access modifiers with code
9 examples demonstrating accessibility across 3 CO2
packages and classes. 2
Analyze the role of polymorphism in real-world
10 3 CO3
object-oriented programming scenarios. 2
Create a Java program to implement multiple
11 constructors (constructor overloading) and explain 4 CO3
the output. 3
Write a Java program that reads a sentence and
12 3 CO3
counts vowels, consonants, digits, and spaces 3
using StringBuilder.
Create an interface Shape with area() and
13 perimeter() methods. Implement it in classes 2 CO3
Circle and Rectangle. 3
Design a program that uses abstract classes and
14 4 CO3
demonstrates runtime polymorphism. 3
Explain the exception hierarchy in Java. Write
15 4 CO4
code to create and handle a custom exception. 3
Analyze the significance of abstraction and
16 3 CO4
interfaces in decoupling software components. 4
Develop a multithreaded Java application where
17 one thread generates Fibonacci series and another 3 CO4
prints prime numbers. 4
Explain and demonstrate inter-thread
18 communication with proper synchronization using 4 CO4
wait() and notify(). 4
Create a Java program to serialize and deserialize
19 3 CO4
an object using file streams. Explain each step. 4
Discuss deadlock in multithreading. Write a Java
20 code that leads to a deadlock and explain how to 3 CO5
avoid it. 4
Write a Java program to implement all types of
21 4 CO5
inner classes and explain their usage. 5
Create a Java GUI application using Swing that
22 takes user input (name, age) and displays it on a 4 CO5
button click. 5
Design a Java application using HashMap that
23 stores employee ID and names. Allow search and 3 CO5
display by ID. 5
Compare AWT and Swing frameworks. Build a
24 Swing form with at least 3 input components and
one action listener. 5 3 CO5
Write a complete applet program demonstrating
the applet life cycle methods with GUI
25 components. 5 3 CO5