Air University Kamra Campus
Department of Computer Science
Lab Final Term Examination
Subject: OOP Total Marks: 50
Course Code: CS112 Date: 27-March-2024
Class: BSCYS-II Duration: 3:00 Hrs.
Semester: Spring 2024 Instructor name: Mr. Zohaib Sajjad
Read the following instructions carefully.
Mobile Phone, USB, or any other electronic device is strictly prohibited during the exam.
If found, will be confiscated and strict action will be taken.
Follow the proper naming format as provided by lab instructor.
Anyone found guilty of using unfair means will have to face strict action according to
Air University rules.
Q1: [CLO-1, C-3- APPLYING] [10]
Implement the following in C++:
You are given a base class Animal that has a virtual function sound (). Create two derived
classes, Dog and Cat, that override the sound () function to print "Woof!" and "Meow!"
respectively. Write explanation of code line by line in comments.
Q2: [CLO-1, C-3- APPLYING] [10]
Implement the following in java:
Write a class called “arithmetic” having two integer and one character as data members. It
will ask user for input. It performs the operation on its integer members indicated by
character member (+,-,*, /) For example * indicates multiplication on data members as
d1*d2. Write a class with all necessary constructors and methods to perform the operation
and print the result. Use Default constructor and Parameterized constructor. Write
explanation of code line by line in comments.
Q3: [CLO-1, C-3- APPLYING] [10]
Implement the following in C++:
Write any program that overload the + operator. Write explanation of code line by line in
comments.
Q4: [CLO-2, C-3- APPLYING] [20]
Develop below mentioned application using Java Swing. User will enter the number
and will click “Print Table” button it will print the table starting from 0 up to 10. When user
clicks the “Reset Data” button, it will clear the created table field.
Enter Number
Print Table
Table will be
Displayed
Reset Data