Question 1: unsigned char a; a=4; a=~a; What is the value of a? a)16 b)-4 c)72 d
ID: 3726032 • Letter: Q
Question
Question 1:
unsigned char a;
a=4;
a=~a;
What is the value of a?
a)16
b)-4
c)72
d)20
e)251
Question 2:
1. #include<stdio.h>
2. main(){
3. unsigned char a, b;
4. a = 19;
5. a = a << 2;
6. b = 67;
7. b = b >> 4;
8. printf("%d % d ", a, b);
9. a = (a | b) << 1;
10. a = ~ a;
11. printf("%d ", a);
}
Your answer should look something like this:
Binary value of a in line 4 is:
Binary value of a in line 5 is:
Binary value of b in line 6 is:
Binary value of b in line 7 is:
Printed values of a & b in line 8 is:
Binary value of a in line 9 is:
Binary value of a in line 10 is:
Printed value of a in line 11 is:
Explanation / Answer
Question 1 :
Answer is e)251
*********************
Question 2 :
Binary value of a in line 4 is: 10011
Binary value of a in line 5 is: 1001100
Binary value of b in line 6 is: 1000011
Binary value of b in line 7 is: 100
Printed values of a & b in line 8 is: 76 & 4
Binary value of a in line 9 is: 10011000
Binary value of a in line 10 is: 1100111
Printed value of a in line 11 is: 103
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.