advertisement

CPIT 201: Introduction to Computing CH4: Operations on Bits Assignment ((NO hand out)) QUESTION 1 (7 points) Mark each of the following sentences with True () or False (). ((Showing your work)) a. b. c. d. e. f. g. NOT (F9)16 = (16)16 (10001010)2 OR (00101011)16 = (10111011)2 [ NOT(AE)16 ] AND (0A)16 (0)16 NOT [(16)16 OR (30)16] = (40)10 [(99)16 AND (33)16] OR [(00)16 AND (FF)16] = (7)16 (71)8 OR (55)8 AND [ (71)8 OR (23)8 ] = (90)8 (00111100)2 XOR [ NOT(11100111)2 ] = (00111100)2 ( ( ( ( ( ( ( QUESTION 2 (5 points) Construct the mask and choose the appropriate binary logical operator to execute the following a. Unset the four leftmost bits of (01100111)2 b. Set the two rightmost bits of (00100001)2 c. Flip the three leftmost and the two rightmost bits of (01100111)2 d. Set the forth bit (count from right to left) of (01100111 )2 e. Extract the fourth and fifth bits (count from right to left) of the unsigned integer (44)10 3.Nov.2009 15-AlQeadahl-1430 ) ) ) ) ) ) ) CPIT 201: Introduction to Computing CH4: Operations on Bits Assignment ((NO hand out)) QUESTION 3 (4 points) Using an 8-bits allocation, represent each decimal number in the mentioned representation. Then, calculate the following operations (convert the final result to decimal) a. b. c. d. (33)10 + (25) 10 (-13) 10 – (6) 10 (13) 10 + (-6) 10 (10) 10 – (20) 10 Two’s Complement Sign and Magnitude Sign and Magnitude Two’s Complement QUESTION 4 (6 points) Show the results of the following shift operations a. b. c. d. e. f. Arithmetic right shift on (01100110) 2 “Evaluate your result” Circular right shift on (01000111)2 Arithmetic left shift on (10000010) 2 “Evaluate your result” Logical left shift on (00101111) 2 Arithmetic left shift on (01100110) 2 “Evaluate your result” Arithmetic right shift on (10010000) 2 “Evaluate your result” NOTE that : the Arithmetic shift operations assume that the bit pattern is a signed integer in two’s complement format the Logical shift operations that the bit pattern is an unsigned integer 3.Nov.2009 15-AlQeadahl-1430