Home /UOG — University of Gujrat /Object Oriented Programming

Object Oriented Programming UOG — University of Gujrat 2024

Object Oriented Programming UOG — University of Gujrat 2024 — page 1

Discussion

Ask a question about this paper, or help someone else with theirs. Answers are emailed to whoever asked.

Your email is only used to send you replies and occasional Ustadni updates. It is never shown publicly.

Log in to post under your name

No questions yet — be the first to ask.

Need Paper? See all →

Need a paper or stuck on a question? Ask here — students reply and you get an email.

Ask about a paper
  • Bushra· 20 hours ago

    BS Islamic Studies, 5th semester, ISL-511 Translation of Holy Quran (3) — Government College University Faisalabad (GCU…

    0 replies Reply →
  • Khadija· 2 days ago

    Civics course code GCCE101

    1 reply Reply →
  • Tasddaq hussain· 2 days ago

    BS 4the semester2025 civics and community engagement past paper According UOs

    0 replies Reply →
  • Humna Khan· 3 days ago

    Bs public administration 1st semester mid term past papers

    0 replies Reply →
  • Rania· 3 days ago

    BS English from uni of Sargodha Functional English, history of old English literature, literary devices and genres,

    0 replies Reply →
Ad

Paper text

UNIVERSITY OF GUJRAT

Final Term - Spring 2024

Course Code: CS-103

Course Title: Object Oriented Programming

Time Allowed: 150 Minutes

Marks: 50

Question 1:

5+5+5=15

a) Explain the concept of early binding and late binding with example.

b) Differentiate between method overloading and method overriding. Explain the scenarios

where each technique is typically used and their impact on code maintainability.

c) Explain the process of polymorphism. How many common approaches in C++ to achieve

polymorphism?

Question 2:

3+7=10

Design class relationships and implement the program in C++ based on below conditions:

- A person class with name as only data member of type char array of length

40.

- Classes student and professor are inherited from person class.

- Student and professor class has gpa (type float) and numPub (type int) data members

- Input and output student and professor's data using getData() and showData() functions.

- There will be a function isOutstanding() to check whether a student or professor is

outstanding or not. Criteria for student is gpa > 3.5 and for professor publications >

50.

a) Class Diagram: Create a class diagram showing the relationships between these classes.

b) Code Implementation: Implement the person class as pointer and input student and

professor's data using getData() and showData() functions using pointer as many times as user wants. At the end show person's

data mentioning outstanding performance as well.

Question 3:

5

Start with a program that allows the user to input a number of integers, and then stores them in

an int array. Write a function called maxint() that goes through the array, element by element,

looking for the largest one. The function should take as arguments the address of the array and

the number of elements in it and return the index number of the largest element. The program

should call this function and then display the largest element and its index number.

Question 4:

10

Create a class time which contains three int data members (hrs, min, sec) and implement the

following functionality:

a) Two constructors to set data members, one without parameters and one with parameters.

b) Input and output functions for time in format hh:mm:ss

c) Overload + and > operator with respect to time class

d) Create four objects in main. Initialize the first and input the second object

e) Third object contains the sum of first two objects

f) Fourth object contains the largest object from first two

Question 5:

10

Start with Distance class discussed during course. Input distance from user as many times as he

wants and write them to a disk file. Append them to existing values in the file, if any. When the user

signals that no more values will be input, read the file and display all the value