Course Code 23IT302 Regulations 2023
Course Title OBJECT ORIENTED PROGRAMMING USING JAVA
Semester(s) & III Semester & [Link]. Information AY 2024-25
Programme(s) Technology
Unit INTRODUCTION TO JAVA
I
Q. No. PART A (2 Mark) BT
CO Level
1 What are the features of java? CO1 UN
2 Difference between JDK, JRE, and JVM CO1 UN
3 What are the difference between static variable and instance variable? CO1 RE
4. What are primitive datatypes in java? CO1 UN
5. What is meant by garbage collection? CO1 RE
6. Write a java program to reverse a string without using library function CO1 RE
7.
Write a java program to print sum the odd position value of an integer CO1 UN
array
8. Write a java program to print odd position of a digit. CO1 UN
9. Differentiate String and StringBuffer CO1 UN
10. How will measure the capacity of a string? CO1 UN
Q.
PART B (Either Four 14 Marks Questions or six 7 Marks Question)
BT
CO Level
No.
1. (14) CO1 AP
2. Describe the control statements with suitable example program (14) CO1 UN
3. Describe the loop statements with suitable example program (14) CO1 UN
4. Depict the java operators in java with suitable example program. (14) CO1 UN
5.
Illustrate the any seven String class functions with sample program CO1 UN
(14)
6.
Illustrate the any seven StringBuffer class functions with sample CO1 UN
program (14)
7. Write a java program to print prime numbers between a ranges. (14) CO1 UN
8.
Write a java program to replace substring in a string with other CO1 UN
substring (14)
Unit OOPS Introduction - Encapsulation, Inheritance, Polymorphism, Abstraction, Interfaces
II
Q. No. PART A (2 Mark) BT
CO Level
1. What is the use of ‘this’ Keyword? CO2 RE
2. What is the purpose of constructor? CO2 RE
3. Differentiate final class and abstract class. CO2 RE
4. Differentiate abstract class and interface CO2 RE
5.
How will you avoid overriding? Differentiate overriding with CO2 RE
overloading
6. What do you meant by encapsulation? Give an example. CO2 RE
7. Brief about constructor and method overloading. CO2 RE
8. How will use extends and implements keyword in java. CO2 RE
9. Define object and class. CO2 RE
10. Write a java code to demonstrate use of final keyword CO2 RE
Q.
PART B (Either Four 14 Marks Questions or six 7 Marks Question)
BT
CO Level
No.
1.
Describe the characteristics of Object oriented Programming with sample CO2 UN
program |(14)
2. Explain about the Constructors and its type with example program CO2 UN
Define a class Resort with the following description:
Members are : RNo to store Room Number, Name store customer
name, Charges to store per day charges, Days to store number of days
of stay.
Member functions :
3.
Compute() to calculate and return Amount as Days * Charges and if CO2 UN
the values of Days*Charges is more than 11000 then as
1.02*Days*Charges
Getinfo() A function to enter the content Rno, Name, Charges and
Days.
DispInfo() A function to enter the content Rno, Name, Charges, Days
and Amount by calling function Compute(). (14)
Define a class Garments with the following description :
Members are : GCode of type String, GType of type String, GSize of
type integer, GFabric of type string, GPrice of type float.
Member functions :
A function Assign() which calculates and assigns the value of GPrice
as follows:
For the value of GFabric “COTTON”,
GType GPrice
4.
Trouser 1300 CO2 UN
Shirt 1100
For GFabric other than “COTTON” the above mentioned GPrice gets
reduced by 10%.
A constructor to assign initial values of GCode, GType and GFabric
with the word “Not Allowed” and GSize and GPrice with 0.
A function Input() to input the values of the data members GCode,
Gtype, GSize and GFabric and invoke the Assign() function.
A function Display() which displays the content of all the data
members for a Garment. (14)
Create a class “BankAccount” with fields “accountNumber”, “balance”,
5. and “interestRate” and a method “deposit()” that adds an amount to CO2 UN
the balance.
Create a subclass “SavingsAccount” that extends “BankAccount” and
adds a field “minimumBalance” and a method “withdraw()” that
subtracts an amount from the balance.
Create a subclass “FixedDepositAccount” that extends
“SavingsAccount” and adds a field “term” and a method “getInterest()”
that returns the interest earned on the account.
Create an object of the “BankAccount” class and call the “deposit()”
method.
Create an object of the “SavingsAccount” class and call the “deposit()”
and “withdraw()” methods.
Create an object of the “FixedDepositAccount” class and call the
“deposit()” (14)
Create a class “Shape” with a method “getArea()” that returns the area
of the shape.
Create a subclass “Rectangle” that extends “Shape” and adds fields
“length” and “width” and overrides the “getArea()” method to return
the area of the rectangle.
Create a subclass “Box” that extends “Rectangle” and adds a field
6. “height” and overrides the “getArea()” method to return the surface CO2 UN
area of the box.
Create an object of the “Shape” class and call the “getArea()” method.
Create an object of the “Rectangle” class and call the “getArea()”
method.
Create an object of the “Box” class and call the “getArea()” method.
(14)
An abstract class called “Marks” is needed to calculate the percentage
of marks earned by students A in three subjects (with each subject
out of 100) and student B in four subjects (with each subject out of
7. 100). This class must contain the abstract method “getPercentage,” CO2 UN
which two other classes, “A” and “B,” will inherit. The method
“getPercentage,” which provides the percentage of students, is shared
by classes “A” and “B.” (14)
8. Differentiate this and super keyword with suitable example code
Write a Java program to create a base class Sports with a method
9.
called play(). Create three subclasses: Football, Basketball, and
Rugby. Override the play() method in each subclass to play a specific
statement for each sport. (14)
Unit EXCEPTION HANDLING AND MULTITHREADING
III
Q. No. PART A (2 Mark) BT
CO Level
1.
Write a Java program to create a method that takes an integer as a CO3 UN
parameter and throws an exception if the number is odd.
2. Write JAVA built-in exceptions classes. CO3 UN
3. Differentiate throw and throws. CO3 UN
4. Define exception. Draw the hierarchy of the Exception class. CO3 UN
5. Define thread. How will you create a thread? CO3 UN
6.
How will you assign priority to a thread? List the constant value of CO3 UN
the priority.
7. How will you check the the given value is integer or float? CO3 UN
8. Brief suspend and resume a thread. CO3 UN
9. Give short notes on synchronized method and synchronized block. CO3 UN
10. What are the purposes of custom thread. CO3 UN
Q. No. PART B (Either Four 14 Marks Questions or six 7 Marks Question)
BT
CO Level
Given two integers (positive , negative or even 0) say a and b. Find the
1.
minimum value of a$b where $ is any arithmetic operation like
multiply(*), Divide(/), Addition(+),Substraction(-). Use Exception CO3 UN
Handling in this problem (14)
2. List the runtime exception. Explain each with sample code (14) CO3 AN
3.
What is Re-throwing an exception in Java? mExplain with a sample CO3 AN
code (14)
4.
Write a custom exception for EmailID, mobile number and Aadhaar CO3 UN
number validation. (14)
5.
Multiple catch Clauses and Nested try Statements with suitable CO3 AN
program (14)
Write a Java program that creates two threads to find and print even CO3 AN
and odd numbers from 1 to 20. (14)
Write a Java program that creates a bank account with concurrent CO3 AN
deposits and withdrawals using threads (14)
Write a Java program to create a producer-consumer scenario using CO3 AN
the wait() and notify() methods for thread synchronization (14)
How to Get the Id, name, priority of a Current Running Thread in CO3 AN
Java? (14)
Unit JAVA COLLECTIONS - I
IV
Q. No. PART A (2 Mark) BT
CO Level
1.
Write a Java program to insert an element into the array list at the CO4 AN
first position
2. Write a Java program to shuffle elements in an array list. CO4 RE
3.
Write a Java program to replace the second element of an ArrayList CO4 UN
with the specified element.
4. What is generic programming? CO4 AN
5. List the Types of Java Generics. CO4 AN
6. Write a Java program to show working of user defined Generic classes CO4 UN
Write a Java program to show working of user defined Generic
7.
functions CO4 UN
8. Write the type Parameters in Java Generics CO4 UN
9. How to Declare a Bounded Type Parameter in Java? CO4 UN
10. What are the Restrictions of Generics in Java. CO4 UN
Q.
PART B (Either Four 14 Marks Questions or six 7 Marks Question)
BT
CO Level
No.
Write a Java program to create a generic method that takes a list of
1. any type and a predicate. It returns an array list containing only CO4 UN
elements that satisfy the predicate. (14)
Write a Java program to create a generic method that takes a list of CO4 UN
numbers and returns the sum of all the even and odd numbers. (7)
Design a class that acts as a library for the following kinds of media:
book, video, and newspaper. Provide one version of the class that uses
2.
generics and one that does not. Feel free to use any additional APIs for CO4 UN
storing and retrieving the media. (14)
3.
Write a Java program that demonstrates the use of bounded types CO4 UN
with input and output: (7)
4.
Write a java program to demonstrate ArrayList of user defined objects. CO4 UN
(7)
5.
Write a java program to demonstrate creating an ArrayList from CO4 UN
another collection (14)
6.
Write a java program to demonstrate Create, replace and removing
CO4 UN
elements from an ArrayList (14)
Unit JAVA COLLECTIONS - II
V
Q. No. PART A (2 Mark) BT
CO Level
1. Write a Java program to empty an hash set CO5 UN
2. Write a Java program to compare two hash set CO5 UN
3. Write a Java program to convert a linked list to array list CO5 UN
4.
Write a Java program to remove and return the first element of a CO5 UN
linked list.
5.
Write a Java program to associate the specified value with the CO5 AN
specified key in a HashMap.
6. Write a Java program to remove all of the mappings from a map CO5 AN
7.
Write a Java program to get a reverse order view of the keys contained CO5 AN
in a given map
8.
Write a Java program to get a key-value mapping associated with the CO5 AN
greatest key and the least key in a map
9.
write a program to convert a Set of Strings into an Array of String CO5 AN
using [Link]() method
10. Write the important Methods of treeset class. CO5 UN
Q. No. PART B (Either Four 14 Marks Questions or six 7 Marks Question)
BT
CO Level
Sketch the class definition and method signatures for a Stack class,
1. parameterized by the type of element on the stack. Give the method CO5 AN
signatures for push, pop, and isEmpty (14)
2.
Write a Java Program LinkedList Operations poll, pollFirst, pollLast, CO5 AN
peek, peekFirst , peekLast, offer, offerFirst and offerLast (14)
3. Write a Java program to get the number of elements in a hash set (7) CO5 AN
Write a java Program for accessing the entries of a TreeMa
demonstrates how to -
Find the size of a TreeMap.
4.
Check if a given key exists in a TreeMap. CO5 AN
Retrieve the first entry in the TreeMap.
Retrieve the last entry in the TreeMap.
Retrieve the entry whose key is just lower than the given key.
Retrieve the entry whose key is just higher than the given key. (14)
5.
Write a Java program to get a key-value mapping associated with the CO5 AN
greatest key less than or equal to the given key (14)
6.
Write a Java program to remove first and last element from a linked CO5 AN
list. (7)
7.
a simple Java code snippet that demonstrates how to create and use a CO5 AN
HashMap in Java (7)
8.
Write the Features of a LinkedHashMap. Java Program to Demonstrate CO5 AN
Working of LinkedHashMap. (14)
Write a java program Java Program to Demonstrate Adding
9.
And Elements Updation of Elements to a LinkedHashMap (14) CO5 AN