Practice30Create account

A word-and-number arrangement machine, when given an input line of words and numbers, rearranges it in steps. In each step the machine takes the leftmost number that it has not already dealt with, replaces that number by the sum of its digits, and places the result at the extreme right end of the line. Words are never moved and never changed, every other element keeps its relative position, and the machine stops once every number of the original line has been dealt with.
Input: 58 marsh 39 tulip 64 raven 27.
Which of the following is the last step of the above arrangement?

Competition practiceInput-Output
  • Amarsh tulip raven 9 10 12 13
  • B13 12 10 9 marsh tulip raven
  • Cmarsh tulip raven 13 12 10 9
  • Dmarsh tulip raven 58 39 64 27

Step-by-Step Solution

Digit totals, taken left to right: 58 gives 13, 39 gives 12, 64 gives 10, 27 gives 9. Step 1: marsh 39 tulip 64 raven 27 13. Step 2: marsh tulip 64 raven 27 13 12. Step 3: marsh tulip raven 27 13 12 10. Step 4: marsh tulip raven 13 12 10 9. The results queue up left to right in the order they were made, so the tail reads 13 12 10 9; writing 9 10 12 13 sorts them upward instead. The words never move, so they cannot be pushed behind the numbers as in the second line, and the fourth line forgets the replacement altogether.
Answer: C) marsh tulip raven 13 12 10 9

Master this topic in 30 minutes a day.

Don't just memorise the answer — build a daily practice habit.

Practice 5 Similar Questions Free →

All Input-Output practice questions

More Input-Output practice

A word-and-number arrangement machine, when given an input line of words and numbers,…A word-and-number arrangement machine, when given an input line of words and numbers,…A word-and-number arrangement machine, when given an input line of words and numbers,…A word-and-number arrangement machine, when given an input line of words and numbers,…A word-and-number arrangement machine, when given an input line of words and numbers,…