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: 82 cedar 47 dune 35 fern 61 gale 93.
How many steps are needed to complete the rearrangement of the above input?

Competition practiceInput-Output
  • A4
  • B5
  • C9
  • D6

Step-by-Step Solution

The input holds five numbers — 82, 47, 35, 61 and 93 — and one step deals with each, so the machine halts after Step 5: cedar dune fern gale 10 11 8 7 12. The digit totals that appear along the way are new elements, not fresh work for the machine: the rule speaks of every number of the original line, so 10 is not picked up again and re-added. Counting the words gives four, counting every element gives nine, and adding an extra step for a final tidying-up gives six.
Answer: B) 5

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,…