Вы находитесь на странице: 1из 6

The American University in Cairo

Computer Science & Engineering Department


CSCE 106 04/10/12

Dr. Rania Mameesh EXAM-I Fall 2009

Last Name: ........................................................... ID: ...................................

First Name: ........................................................... Section: ............................

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.
* Please make sure that you wrote your name, section, and ID in the indicated places.
* No electronic devices, cell phones, calculators, etc.
* Read the honesty policy.
* Sign the following statement.

HONESTY POLICY
Cheating in Exams is a violation of the honesty policy of AUC. Whispering, talking, looking at someone else‟s
paper, or copying from any source is considered cheating. Anyone 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
Group Points Grade
I 10
II 20
III 20
IV 20
V 10
VI 8
VII 12
Total 86

1
Group I – Multiple choice (10 points)
Please circle the correct answer/answers for each of the following statements. Note that, you lose quarter of the
points for each incorrect circled answer. You lose all points if you don‟t circle correct answer.
1) The largest integer number that can be stored in 8-bit two's complement format is:
a. 256
b. 12
c. 64
d. a and b
2) The smallest integer number that can be stored in 16-bit unsigned format is:
a. 4
b. -128
c. 127
d. all of the above
3) How many distinct values can be represented with m bits?
a. m-1
b. 2m-1
c. 2m
d. None of the above
4) Which of the following is true about C++ multiple operators in expressions:
a. Operator precedence means first unary operators, followed by * / %, followed by binary operators
b. Associativity means same precedence expressions are evaluated left to right
c. x * y * z + a / b - c * d = (x * y * z) + (a / b) – (c * d)
d. –y + z = -(y+z)
5) Programs cannot be stored
a. in accumulator.
b. in the arithmetic and logical unit.
c. on magnetic disk.
d. on magnetic disk.
6) In flow charts, the rectangular symbol represents
a. processing
b. input
c. output
d. condition (yes/no)
7) The unit responsible to fetch/decode instructions
a. control unit
b. arithmetic logic unit
c. accumulator
d. none of the above
8) The advantages of high level language over assembly language can be
a. CPU independent
b. requires less memory
c. more readable
d. none of the above
9) The following data in C++: „a‟, “a”, „5‟, “55”, 55, “5”, are of types:
a. char, string, char, string, int, string
b. char, string, int, int, int, int
c. char, string, char, string, long, string
d. char, char, char, char, long, char
10) Which of the following C++ mixed data type math is true?
a. 5.0/2 = 5.0/2.0 = 2
b. 5.0/2 = 2.5
c. 5/2 = 2
d. float a; a = 5/2; //a is 2.0

2
Group II – Listing (20 points)
Please list the following.
11) Give five phases of software development
a. analysis_____________.
b. design______________.
c. implementation______.
d. testing______________.
e. documentation_______.
12) Give the four phases of processing a high level language program
a. compilation_________.
b. linking_____________.
c. loading_____________.
d. execution___________.
13) Give three components of the central processing unit
a. register_____________.
b. ALU_______________.
c. CU_________________.
14) List three types of programming errors
a. syntax_____________.
b. logical_______________.
c. runtime or undetected_________________.
15) Count in ternary starting at (21) 3 + (1) 3
a. 22_____________.
b. 100_______________.
c. 101_________________.
d. 102_________________.
e. 110_________________.

Group III – Numbering Conversions (20 points)


16) (1110101011)2 = ( 1653 )8

3
17) (256)10 = ( 100 )16

18) (12.125)10 = ( 1100.001 )2

19) (1012)3 = ( 100000 )2

4
Group IV – Numbering Representations (20 points)
20) Please convert the following numbers, given using the decimal number system, to binary representation in a
byte, using the four different representations. Please show all of the necessary draft work. (10 points)
Q Number Unsigned Sign-Magnitude One's Complement Two's Complement
21) 257 Not Possible Not Possible Not Possible Not Possible
22) -100 Not Possible 1110 0100 1001 1011 1001 1100
23) 127 0111 1111 0111 1111 0111 1111 0111 1111
24) -0 Not Possible 1000 0000 1111 1111 0000 0000

Group V – Numbering Systems Arithmetic (10 points).


25) Perform the following operation using 8-bit two's-complement representation. Add (-22)10 to (39)10

39 0010 0111
- 22 1110 1010
17 0001 0001

26) Perform the following operations using 8-bit two's-complement representation. Subtract (24)10 from (-18)10.

- 18 1110 1110
- 24 1110 1000
- 42 1101 0110

5
Group VI – Flowchart (8 points)
27) Please design an algorithm, using the flow chart below, to calculate the quotient and remainder of dividing a
number n1 by another number n2. Your algorithm must receive as input the values of the two numbers and must
output on the screen the quotient and remainder of the division. Fill and name each symbol in the flowchart with
the appropriate information.

start

INPUT
n1, n2

remainder = n1 % n2
quotient = n1 / n2

OUTPUT
quotient,
remainder

stop

Group VII – C++ (12 points).


28) Please provide the missing six things, where indicated by a line, in the following C++ source code.

//_ This program displays the word "Hello!" to the user

#_ include <iostream________>
using namespace std;

void main____ ()
{
cout << "Hello!" ;_
}_

Вам также может понравиться