ProgrammingVery hardGATE CS · Campus placements
How many subsets of {1, 2, ..., 10} have an even sum of elements? The empty set counts.
- A. 500
- B. 512
- C. 1024
- D. 1000
Correct answer: B. 512
Element 1 is odd, so pairing each subset with the one that toggles 1 swaps even and odd sums. That makes exactly half of the 1024 subsets even, which is 512.
More C Programming questions
- The pairs (1,2), (3,5) and (2,5) are sorted by the second value descending, with ties broken by the first value ascending. Which pair…
- How many integers from 0 to 255 have exactly four 1 bits in binary?
- What is 0 ^ 1 ^ 2 ^ ... ^ 31, the XOR of all integers from 0 to 31?
- What is the total number of 1 bits in the binary forms of 1, 2, ..., 16 added together?
- uint16t s = 0; for (int i = 1; i <= 1000; i++) s += i; What is s at the end?
- #define CAT(a,b) a##b. After int CAT(num, 2) = 7; what does printf("%d", num2 2) print?