2. (24 pts) Based on the program given below, complete the following problems.
a. (12 pts) Give the binary representations of variables a, b, c, d, e and f respectively.
b. (9 pts) Write the output of the program. The output of each printf is worth 1 pt.
c. (3 pts) Briefly explain the outputs of "5_b", "8_e" and "9_f". Each explanation is
worth 2 pts.
#include<stdio.h>
int main() {
char a = 'e';
char b= a + 0x12;
char c = a + 0xf0;
unsigned char d = a + 0xc1;
char e = a << 1;
unsigned char f = a << 1;
printf("1_a = %c\n", a);
printf ("2_a = 0x%x\n", a);
printf("3_b = %c\n", b);
printf("4_b = %d\n", b);
printf ("5_c = %d\n", c);
printf("6_c = 0x%x\n", c);
printf("7_d = 0x%x\n", d);
printf("8_e = %d\n", e);
printf("9_f = %d\n", f);
return 0;
}
OUTPUT: