Question: For this problem, consider a hypothetical 8-bit machine that supports both signed and unsigned arithmetic. On this machine both int and unsigned are encoded using

For this problem, consider a hypothetical 8-bit machine that supports both signed and unsigned arithmetic. On this machine both int and unsigned are encoded using all 8 hits, while char and unsigned char are encoded using 4 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 printf statement. 1. unsigned char a = 0; unsigned char b = a - 1; if(a > b) { printf("A"); } else{ printf("B"); } Output: 2. char a char b = a + a; if (a > b) { printf("A"); } else{ printf("B"); } Output: 3. int a -65; int b = a + a; printf("%d", b); Output: 4. int a = 127; int b = a + 1; if(a > b) { printf ("A"); } else{ printf("B"); } Output: 5. char a -7; char b = a - 1; if(a > b) { printf("A"); } else{ printf("B"); } Output
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
