Suppose, \'test\' is a char variable i.e., contains 8 bits. We need to check whe
ID: 3829667 • Letter: S
Question
Suppose, 'test' is a char variable i.e., contains 8 bits. We need to check whether the 4 MSbs of 'test' are equal to (the same as) 1001 or not. Which of the following tests, if TRUE, will do it? (test | 0 times 90)^0 times 90 = = 0 times 00 (test & 0 times 90) & 0 times F0 == 0 times 90 (test^0 times 90) & 0 times F0 == 0 times 00 (test | 0 times 90)^0 times 0F == 0 times 0F (test & 0 times 09) | 0 times 0F == 0 times 0F (test & 0xF0) | 0 times 09 == 0 times 09 (test^0 times F0) & 0 times 09 == 0 times 09Explanation / Answer
0x90 = 10010000
Anding it with test will make 4LSB's 0
then anding it will 11110000 (0XF0) will give 0X90 back
So answerr is (test & 0x90) & 0xF0 == 0x90
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.