ProgrammingHardGATE CS · Campus placements
How many permutations of 4 distinct items have no item in its original position?
- A. 6
- B. 8
- C. 9
- D. 12
Correct answer: C. 9
By inclusion-exclusion, D(4) = 24 - 4*6 + 6*2 - 4*1 + 1 = 9. These are the derangements, and the count is the same for any labelling of the items.
More C Programming questions
- How many distinct strings can be formed by arranging the letters of AABB?
- How many disk moves does the optimal Tower of Hanoi solution need for 5 disks?
- How many binary strings of length 4 contain at least two adjacent 1s?
- How many subsets of {1, 2, ..., 10} have an even sum of elements? The empty set counts.
- 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?