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: 47 zephyr 82 python 19 mosaic 63 gravel.
Which of the following is Step 2 of the above arrangement?

Competition practiceInput-Output
  • Agravel mosaic 47 zephyr 82 python 19 63
  • Bmosaic gravel 47 zephyr 82 python 19 63
  • Cmosaic 47 zephyr 82 python 19 63 gravel
  • Dpython zephyr 47 82 19 mosaic 63 gravel

Step-by-Step Solution

Last letters: mosaic ends in c, gravel in l, python in n, zephyr in r. So the words leave in the order mosaic, gravel, python, zephyr. Step 1: mosaic 47 zephyr 82 python 19 63 gravel. Step 2: gravel mosaic 47 zephyr 82 python 19 63. Judging the words by their first letters instead would give gravel, mosaic, python, zephyr and hence mosaic gravel at the head; ranking the last letters from backwards would send zephyr and then python out first.
Answer: A) gravel mosaic 47 zephyr 82 python 19 63

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