D 0800CST205122003
Reg No.: Name:
APJ ABDUL KALAM TECHNOLOGICAL UNIVERSITY
[Link] Degree S3 (S,FE) (FTAVP) (SI PT) Examination May 2025 (2019
F=ii¥+;,,,`:'
Course Code: CST205
Course Name: OBJECT ORIENTED PROGRAMMING USING JAVA
Max. Marks: loo Duration: 3 Hours
PART A
Answer all questions. Each question carries 3 marks Marks
I Object-oriented programming uses classes and objects. What are classes and what are (3)
objects? What is the relationship between classes and objects?
2 Why can't we use the "super" and "this" keywords in a static method injava? (3)
3 When do we declare a method or class as final? explain with an example? (3)
4 List out three differences between abstract classes and interfaces. (3)
5 What is a finally block? Explain with a suitable Example. (3)
6 What is object serialization in Java? (3)
7 List out three differences between List and set interfaces in Java. (3)
8 With an example, explain the advantages of iterating a collection using an iterator. I(3)
9 What is the importance ofhashcode() and equals() methods?
10 Difference between start() and run() method of Thread class?
PART 8
Answer any one full question from each module. Each question carries 14 marks
Module I
11 a) Whether Class diagrams developed using UML can serve as the functional (4)
specification of a system. Justify Your Answer.
b) Explain minimum two salient features of function-oriented design approach and (4)
object-oriented design approach
c) Write short Notes on JDK, JRE and JVM (6)
12 a) Describe in detail any three object oriented programming principles. Illustrate with (7)
suitable examples.
Page 1 of 4
0800CST205122003
b) Explain Garbage collection in JAVA with examples (4)
c) Write a Program to demonstrate the finalize() method in java to show that this (3)
method is called just before an object is garbage collected
Module 2
13 a) Create a class Box that uses a parameterized constructor to initialize the dimensions (5)
of a [Link] dimensions of the Box arc width, height, depth. The
class should have a method that can return the volume of the box. Create an object of
the Box class and test the functionalities.
b) Create a school application with a class called person. Create name and dateofl3irth (9)
as member variables. Create a class called Teacher that inherits from the Person class.
The teacher will have additional properties like salary, and the subject that the teacher
[Link] a class called Student that inherits from Person class. This class will
have a member variable called studentld. Create a class called College Student that
inherits from Student class. This class will have collegeName, the year in which the
student is studying (first/second/third/fourth) etc. Create objects of each of these
classes, invoke and test the methods that are available in these classes.
14 a) Design a class that can be used by a healthcare fessional to keep track of a (5)
patient's vital statistics. The following are the details.
Name of the class -Patient
Member Variables - patientName(String),height(double),width(double)
Member Function -double computeBMIO
The above method should compute the BMI and return the resirlt. The formula for
computation of BMI is weight(in kg) + height*height(in metres).
Create an object of the Patient class and check the results.
b) Write a program to create a class named shape. It should contain 2 methods, draw() (9)
and erase() that prints "Drawing Shape" and "Erasing Shape"
respectively. For this class, create three subclasses, Circle, Triangle and Square and
each class should override the parent cla;s functions - draw () and erase ().
The draw() method should print "Drawing Circle", "Drawing Triangle" and "Drawing
Square" respectively. The erase() method should print "Erasing Circle", "Erasing
Page 2 of 4
0800CST205122003
Triangle" and "Erasing Square" respectively. Create objects of Circle, Triangle and
Square with base class type and explain the polymorphic behaviour of methods
Module 3
15 a) Write aclass that implements the Queue interface, as shown below. A queue is adata (9)
structure that accepts data and then returns it in the order in which it was received
(first-in, flrst-out order). Items are added to the tail of the queue and removed from
the head.
public interface Queue {
public int size(); //Returns number of objects in queue
public boolean isEmpty(); //Returns true if queue is empty
//Adds an item to the tail of the queue
public void enqueue(Object o);
//Removes and returns the item from the head of the queue
public Object dequeue(); }
Your queue implementation must be accessible and usable from any package.
However, any attempt to extend your class should produce a compile-time error.
b) Explain the concept of Serialization and Deserialization in Java with suitable (5)
Examples.
16 a) Change the divide method below so that itthrows an IllegalArgumentException with (3)
an appropriate message if b is zero
public static double divide(double a, double b) {
return a / b; }
b) Change the below method so that it catches the IllegalArgumentException thrown by (3)
divide method (above question) and 'prints the message "the divisor is zero" if it is
thrown.
public static void printQuotient(double a, double b) {
[Link](divide(a, b));
)
c) Write a JAVA program to copy the content of one flle to another. mention all the (8)
necessary import statements and your program should read the file line by line.
Page 3 of 4
0800CST205122003
Module 4
17 a) Write a Java program to check whethertwo given strings are anagram of each other (8)
or not. An anagram of a string is another string that contains the same characters, only
the order of characters can be different. For example, "abc" and "bac" are an anagram
of each other.
b) Create an ArrayList that can store only Strings. Create a printAll method that will (6)
print all the elements of the ArrayList using an Iterator.
18 a) Write aJavaprogram to printall permutations ofagiven string (8)
b) Explain minimum three collection interfaces provided by Java collection framework (6)
Mo(lule 5
19 a) Write a program which adds JLabel, JButton, JTextField to a JFrame. Your program (8)'
should display the text field as "Welcome to Java Swing" when clicking on the
button.
b) Consider the following employee schema (6)
employee(empid:integer, empname:string, salary:integer, Department:string)
Write a Java Program to create an employee table and to add employee details to it
using JDBC
20 a) Design and implement a simple calculator Gut with the following fields (10)
1 ) two text fields to enter the inputs.
2) a text field to display the output of the operation.
3) addition and subtraction buttons to perform the operation.
4) your program should compute the proper results according to the action performed
by the user.
b) Explain the sequence of steps involved !n writing a JDBC Application (4)
Page 4 of 4