ProgrammingVery hardCAT · MBA placement

The number of distinct arrangements (permutations of the letters, with identical letters not counted twice) of the string "AABBC" is computed by the procedure below. What is printed?

The number of distinct arrangements (permutations of the letters, with identical letters not counted twice) of the string "AABBC" is computed by the procedure below. What is printed?
count the permutations of the 5 positions and divide by the factorials of the repeat counts
Print result
  1. A. 120
  2. B. 60
  3. C. 30
  4. D. 6

Correct answer: C. 30

Five positions with A twice, B twice and C once give 5!/(2! 2! 1!) = 30 distinct strings. Treating all letters as distinct gives 120, dividing only by one repeat count gives 60, and counting arrangements of only four letters gives 6.

More Pseudocode and Code Tracing questions

Exams that ask this topic