Lab Exam 1

advertisement
‫المملكة العربية السعودية‬
‫وزارة التعليم العالي‬
‫جامعة المجمعــة‬
‫كلية العلوم بالزلفي‬
‫قسم علوم الحاسب والمعلومات‬
Kingdom of Saudi Arabia
Ministry of Higher Education
Majmaah University
Collage of Science at Al-Zulfi
Computer & Information Dept.
1st midterm exam - Second Semester 1435-1436H
Course Name: Programming Lang.(2)
Time Allowed: 90 minutes
- Course Code: CSI 221 -
Section:
)2( ‫) امتحان عملي ) لمادة برمجة‬
Date: Mon. 22/ 07/ 1436 H  11 / 05 / 2015 G.
Number of Pages: 4
Student's Name:......................................................................................................
Student's ID: ............................................................................................................
Laboratory EXAM
PROGRAMMING 2
Learning Outcomes
Knowledge
1.1
1.2
a2
1.3
Cognitive Skills
1.4
a3
2.1
2.2
b1
b2
Question
Outcome covered
1
b1
2
b2
3
c3
2.3
Communication, Information
Technology, Numerical
Interpersonal Skills
2.4
3.1
3.2
3.3
3.4
c3
Correction
Verification
Total
4.1
4.2
4.3
d1
Faculty Member
Course
coordinator
Dr. Wael Khedr
Revision Committee
Name
Final Mark :
Signature
/ 15
Marks:……………………………………………………………………………
2 ‫نموذج‬
1
Question(1) : -----------------------------------------------------------------------------------[5 marks]
Write a function called zeroSmaller( ) that is passed two int arguments by
reference and then sets the smaller of the two numbers to 0. Write a main()
program to exercise this function?
Answer
2
Question(2) : ----------------------------------------------------------------------------------[ 5 Marks]
class part
{
Privte
int model number
int part number
float cost
//ID number of widget
//ID number of widget part
//cost of part
void setpart()
{ modelnumber = mn;
partnumber = pn;
cost = c;
void showpart() //display data
{
cout << “Model “ << model number;
cout << “, part “ << part number;
cout << “, costs $” << cost$ << end;
}
}
Correct the errors of Part Class definition and write main function to declare
object and call all public function?
Answer
3
Question(3) : ----------------------------------------------------------------------------------[ 5 Marks]
Create a class called Time that has separate int member data for hours,
minutes, and seconds. One constructor should initialize this data to 0,
and another should initialize it to fixed values. Another member
function should display it, in 11:59:59 format. The final member
function should add two objects of type time passed as arguments.
Answer
4
Download