Multiple choice

A four-letter code is formed using only the letters A, B, and C, such that both B and C appear at least once in the code. What is the total number of such distinct four-letter codes that can be formed?

  1. 32

  2. 50

  3. 48

  4. 78

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Total codes of length 4 using {A, B, C} is 3^4 = 81. We must exclude codes missing B or C. Using inclusion-exclusion: codes missing B = 2^4 = 16, codes missing C = 2^4 = 16, codes missing both (only A) = 1^4 = 1. Total invalid = 16 + 16 - 1 = 31. Valid codes = 81 - 31 = 50.

AI explanation

Using the principle of inclusion-exclusion, the total unrestricted codes are 3^4 = 81. The codes missing B are 2^4 = 16, and the codes missing C are also 2^4 = 16. The codes missing both B and C consist only of A, giving exactly 1 code. Therefore, the number of valid codes is 81 - 16 - 16 + 1 = 50.