Page 1 of 1

5. [16 points] For this problem, consider a hypothetical 10-bit machine that supports both signed and unsigned arithmeti

Posted: Mon Jul 11, 2022 9:55 am
by answerhappygod
5 16 Points For This Problem Consider A Hypothetical 10 Bit Machine That Supports Both Signed And Unsigned Arithmeti 1
5 16 Points For This Problem Consider A Hypothetical 10 Bit Machine That Supports Both Signed And Unsigned Arithmeti 1 (155.7 KiB) Viewed 30 times
5. [16 points] For this problem, consider a hypothetical 10-bit machine that supports both signed and unsigned arithmetic. On this machine both int and unsigned are encoded using all 10 bits, while char and unsigned char are encoded using 5 bits. Assume as well that two's- complement encoding is used for the signed values. For each of the following code snippets, indicate what is printed out by the print f statement. (a) [2 points] int a 288; char c = (char) a; int b = (int) c; printf("%d", b); Output: (b) [2 points] int a = 147; char c = (char) a; int b = (int) c; printf("%d", b); Output: (c) [2 points] int a 147; unsigned char c = (unsigned char) a; int b = (int) c; printf("%d", b); Output: (d) [2 points] char c= -7; int a = (int) c; unsigned b = (unsigned) a; printf("%u", b); Page Output: 8 of 10 C | ZOOM +