0% found this document useful (0 votes)
277 views4 pages

University of Management and Technology Lahore: (SPRING 2021)

I. The document provides instructions for an online exam for an Object Oriented Programming course, including submission guidelines and time limits. II. The exam consists of 6 questions assessing various OOP concepts like friend functions, constructors, operator overloading, static members, and class diagrams. III. Students are instructed to submit their exam responses by zipping individual code files into a folder before the deadline to receive marks.

Uploaded by

Mr. Nasrullah
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)
277 views4 pages

University of Management and Technology Lahore: (SPRING 2021)

I. The document provides instructions for an online exam for an Object Oriented Programming course, including submission guidelines and time limits. II. The exam consists of 6 questions assessing various OOP concepts like friend functions, constructors, operator overloading, static members, and class diagrams. III. Students are instructed to submit their exam responses by zipping individual code files into a folder before the deadline to receive marks.

Uploaded by

Mr. Nasrullah
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/ 4

UNIVERSITY OF MANAGEMENT AND

TECHNOLOGY LAHORE
School of Systems and Technology

Program: BS-CS (V6) Resource Person: Abdul Wahab


Course: Object Oriented Programming Semester: 2nd (SPRING 2021)
Course Code: Max. Time allowed: 2 hours
Examination: SPRING 2021 Total Marks: 70
Date: 07-May-2021

Name: _______________________ Roll No/ID: ________________

 These instructions must be followed strictly. Failure to do so may result in


serious grade loss.
 You have to finish your exam within allocated time and submit it on LMS
(Preferred) in folder “MID-TERM Examination”.
 Only if you face some problem in submission on LMS you can submit through
email ([email protected]). Late submissions will not be entertained
 Understanding the question paper is also part of the Exam, so do not ask for any
clarification.
 Manage time properly and try to attempt easy problems first
 Attempt all questions carefully.
 As it is online exam, if I find more than one student has exact same copy of
answer of same question or text is taken from any website then your paper will
be cancelled immediately and I will not check the paper.

Submission Guidelines:

 Step1: Make a folder of your name and id. E.g. “ABDUL


WAHAB_F2020114029”
 Solve each question and copy paste its code in a separate notepad file.
 Step2: Copy all notepad files in your folder and names of files should be Q1. , Q2.

 Step3: Zip the folder which have all these notepad files

Time:

Start Time: 10:00 AM


End Time: 12:00 PM
Follow the deadline, failing which shall result in zero marks.

[Have A Nice Day……!]


Question 1: (20 Marks)

Explain the following questions:

I. What is a friend function? Why is it required? Explain with an


example. (05 points)

II. Explain the purpose of new and delete operator by using C++
program. (05 points)

III. How is the working of member function different from friend


function and a nonmember function? (03 points)

IV. Explain the concept of default constructor, copy constructor and


parameterized constructor with the help of suitable c ++ program.
(05 points)

V. What is inline function? When will you make a function inline and
why? (02 points)

Question 2: (10 Marks)

Find the errors in following class and explain how to correct them:

1) class Example
2) {
3) public:
4) Example(int y = 10)
5) :data(y)
6) {
7) //empty body
8) } //end Example constructor
9) int getIncrmentedData() const
10) {
11) return data++ ;
12) } //end function getIncrmentedData
13) static int getCount()
14) {
15) cout << "Data is " << data ;
16) return count ;
17) } //end function getCount

18) private:
19) int data ;
20) static int count ;
21) }; // end class Example

[Have A Nice Day……!]


Question 3: (10 Marks)

Write a program to process weekly employee time cards for all employees
of an organization. Each employee will have three data items: an
identification number, the hourly wage rate, and the number of hours
worked during a given week. Each employee is to be paid time and a half
for all the hours worked over 40. A tax amount of 3.625 percent of gross
salary will be deducted. The program output should show the employee's
number and net pay. Display the total payroll and the average amount paid
at the end of the run.

Question 4: (10 Marks)

Write a class Run that contains the following data members:


 The name of the runner.
 The Distance Covered by a runner.
The class has the following member functions:
 Get function to input runner name and distance.
 Show function to display runner name and distance.
The user should be able to show the name of the runner who has
covered the longest distance at any point of time.
(Hint: Static data members)
Question 5: (10 Marks)

Recall the swap function done in the class. Slightly modify the function
and rewrite it to do a three--‐way swap instead of simple swap. The
function will be passed three integers a, b and c. The function will put the
value of a in b, b in c and c in a.

Example:

a = 10, b = 15, c = 20
After function’s execution
a = 20, b = 10, c = 15

[Have A Nice Day……!]


Question 6: (10 Marks)
Sports World is an Events Management Company that organize the
running of major sporting games, such as the Olympic Games.

Before being used to host a sporting event, venues are assessed by an


Administrator who checks that they are for fit for purpose. If the venue
can hold more than 10,000 people, the Administrator conducts additional
health and safety checks to ensure that the venue is safe.

A year before the games begin, a Team of Staff are appointed to run the
day-to-day operations, including booking successfully assessed/safety-
checked venues. Six months before the games begin, the Team of Staff
produce a Program that lists the date, time and location of each sporting
event. At this point, Athletes can register for an event by giving their name,
address, date of birth and best time for their event. Some overseas athletes
need to apply for a visa and the system needs to record whether they were
successful.

A week before the games begin, a Team of Staff produce a Schedule that
shows when the registered athletes will participate in their event. At the
end of each event, the Team of Staff produce a Table of Results that
records the positions of each athlete.

Once all the events are completed, the Administrator checks the Table
of Results for accuracy and produces a Medals Table.
Draw a Class diagram for above mentioned scenario.

[Have A Nice Day……!]

You might also like