0% found this document useful (0 votes)
38 views2 pages

Cs1230 Oop Final Sp21

The document is the final exam for an Object Oriented Programming course. It contains 5 short answer questions worth a total of 15 marks and 2 long answer questions worth a total of 25 marks. The first long question asks students to create a C++ program to calculate zakat (charitable donations) owed by donors to an Islamic bank based on their bank balances. The second long question asks students to create a base Worker class with virtual functions and derived Salaried and Hourly classes to calculate commissions and total salaries for different types of employees polymorphically.

Uploaded by

SAIMA SHAHZADI
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)
38 views2 pages

Cs1230 Oop Final Sp21

The document is the final exam for an Object Oriented Programming course. It contains 5 short answer questions worth a total of 15 marks and 2 long answer questions worth a total of 25 marks. The first long question asks students to create a C++ program to calculate zakat (charitable donations) owed by donors to an Islamic bank based on their bank balances. The second long question asks students to create a base Worker class with virtual functions and derived Salaried and Hourly classes to calculate commissions and total salaries for different types of employees polymorphically.

Uploaded by

SAIMA SHAHZADI
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/ 2

University of Sialkot, Pakistan

Faculty of Computing & IT


Final Examination, Spring 2021

Course Code:CS-1230 Course Title: Object Oriented Programing


Teacher’s Name: M.Azeem, Afshan Naseem Total Marks: 40
Date & Time: Total Time: 150 Minutes
Student’s Name: Roll. No.:
Invigilators Signature:
Instructions:
1. Read the paper carefully
2. Your instructor may not see you but your Allah is watching. Solve the paper with honesty
3. Copied material will be graded as zero
4. Submit solved paper within the due time. Late submitted paper will not be dealt
5. Answer should be hand written and should be submitted in pdf form by taking images
6. The file name must be your complete roll number e.g. “20101003-100.pdf”. No file with other
name will be accepted

Section A - Short Questions


Write down the code in C++ according to the given scenarios using the Object Oriented Approach.
Question 1: What are the disadvantages of an Inline Function?
Question 2: Suppose a file “abc.dat” or “abc.txt” contains 5 integers separated by spaces. Write a
program to open file, read the integers and display them in reverse order separated by spaces.
Question 3: Write a function template that accepts three parameters and displays their sum.
[5*3 Marks]

Section B - Long Questions

Question 4: An Islamic bank wants you to develop a Zakat Calculator for them. The calculator shall
take the input of the 1) name of zakat donor, 2) Bank_Balance, 3) zakat_amount. Create constructor to
initialize variables with default values which will be called on the time of object instantiation. There
should be a method named “Cal_zakat()” which calculates the zakat of each donor and set in
zakat_amount. The program adds up the zakat of each donor hence calculating the total_zakat of the
bank. Use a “display()” which displays not only the data of the donor but also the total amount of
zakat of the bank. It should keep in mind that the zakat will be calculated only if Bank_Balance is
greater than or equal to 20,000. (You should implement the concept of overloading, copy constructor
or overriding wherever it is applicable)

Note: Zakat will be calculated by the formula (Bank_Balance *2.5)/100. [12 Marks]

Question 5: Create a class Worker with attributes name, age and salary. This class contain default
constructor, getData, Display and a pure virtual function named as calculate commission with a virtual
destructor.

a) A class Salaried that inherits from Worker contain parameterize constructor and a function
that calculates the commission of the worker and display total salary constantly.
b) A class Hourly that inherits from Worker calculates the commission of Worker with of 5%
and display total salary constantly. Instantiate Salaried and Hourly classes polymorphically.

Note: Commission of an employee of Salaried class is 10% and for class Hourly employee is 5%.

[13 Marks]

************Good Luck***************

You might also like