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: 47 mango 82 tiger 19 cedar 63 vixen.
Which of the following is Step 2 of the above arrangement?

Competition practiceInput-Output
  • A47 82 tiger 19 cedar 63 vixen mango
  • B47 82 tiger 19 63 vixen cedar mango
  • Ccedar mango 47 82 tiger 19 63 vixen
  • D47 82 tiger 19 63 vixen mango cedar

Step-by-Step Solution

Second letters: mango gives a, cedar gives e, tiger gives i, vixen gives i. So mango goes first and cedar second. Step 1: 47 82 tiger 19 cedar 63 vixen mango. Step 2: 47 82 tiger 19 63 vixen mango cedar. Stopping at Step 1 leaves mango alone at the tail. Judging the words by their first letters instead would order them cedar, mango, tiger, vixen and put cedar out before mango, giving the tail vixen cedar mango. The remaining line sends the words to the extreme left instead of the right, which reverses their order as well as their side.
Answer: D) 47 82 tiger 19 63 vixen mango cedar

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