C Programming · Question 26 · Medium

What will be the output of the following C program?

#include <stdio.h>

int main(void) {
    unsigned int n = 200;
    printf("%u %u", n >> 3, n & 0x0F);
    return 0;
}
  1. 25 12
  2. 1600 8
  3. 25 8
  4. 25 0
Answer and explanation

Answer: C. 25 8

Explanation: 200 >> 3 is 200 / 8 = 25. 200 is 0xC8 in hex, so masking with 0x0F keeps the low hex digit, 8.

Previous: What will be the output of the following C program? · Next: What will be the output of the following C program?

Practise c programming

Try a fresh set of c programming questions with an explanation after every answer, free and without signing up: C Programming practice. Or sit a full placement mock test.

More c programming questions

More technical & programming practice

Java · Python · Data Structures · Algorithms · Object-Oriented Programming · DBMS · SQL · Operating Systems

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge