Unformatted text preview:

The American University in Cairo Computer Science Department CSCI 106 EXAM I Dr KHALIL Fall 2006 Last Name ID First Name Form I EXAMINATION INSTRUCTIONS Do not turn this page until asked to do so Exam time is 75 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 20 3 15 4 25 5 20 Total 100 1 Grade Question 1 20 points Write a program in C to enter an integer decimal number between 0 and 15 inclusive The program should compute and display the equivalent binary representation as a 4 bit binary number For example if you enter 13 the program should display 1101 if you enter 7 the program displays 0111 and if you enter 0 the program displays 0000 Show the three phases of software development the analysis design draw a Flow Chart and implementation The Analysis The Flow Chart 2 The Program 3 Question 2 20 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 4 5 b 1 0 c int x 6 y 2 5 z s t z x y x a c y x sqrt b a t y x a if z 1 s pow y x 2 b else s pow x y 2 b statement 1 statement 2 statement 3 statement 4 statement 5 statement 6 cout z setw 6 z endl cout c setw 6 c endl cout s setw 6 s endl cout t setw 6 t endl 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 Question 3 15 points Show the output of the following program 4 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 5 Question 4 25 points a Draw the evaluation tree for the following expression t z a b 2 x y b Add the three decimal numbers 13 33 19 using 8 bit two s complement computation 6 Question 5 20 points Write a program in C to enter four integer numbers The program should determine and print out the smallest number of the four entered numbers For example if you enter 9 3 5 and 8 the program should print out 3 The program should print out the result in proper format Show the three phases of software development the analysis design draw a Flow Chart and implementation The Analysis The Flow Chart 7 The Program Good Luck 8


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?