ProgrammingVery hard
What is the number of subsets of {0, 1, 2, 3, 4} whose element sum is even (the empty set counts)?
- A. 15
- B. 16
- C. 17
- D. 32
Correct answer: B. 16
Exactly half of the 32 subsets have an even sum, because toggling the element 0 changes the parity.
More C Programming questions
- The Gray code 0b110 is converted to ordinary binary using the prefix XOR rule. What is the decimal result?
- What does printf("%d", 8 & 7 == 0); print?
- How many integers from 1 to 10^9 are divisible by 7 or by 11?
- The modular inverse of 2 modulo the NTT prime 998244353 is which value?
- A linear congruential generator x = (1103515245 x + 12345) mod 2^31 starts with x = 1. What is the next value?
- With 64-bit arithmetic, what is (10^9 x 10^9) mod (10^9 + 7)?