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 looks at the words that contain a double letter — the same letter twice in a row — and takes the one standing furthest to the left among those not already shifted, placing it at the extreme left end of the line. Words with no double letter, and all the numbers, are never shifted; every other element keeps its relative position, and the machine stops once every double-letter word has been shifted.
Input: 47 pebble 26 cedar 73 mirror 58 tulip.
Which of the following is Step 2 of the above arrangement?

Competition practiceInput-Output
  • Apebble mirror 47 26 cedar 73 58 tulip
  • Bpebble 47 26 cedar 73 mirror 58 tulip
  • Cmirror pebble 47 26 cedar 73 58 tulip
  • Dmirror cedar 47 pebble 26 73 58 tulip

Step-by-Step Solution

Only two of the four words carry a double letter: pebble has bb and mirror has rr; cedar and tulip have none and are never touched. The machine takes the leftmost qualifying word first, so pebble goes before mirror. Step 1: pebble 47 26 cedar 73 mirror 58 tulip. Step 2: mirror pebble 47 26 cedar 73 58 tulip. Stopping at Step 1 leaves pebble alone at the head. Dropping mirror just to the right of pebble instead of at the extreme left gives pebble mirror at the head — the same two words in the wrong order. The fourth line is what an ordinary alphabetical machine would produce, taking cedar first and mirror second.
Answer: C) mirror pebble 47 26 cedar 73 58 tulip

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,…An arrangement machine reshuffles an input line by reversing a block of elements at the…