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 takes the word that comes first in alphabetical order among the unshifted words that begin with a vowel, and places it at the extreme left end of the line. Once no unshifted word begins with a vowel, it takes the word that comes first in alphabetical order among the words that remain and places it at the extreme left end in the same way. Every other element keeps its relative position, and the machine stops once every word has been shifted.
Input: 41 nectar 87 opal 26 eagle 59 walrus.
Which of the following is the last step of the above arrangement?

Competition practiceInput-Output
  • Aeagle nectar opal walrus 41 87 26 59
  • Beagle opal nectar walrus 41 87 26 59
  • Cwalrus nectar opal eagle 26 41 59 87
  • Dwalrus nectar opal eagle 41 87 26 59

Step-by-Step Solution

Eagle and opal begin with vowels and go first, eagle before opal; nectar and walrus follow in alphabetical order. Step 1: eagle 41 nectar 87 opal 26 59 walrus. Step 2: opal eagle 41 nectar 87 26 59 walrus. Step 3: nectar opal eagle 41 87 26 59 walrus. Step 4: walrus nectar opal eagle 41 87 26 59. Since each word is dropped at the extreme left, the finished word block reads in the reverse of the shifting order — writing eagle opal nectar walrus records the order of the moves rather than the final line, and eagle nectar opal walrus is what a plain alphabetical machine would leave. The numbers are never shifted, so they keep the order 41, 87, 26, 59 instead of sorting themselves.
Answer: D) walrus nectar opal eagle 41 87 26 59

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,…An arrangement machine reshuffles an input line by interchanging one pair of elements…An arrangement machine reshuffles an input line by interchanging one pair of elements…An arrangement machine reshuffles an input line by interchanging one pair of elements…