The American University in Cairo Computer Science Department CSCI 106 EXAM I Spring 2006 Dr KHALIL Last Name ID First Name Form I EXAMINATION INSTRUCTIONS Do not turn this page until asked to do so Exam time is 50 minutes Put the answers on the same question sheet do not use any additional papers even for scratch Write your name ID section no in the indicated places Read the exam instructions Read the honesty policy Sign the following statement Academic Integrity Policy Cheating in Exams is a violation of the Academic Integrity policy of AUC Whispering talking looking at someone else s paper or copying from any source is considered cheating Any one who does any of these actions or her his answers indicates that she he did any of them will receive a punishment ranging from zero in this exam to failing the course If repeated it may lead to dismissal from AUC I have read the honesty policy and exam instructions and I am presenting this exam as entirely my effort Signature DO NOT USE THIS SECTION Question Points 1 25 2 15 3 10 Total 50 1 Grade Question 1 25 points At AUC the academic standing of a student is determined based on the number of the credit hours that he she has achieved The rules are as follows Number of Credit Hours CrH CrH 30 30 CrH 60 60 CrH 90 90 CrH 120 120 CrH Academic Standing Freshman Sophomore Junior Senior Graduating Senior Draw a flow chart and write a program in C to input the number of credit hours achieved by the student and print out his her academic standing Show the three phases of software development the analysis design and implementation Implement your solution in C once using nested if structure and second using switch structure Assume that the input number of credit hours always between 0 and 142 The Analysis The Flow Chart 2 The Program Using nested if structure The Program Using switch structure 3 Question 2 15 points Trace the following C program i e show the effect of each numbered statement using the given table include iostream include cmath using namespace std void main float a 2 5 b 9 0 c int x 6 y 2 5 z s t z x y x a c y x sqrt b a if x y 1 s b pow y x 2 b t y x a cout z z endl cout c c endl cout s s endl cout t t endl statement 1 statement 2 statement 3 statement 4 statement 5 statement 6 statement 7 statement 8 statement 9 statement 10 Use the following table to trace the given program i e to plot the value of different variables as instructions are executed one after the other and finally showing the output Statement Number a b c x y z s t 1 2 3 4 5 6 7 8 9 10 4 Question 3 10 points Show the output of the following program Program void main int num 357 d const int ten 10 d num ten cout d num num ten d num ten cout d num num ten d num ten cout d endl num num ten cout num endl Output Good Luck 5
View Full Document
Unlocking...