ProgrammingVery hardGATE CS · Campus placements
How many 6-bit masks have exactly two 1 bits and have bit 0 cleared?
- A. 15
- B. 6
- C. 10
- D. 20
Correct answer: C. 10
Bit 0 is fixed at 0, so the two set bits are chosen from bits 1 to 5, which is C(5,2) = 10.
More C Programming questions
- The binary-reflected Gray code of i is g(i) = i ^ (i >> 1). What is g(4)?
- What is popcount(0xFFFF0000 ^ 0x0F0F0F0F)?
- int q = NULL; if (q != NULL && q == 3) printf("yes"); else printf("no"); What is printed?
- #define ADD(a,b) a+b. What does printf("%d", 2 ADD(1,2) 3) print?
- #define HALF(x) x / 2. With int a = 5, b = 3, what does printf("%d", HALF(a + b)) print?
- char s[] = "2024"; int sum = 0; for (int i = 0; s[i] != '0'; i++) sum += s[i] - '0'; What is sum?