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 compares the last letters of the words that have not already been shifted, takes the word whose last letter comes earliest in the alphabet, and places it at the extreme left end of the line; if two words end in the same letter, the shorter one is taken first. Every other element keeps its relative position, and the machine stops once every word has been shifted.
Input: 52 ingot 76 cobra 18 jackal 43 kettle.
At which step of the above arrangement does the line "jackal kettle cobra 52 ingot 76 18 43" appear?

Competition practiceInput-Output
  • AStep 1
  • BStep 4
  • CStep 3
  • DStep 2

Step-by-Step Solution

Last letters: cobra ends in a, kettle in e, jackal in l, ingot in t. The order of shifting is cobra, kettle, jackal, ingot. Step 1: cobra 52 ingot 76 18 jackal 43 kettle. Step 2: kettle cobra 52 ingot 76 18 jackal 43. Step 3: jackal kettle cobra 52 ingot 76 18 43 — the line asked about. Step 4, the last, would be ingot jackal kettle cobra 52 76 18 43. Ingot is still standing among the numbers here, so one word remains to be shifted.
Answer: C) Step 3

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