For each C code fragment, give the final value of the indicated variable after t
ID: 3543054 • Letter: F
Question
For each C code fragment, give the final value of the indicated variable after the code fragment is run. If the final value cannot be determine, then give N/A.
A. Final value of ch is ______ (in hex)
char ch = 0x55;
ch = ch << 5;
B. Final value of int_ptr is ______ (in hex)
int my_int = 0x55; // Assume my_int is located at address 0xFC00
int *int_ptr;
my_int = my_int >> 3;
int_ptr = &my_int;
int_prt++;
C. Final value of my_int is ______ (in hex)
int my_int = 0x55; // Assume my_int is located at address 0xFFFE
int *int_ptr;
int_ptr = &my_int;
int_ptr++;
my_int++;
if(int_ptr){
my_int = 0x44;
}
else {
my_int = 0x33;
}
D. Final value of flag is ______ (in decimal)
signed char ch = -128;
char flag = 0;
ch--;
if(50 > ch){
flag = 1;
}
E. Final value of ch is ______ (in decimal)
char ch = 5;
char *ch_ptr = &ch;
ch_ptr = ch_ptr << 16;
if(ch_ptr > 0x7FC0){
ch = 1;
}
Explanation / Answer
1.0xffa0
2.0x23fd78
3.44
4.NULL
5.Invalid operands u cannot compare pointer and integer
ch_ptr = ch_ptr << 16; this cannot be done
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.