# Quiz 3_Key - ICS 313-03(021 ID Quiz 3 Name Weight 4 18 Nov 2002 Q 1[5 points Describe a situation in which the add operator in a programming

This preview shows pages 1–2. Sign up to view the full content.

ICS 313-03 (021) Quiz # 3 Weight 4% 18 Nov, 2002 Q. 1 [5 points]: Describe a situation in which the add operator in a programming language would not be associative. Consider the integer expression A + B + C . Suppose the values of A , B , and C are 20,000, 25,000, and -20,000, respectively. Further suppose that the machine has a maximum integer value of 32,767. If the first addition is computed first, it will result in overflow. If the second addition is done first, the whole expression can be correctly computed. Q. 2 [5 points]: Assume the following rules of associativity and precedence for expression: Precedence: Highest *, /, not +, -, &, mod - (unary) =, /=, <, <=, >=, > and Lowest or, xor Associativity: left to right Show the order of evaluation of the following two expressions by parenthesizing all subexpressions and placing superscript on the right parenthesis to indicate order. a. a *(b - 1) / c mod d b. –a or c = d and e a. ( ( ( a * ( b - 1 ) 1 ) 2 / c ) 3 mod d ) 4 b. (( - a ) 1 or (( c = d ) 2 and e ) 3 ) 4 ID: ___________ Name: _____________________

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Q. 3
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 09/15/2010 for the course ICS ics103 taught by Professor Alvi during the Spring '07 term at King Fahd University of Petroleum & Minerals.

### Page1 / 2

Quiz 3_Key - ICS 313-03(021 ID Quiz 3 Name Weight 4 18 Nov 2002 Q 1[5 points Describe a situation in which the add operator in a programming

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online