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 word and the rightmost word, counted among the words that have not already been interchanged, trade the places they stand in. The numbers never move at all, and the machine stops when fewer than two words are left uninterchanged.
Input: rekha 47 kavya 82 nisha 36 pooja 19 tara.
How many steps are needed to complete the rearrangement of the above input?

Competition practiceInput-Output
  • A3
  • B5
  • C2
  • D4

Step-by-Step Solution

There are five words: rekha, kavya, nisha, pooja, tara. Step 1 interchanges rekha and tara: tara 47 kavya 82 nisha 36 pooja 19 rekha. Step 2 interchanges kavya and pooja: tara 47 pooja 82 nisha 36 kavya 19 rekha. Only nisha is left uninterchanged, and a single word has no partner, so the machine stops after 2 steps. "3" counts a third step for the lone middle word nisha. "5" counts one step per word. "4" counts one step per number in the line.
Answer: C) 2

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 works on an input line of words and two-digit…A word-and-number arrangement machine works on an input line of words and two-digit…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,…