[go: up one dir, main page]

0% found this document useful (0 votes)
59 views3 pages

SET5 Notes

The document provides instructions for a practical end semester examination for an Object Oriented Programming Laboratory course. It lists 20 programming questions covering topics like abstract classes, interfaces, inheritance, exceptions, files, generics, packages and threads.

Uploaded by

Vijaya Lakshmi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views3 pages

SET5 Notes

The document provides instructions for a practical end semester examination for an Object Oriented Programming Laboratory course. It lists 20 programming questions covering topics like abstract classes, interfaces, inheritance, exceptions, files, generics, packages and threads.

Uploaded by

Vijaya Lakshmi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

B.E / B.Tech.

PRACTICAL END SEMESTER EXAMINATIONS, NOVEMBER/DECEMBER 2022

Third Semester

CS3381 – OBJECT ORIENTED PROGRAMMING LABORATORY

(Regulations 2021)

Time : 3 Hours Answer any one Question Max. Marks 100

Aim/Principle/Apparatus Tabulation/Circuit/ Calculation Viva- Record Total


required/Procedure Program/Drawing & Results Voce
20 30 30 10 10 100

1. a) Write a program to give a simple example for abstract class.

b) Create an outer class with a function display, again create another class
inside the outer class named inner with a function called display and call
the two functions in the main class.

2. Write a program to create a class named shape. In this class we have three
sub classes circle, triangle and square each class has two member function
named draw () and erase (). Create these using polymorphism concepts.

3. a) Write a program to create interface A in this interface we have two


method meth1 and meth2. Implements this interface in another class
named MyClass.

b) Write a program to create interface named test. In this interface the


member function is square. Implement this interface in arithmetic class.
Create one new class called ToTestInt in this class use the object of
arithmetic class.

4. a) Write a program to give example for multiple inheritance in Java.

b) Write a program to create a package named mypack and import it in circle


class.

5. Create class Number with only one private instance variable as a double primitive type. To
include the following methods (include respective constructors) isZero( ), isPositive(),
isNegative( ), isOdd( ), isEven( ), isPrime(), isAmstrong() the above methods return boolean
primitive type. getFactorial(), getSqrt(), getSqr(), sumDigits(), getReverse() the above
methods return double primitive type. void listFactor(), void dispBinary().

Page 1 of 3
6. a) Write a program for example of try and catch block. In this check
whether the given array size is negative or not.

b) Write a program for example of multiple catch statements occurring in a


program.

7. Write a program to create a class MyThread in this class a constructor,


call the base class constructor, using super and starts the thread. The run
method of the class starts after this. It can be observed that both main
thread and created child thread are executed concurrently.

8. Develop a java application with an Employee class with Emp_name, Emp_id, Address,
Mail_id, Mobile_no as members. Inherit the classes, Programmer, Assistant Professor,
Associate Professor and Professor from employee class. Add Basic Pay (BP) as the
member of all the inherited classes with 97% of BP as DA, 10 % of BP as HRA, 12% of BP
as PF, 0.1% of BP for staff club funds. Generate pay slips for the employees with their
gross and net salary.

9. 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 contains only the method printArea( ) that prints the area of the given shape.

10. Create a multithreaded program by creating a subclass of Thread and then creating,
initializing, and staring two Thread objects from your class. The threads will execute
concurrently and display Java is hot, aromatic, and invigorating to the console window

11. Write a java program that implements a multi-threaded application that has three threads.
First thread generates a random integer every 1 second and if the value is even, the second
thread 69 computes the square of the number and prints. If the value is odd, the third thread
will print the value of the cube of the number.

12. Write a java program to find the maximum value from the given type of elements using a
generic function.

13. Develop the Internal mark calculation system based on the attendance percentage using
Java. Get the student name, register number, total number of working days in the semester
and Number of days present. Calculate attendance percentage of the students and award
attendance mark based on the following condition.

Attendance percentage >=90 – 5 Marks

Page 2 of 3
Attendance percentage >=80 and < 90 – 4 Marks

Attendance percentage >=75 and < 80 – 3 Marks

Attendance percentage < 75 - 0 Marks

14. Write a program to Check Prime Number using Interface.

15. Write a Java program to implement user defined exception handling. Display the result for
the following input a=1, b=0 perform c=a/b.

16. Write a java program that implements a sequential search and binary search.

17. Write a java program that implements an insertion sort and selection sort.

18. Write a Java program that reads a file and displays the contents of the file on the screen,
with a line number before each line.

19. Write a generic method to count the number of elements in a collection that have a specific
property (for example, odd integers, prime numbers, palindromes).

20. Write a java program that illustrates the following:

(a) Creation of simple package.

(b) Accessing a package.

(c) Implementing interfaces

Page 3 of 3

You might also like