GATE Daily

Monday26 October 2026

Past sets26 Oct 2026Aptitude

Probability and counting: GATE CS question with solution

Q.1

Five different books , , , and are to be placed in a single row on a shelf. In how many of the arrangements is book not in the leftmost position and book not in the rightmost position?

One try. It counts in your 26 Oct 2026 set.
Show solution
RememberFor "none of the forbidden events", count total minus the union, and compute the union as . Forgetting the overlap term is the usual slip.

Solution MCQ · 1 mark · −⅓ if wrong

Answer: (B) 78

Method: count the complement with inclusion-exclusion.

All arrangements: .

Let = arrangements with leftmost and = arrangements with rightmost.

  • (fix , arrange the other four).
  • .
  • ( leftmost and rightmost, arrange the middle three).

Bad arrangements: . Good arrangements: .

Check by direct counting. If is rightmost, cannot be rightmost, so the other four go anywhere: . If is in one of the three middle positions, has 3 allowed positions out of the remaining 4, and the other three books fill the rest in ways: . Total .

Trap. Subtracting from 120 gives 72: the 6 arrangements that break both rules were removed twice and must be added back once. Applying only one rule gives 96.

What was tested: turning "not this and not that" into a complement and applying two-set inclusion-exclusion correctly.

Copied. Paste it into the new chat.Too long to send. Copy the question and solution by hand.