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 smallest number that has not already been shifted is taken out and placed at the extreme right end of the line, every other element keeping its relative position. The machine does not always shift every number: it stops as soon as a step produces a line whose leftmost element is a word, and if that never happens it stops when the last number has been shifted.
Input: 68 marble 25 nutmeg 47 olive 13 poplar.
Which of the following is Step 2 of the above arrangement?

Competition practiceInput-Output
  • A68 marble 25 nutmeg 47 olive poplar 13
  • B68 marble nutmeg 47 olive poplar 13 25
  • C68 marble nutmeg olive poplar 13 25 47
  • D68 marble nutmeg 47 olive poplar 25 13

Step-by-Step Solution

Ascending order: 13, 25, 47, 68. Step 1: 68 marble 25 nutmeg 47 olive poplar 13. Step 2: 68 marble nutmeg 47 olive poplar 13 25. The line still opens with 68 at this point, so the machine has not yet halted; it will run on to Step 3 and stop at Step 4, when marble reaches the head. Stopping one step short gives the first line and running one step on gives the third. The last line puts the finished numbers in the wrong order: each new number is dropped at the extreme right, so the one shifted first ends up furthest left of the pair, giving 13 25 rather than 25 13.
Answer: B) 68 marble nutmeg 47 olive poplar 13 25

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 works on an input line of words and two-digit…A word-and-number arrangement machine works on an input line of words and two-digit…A word-and-number arrangement machine works on an input line of words and two-digit…A word-and-number arrangement machine works on an input line of words and two-digit…A word-and-number arrangement machine works on an input line of words and two-digit…