المملكة العربية السعودية وزارة التعليم العالي جامعة المجمعــة كلية العلوم بالزلفي قسم علوم الحاسب والمعلومات 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: Sun. 21/ 07/ 1436 H 10 / 05 / 2015 G. Number of Pages: 3 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] Write a function Average( ) that can return the average of total number of n integers represented by array variable as argument variable? Write a main() program to exercise this 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