ProgrammingVery hardGATE CS · Competitive coding (CP)
What is printed?
What is printed?
#include <stdio.h>
int main(void) {
unsigned a = 0xB6, b = 0x3C;
printf("%u", a & ~b);
}- A. 138
- B. 130
- C. 66
- D. 131
Correct answer: B. 130
~b keeps every bit outside 0x3C, and ANDing with a keeps the bits of a that are not in b. 0xB6 & 0xC3 = 0x82 = 130.
More C Programming questions
- What is printed? This program tries every subset of {3, 5, 6} and prints the largest XOR of a subset (the empty subset counts as 0). c…
- What is printed? c #include <stdio.h> char g[3][4] = {"110", "010", "011"}; int fill(int r, int c) { if (r < 0 || c < 0 || r >= 3 || c >=…
- What is printed? c #include <stdio.h> #include <stdlib.h> int cmp(const void a, const void b) { const int x = a, y = b; int sx = x[0] +…
- What is printed? c #include <stdio.h> #include <stdlib.h> struct Item { int id; char tag; }; int cmp(const void k, const void e) { const…
- What is printed? c #include <stdio.h> int digitsum(unsigned long long n) { return n == 0 ? 0 : (int)(n % 10) + digitsum(n / 10); } int…
- What is printed? Assume uint8t is 8 bits. c #include <stdint.h> #include <stdio.h> int main(void) { uint8t x = 3; for (int i = 0; i < 5…