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 leftmost unshifted word whose first letter falls in the first half of the alphabet — that is, from a to m — is taken out and placed at the extreme left end of the line. Words beginning with letters from n to , and all the numbers, are never shifted; every other element keeps its relative position, and the machine stops when no such word is left.
Input: 46 tabla 27 gita 58 rekha 19 anand meera.
Which of the following is the last step of the above arrangement?

Competition practiceInput-Output
  • Aanand gita 46 tabla 27 58 rekha 19 meera
  • Bmeera anand gita 46 tabla 27 58 rekha 19
  • Cgita anand meera 46 tabla 27 58 rekha 19
  • Dmeera anand gita rekha tabla 46 27 58 19

Step-by-Step Solution

Words beginning with a to m are gita, anand and meera; tabla and rekha begin with t and r and never move. Step 1: gita 46 tabla 27 58 rekha 19 anand meera. Step 2: anand gita 46 tabla 27 58 rekha 19 meera. Step 3 (last): meera anand gita 46 tabla 27 58 rekha 19. "anand gita 46 tabla 27 58 rekha 19 meera" is Step 2, one step short. "gita anand meera 46 tabla 27 58 rekha 19" keeps the three words in input order at the left instead of putting each new one in front. "meera anand gita rekha tabla 46 27 58 19" shifts rekha and tabla too, though both begin in the second half of the alphabet.
Answer: B) meera anand gita 46 tabla 27 58 rekha 19

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 works on an input line of words and two-digit…