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: pelican 23 orbit 68 marsh 41 ulcer 57.
In Step 2 of the above arrangement, which element is second from the right end?

Competition practiceInput-Output
  • A57
  • B41
  • Cmarsh
  • Dorbit

Step-by-Step Solution

Orbit and ulcer begin with vowels, orbit first alphabetically, so they are shifted before marsh and pelican. Step 1: orbit pelican 23 68 marsh 41 ulcer 57. Step 2: ulcer orbit pelican 23 68 marsh 41 57. Counting from the right end of Step 2: 57, then 41 — so 41 is second. Taking the very last element gives 57, going one place further gives marsh, and counting from the left end instead gives orbit.
Answer: B) 41

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

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…An arrangement machine reshuffles an input line by interchanging one pair of elements…A word-and-number arrangement machine, when given an input line of words and numbers,…