Unformatted text preview:

The American University in Cairo Computer Science Department CSCI 106 EXAM I Spring 2007 Dr KHALIL Last Name ID First Name Form I EXAMINATION INSTRUCTIONS Do not turn this page until asked to do so Exam time is 60 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 20 2 15 3 15 Total 50 1 Grade Question 1 20 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 is 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 include iomanip using namespace std void main float a 2 576 b 1 0 c 1 5 statement 1 int x 6 y 2 5 z s 4 t statement 2 c x y x a statement 3 z y x sqrt b a statement 4 if x y 1 statement 5 s 2 b pow x y 2 b statement 6 t y x a b statement 7 cout setiosflags ios fixed ios showpoint setprecision 1 statement 8 cout z setw 3 z endl statement 9 cout c setw 3 c endl statement 10 cout s sew 3 s endl statement 11 cout t setw 3 t endl statement 12 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 11 12 Question 3 15 points An integer number is divisible by 9 if the sum of its digits is divisible by 9 For example the integer number 198 the sum of its digits 1 9 8 18 which is divisible by 9 hence the number 198 is divisible by 9 4 Using this technique write a program in C to enter an integer number of only three digits and notify the user whether the number is divisible by 9 or not Write only the program in C The Program Good Luck 5


View Full Document

AUC CSCE 106 - Syllabus

Loading Unlocking...
Login

Join to view Syllabus and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Syllabus and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?