We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 4
Reg. No.: I ]
Question Paper Code : 80440
B.E./B.Tech. DEGREE EXAMINATIONS, APRIL/MAY 2024.
‘Third/Fourth/Fifth Semester
Computer Science and Engineering
CS 8392 - OBJECT ORIENTED PROGRAMMING
(Common to: Computer and Communication Engineering/Electrical and Electronics
Engineering/Electronics and Communication Engineering/Electronics and
Instrumentation Engineering/Electronics and Telecommunication
Engineering/Instrumentation and Control Engineering/Artificial Intelligence and
Data Science/Computer Science and Business Systems/Information Technology)
(Regulations 2017)
Time : Three hours Maximum : 100 marks
Answer ALL questions.
PART A— (10 x 2= 20 marks)
Mention the significance of bytecode in Java.
‘Analyze and trace the output of the following code snippet
int total = 25;
for (int number = 1; number <= (total/2); number++) {
total = total — number;
System.out.printIn (total); }
Differentiate an abstract class and an interface.
How Final keyword is associated with inheritance? Give example.
Write a program to create User Defined Exception that is thrown when user
enters a value greater than 100.
Mention the role of System.out and System-in in Java programming.
Differentiate between multithreading and multitasking.10.
i.
Predict the output of the following program.
class Example(
public static void main(String arg| ]){
MyGen m=new MyGen();,
m.add(1);
m.add(2);
m.add(3);
m.add(4);
System.out.printIn(m.get() );
y
class MyGen{
T obj;
void add(T obj){this.obj=obj;}
‘T get( {return obj ;}
}
Identify the concept shown Fig. 9 in the following figure and give a short
description of the same.
Compare and contrast Swing and AWT.
PART B— (6 x 13 = 65 marks)
(@) Explain in detail about all the features of object oriented programming in
java with examples.
Or
(&) Explain the following concepts in java with appropriate examples.
(Constructor and its type @
Gi) Static member and static method @)
(ii) Package (3)
(iv) Arrays @
2 8044012.
13.
14.
(a)
)
(@)
b)
(@)
()
(@)
)
Define a calculator class with required methods and create an object to
execute the object of calculator using the given interfaces.
interface Add_Sub {
public void add(double x, double y);
public void subtract(double x, double y);
3
interface Mul_Div{
public void multiply (double x, double y) ;
public void divide (double x, double y) ;
}
interface Calculator extends Add_Sub, Mul_Div{
public void printResult(double result);
}
Or
Write a java program to create an abstract class named Shape that
contains two integers and an empty method named printArea( ). Provide
three classes named Rectangle, Triangle and Circle such that each one of
the classes extends the class Shape, Each one of the classes contain only
the method printArea() that prints the area of the given shape
Discuss the usage of multiple-catch, nested try and finally block in
handling exceptions with an example.
Or
Discuss various Byte and Character stream classes used for input/output
operations.
Sketch life cycle of multithreading with its stages. Develop a
multiplication Table of Five using Multithreading (Use Thread class for
implementation)
Or
Discuss the importance of generic class and generic method. Define a
generic method to exchange the positions of two different elements in an
array.
Design a GUI form using swing components as shown in Fig. 15 (a):
Fig. 15 (@)
Or
Develop an interface that receives an integer in one text field and
‘compute its factorial value and returns it in another text filed when the
button Compute” is clicked.
3 8044016.
(a)
)
PART C— (1x 15 = 15 marks)
Define a class Worker and derive classes Daily Worker and Salaried
Worker from it. Every worker has a name and a salary rate. Write
method ComPay(int hours) to compute the week pay of every worker. A
Daily Worker is paid on the basis of number of days s/he work. The
Salaried Worker gets paid with the wage for 40 hours a week no matter
what actual hours is. Test this program to calculate the pay of workers.
Identify the required concepts and implement the same.
Or
Write a program in Java to calculate the monthly electricity bill of a
consumer according to the units consumed. The tariff is given below:
Units Consumed Charge
Upto 100 units Rs.1.25 per unit
For next 100 units _|_Rs.1.50 per unit
More than 200 units | Rs.1.80 per unit
Unit consumed = Present reading — Previous reading. Use a function
named cal(int u) and print the information in the main function as per
the given format:
Consumer No. | Name | Units Consumed | Amount
co0034 | KALA 70 Bs.87.50
4 80440