ProgrammingModerate
What is the parity of the number 0b1101011 (1 for odd count of set bits)?
- A. 0
- B. 2
- C. 1
- D. 5
Correct answer: C. 1
0b1101011 has five set bits, an odd count, so the parity is 1.
More C Programming questions
- What is (-8) >> 1 in C if the platform uses arithmetic right shift for signed values?
- To multiply x by 2^k where x is an unsigned 32-bit value, which code is correct?
- A program uses a modulus of 10^9 + 7 and computes (a - b + MOD) % MOD for a and b in [0, MOD). Why add MOD before the %?
- What is the value of 5 & 6 | 3 in C?
- What is the value of 0x80 | 0x01 | 0x10 in decimal?
- What is printed? c #include <stdint.h> #include <stdio.h> int main(void) { uint8t a = 0xB6; uint8t b = (uint8t)(a << 3); uint8t c = a >>…