Free Essay

N Mdnkqwr Jedqwjeqwkoeqw Asmdnkqwe

In: Computers and Technology

Submitted By khattakamanullah
Words 385
Pages 2
Course: Object-Oriented Programming & Design
MCS 2nd Mid Term Exam

Total Marks: 70
Total Time: 90 Minutes
May 22, 2015

1. Write a program that contains a class Faculty and a class Course. The Faculty class should have data about the first name, last name, and the name of a course allocated to the faculty. The faculty class contains the set and get member functions for first name and last name, and a print function that prints the name and course of the faculty. The Course class contains a course code of type integer and the name of the course, set and get member functions for these data members, and a print function that prints the course code and course name. Explain the steps properly by writing comments. (5)
a. Your program should have separate interface and implementation files. (10)
b. The constructor of the Faculty class takes constant parameters passed to it by reference.
Explain what difference does it make. (5)
c. Which member functions should be declared as constant and why. (3)
d. The Constructor of the Course class should take the default arguments of course code = 101 and Course Name = Introduction to Computing. (2)
e. Validate that the course name should not exceed more than 30 characters. (5)
f. In your main function declare an object of the Course class to initialise the data members to a course name and its course code. (2)
g. Your main function should print the first name, last name, course code and course name assigned to the faculty, using an object of the class Faculty. (5)
h. Show how the pointer and reference variables can be used to access the data of the Faculty object. Will it create new Constructors? (3)
i. Explain the concept of composition with the help of your program. (5)
j. Draw a class diagram that shows the data members and member functions of the classes and the relationship between the two classes. (5)
2. Define a constant integer variable arraySize initialised to 10. Declare an array with arraySize elements of type integer, and initialise the elements to 0. Print all the array elements using a for statement. Show the output. (10)
3. What is Inheritance? Explain with the help of an example. (10)

SMDLQMD
QWMD;QMWD;QW;KEDJKQW

QWDL2JE123

'Ade12e

qw

Similar Documents