C++ Programming II
BICP224
Mid-Term EXAM
1 Hour 30 minutes
INFORMATION FOR CANDIDATE
1. The midterm is worth 20% of overall semester assessment.
2. The total number of marks available for this practical exam is 70.
INSTRUCTIONS TO CANDIDATE
1. Please write your FULL NAME, STUDENT ID and CLASS ID clearly in the answer booklet.
2. Answer all questions
3. Name your work and email the softcopy to your lecturer after the exam. It is your
responsibility to submit your work.
Limkokwing University of Creative Technology Page 1 of 3
Faculty of Information and Communications Technology
Section A (Answer all Questions for Theory worth 10 marks)
a) Explain a default constructor, constructor with arguments; with an aid of
examples [1]
b) What are the differences between a C++ struct and C++ class? [3]
c) What is the difference between a copy constructor and an overloaded
assignment operator? [3]
d) Define accessor and mutator functions [3]
Section B (Answer all questions worth 60 marks)
Question 1
Write a C++ Program which holds a telephone number in this format (123) 456-7890
by overloading the insertion operator and the extraction operator. Create a class
PhoneNumber, and the program must produce any output of a phone number based
on the format given above. [30 marks]
Assessment Rubric
Understanding of Problem /3
Logic application /6
Syntax /6
Overloading of insertion/extraction operator /6
Proper logic implemented for operator /4
overloading
Code formatting, commenting and Indentation /3
Output/ Results /2
Limkokwing University of Creative Technology Page 2 of 3
Faculty of Information and Communications Technology
Question 2
A car rental company has requested you to develop a program that calculates rental
fee on their car based on the following information:
For mileage that is 300km and below, they charge M1 500.
For mileage that is above 300km and below 1000km inclusive, they
charge M1,500 plus M0.15 per kilometer in this range.
For mileage that is above 1000km, it is calculated by charging M1500 plus M0.15
per kilometre between 301km and 1000km inclusive, plus M0.10 per any kilometre
above 1000km. [30 marks]
Assessment Rubric
Understanding of the Problem /3
Logic application implemented for the car rental /4
Proper syntax /4
Proper use of conditional statements /4
Proper calculation of fee above 300 and below /5
1000km inclusive
Proper calculation of fee above 1000km /5
Code Formatting, commenting and Indentation /3
Output/ Results /2
Limkokwing University of Creative Technology Page 3 of 3
Faculty of Information and Communications Technology