Practice30Create account

An arrangement machine works on an input line of words and numbers in steps, using only the positions of the elements. In Step 1 it interchanges the elements standing 1st and 2nd, in Step 2 those standing 3rd and 4th, in Step 3 those standing 5th and 6th, and so on, each step taking the next untouched pair from the left. The machine stops when fewer than two untouched elements are left.
Input: rekha 74 manoj 58 kiran 92 pooja 36 varun.
How many steps are needed to complete the rearrangement of the above input?

Competition practiceInput-Output
  • A5
  • B9
  • C4
  • D3

Step-by-Step Solution

The line has nine elements. Step 1 swaps rekha and 74, Step 2 swaps manoj and 58, Step 3 swaps kiran and 92, Step 4 swaps pooja and 36. That leaves only varun, a single untouched element with no partner, so the machine stops: 4 steps. "5" counts a fifth step for the lone element varun, which cannot be interchanged with anything. "9" counts one step per element. "3" stops at the last pair that lies wholly within the first six places.
Answer: C) 4

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 works on an input line of words and numbers in steps. The numbers…An arrangement machine works on an input line of words and numbers in steps. The numbers…A word-and-number arrangement machine, when given an input line of words and numbers,…