Object Oriented Programming
Object Oriented Programming
CDT 104
Instructions to Candidates :—
(1) Support your answers with proper code wherever required.
(2) Assume suitable data wherever required.
1. (a) What is the difference between the following literal values : 5, '5' and
"5" ? 2 (CO 1)
(b) Discuss the access modifiers in JAVA. 2 (CO 1)
(c) Create a class Month which will have data member as Month_Name and
Month_Number. Create proper constructors to demonstrate constructor overloading
and a Display method to display Month_Name and Month_Number. Design
a method "EQUAL" in the class month which will check if the Month_Name
and Month_Number is same in 2 month objects.
Create a class Demo with main ( ) to demonstrate all functionalities of month
class. 6 (CO 1)
2. (a) Create a class Person with private data members as person's name and
date of birth. Create an interface Sports with the method SetName and
AverageScore.
Create a class Graduate which is derived from Person and Sports. The
class Graduate has private data member as CGPA, Year of graduation.
Create a constructor and display method in the classes. Create a demo
class with main ( ) and demonstrate the use of all functions. 7 (CO 1)
(b) Explain the utility of final with respect to variable, class and method.
3 (CO 1)
4. (a) Create a class Student with data members as student name, roll number
and marks of 3 subjects. The data members should be initialized through
the constructor. Design a method to calculate percentage and store the result
in data member percentage. Store the information of 5 students in ArrayList.
Sort the ArrayList in descending order of percentage.
Write appropriate main( ) to demonstrate all the functionalities. 7 (CO 2)
(b) Discuss with an example generic with 2 type parameter. 3 (CO 2)
5. (a) Create a thread class which will add the elements of the 1D array from
start_index to end - index and stores the result in data member SUM.
Assume a 1D array stores 100 elements. Divide this array in 4 equal
parts. Create 4 threads to add each of the sub array. The final addition
of array will be displayed by main( ).
[HINT : Pass start and end index in the constructor.] 7 (CO 3)
(b) What is the use of synchronized keyword ? Briefly explain with an example.
3 (CO 3)
6. (a) How are Design Patterns classified ? Explain in brief with an example.
7 (CO 4)
(b) What are the advantages of using design pattern ? 3 (CO 4)
D
QVRU/RS-22 / 1249 2 105