Practice30Create account

A word-and-number arrangement machine, when given an input line of words and numbers, rearranges it in steps. Only the second letter of a word matters to this machine. In each step it looks over the words still waiting, picks the one whose second letter stands nearest the beginning of the alphabet, and moves that word to the extreme right end of the line. Should two waiting words carry the same second letter, whichever of them stood nearer the right-hand end of the input goes first. Nothing else changes place, and the machine halts when no word is left waiting.
Input: 26 flute 71 dahlia 58 quartz 34 pebble.
In Step 3 of the above arrangement, which element is fourth from the left end?

Competition practiceInput-Output
  • Aquartz
  • B58
  • C34
  • Ddahlia

Step-by-Step Solution

Second letters: dahlia gives a, pebble gives e, flute gives l, quartz gives u, so the words leave in that order. Step 1: 26 flute 71 58 quartz 34 pebble dahlia. Step 2: 26 flute 71 58 quartz 34 dahlia pebble. Step 3: 26 71 58 quartz 34 dahlia pebble flute. Counting from the left: 26, 71, 58, quartz — so quartz is fourth. Stopping a place short gives 58 and running a place past gives 34. Dahlia sits sixth, at the head of the finished block. Note that quartz has the latest second letter of the four and is the only word still waiting in mid-line at this stage.
Answer: A) quartz

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