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 smallest of the numbers that are divisible by 3 and have not already been shifted, and places it at the extreme left end of the line. Numbers not divisible by 3, and all the words, are never shifted; every other element keeps its relative position, and the machine stops once every number divisible by 3 has been shifted.
Input: beans 72 rice 45 noodles 58 pudding 21.
Which of the following is the last step of the above arrangement?

Competition practiceInput-Output
  • A21 45 72 beans rice noodles 58 pudding
  • B45 21 beans 72 rice noodles 58 pudding
  • C72 45 21 beans rice noodles 58 pudding
  • D72 58 45 21 beans rice noodles pudding

Step-by-Step Solution

The multiples of 3 are 21, 45 and 72; 58 is not one. Step 1: 21 beans 72 rice 45 noodles 58 pudding. Step 2: 45 21 beans 72 rice noodles 58 pudding. Step 3 (last): 72 45 21 beans rice noodles 58 pudding. "21 45 72 beans rice noodles 58 pudding" reads the left block in ascending order, which would need the numbers to be added from the right of the block rather than in front of it. "45 21 beans 72 rice noodles 58 pudding" stops one step early, at Step 2. "72 58 45 21 beans rice noodles pudding" shifts 58 as well, although 58 is not divisible by 3.
Answer: C) 72 45 21 beans rice noodles 58 pudding

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,…An arrangement machine works on an input line of words and numbers in steps, using only…An arrangement machine works on an input line of words and numbers in steps, using only…A word-and-number arrangement machine, when given an input line of words and numbers,…