# Lab Exam 1

```‫المملكة العربية السعودية‬
‫وزارة التعليم العالي‬
‫جامعة المجمعــة‬
‫كلية العلوم بالزلفي‬
‫قسم علوم الحاسب والمعلومات‬
Kingdom of Saudi Arabia
Ministry of Higher Education
Majmaah University
Collage of Science at Al-Zulfi
Computer &amp; 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?
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 &lt;&lt; “Model “ &lt;&lt; model number;
cout &lt;&lt; “, part “ &lt;&lt; part number;
cout &lt;&lt; “, costs \$” &lt;&lt; cost\$ &lt;&lt; end;
}
}
Correct the errors of Part Class definition and write main function to declare
object and call all public function?