Practice30Create account

An arrangement machine reshuffles an input line by interchanging one pair of elements per step. In Step 1 it interchanges the elements standing at the 1st and the last positions, in Step 2 those at the 2nd and the second-last positions, in Step 3 those at the 3rd and the third-last positions, and so on. Nothing is ever taken out of the line — the two elements simply trade places — and the machine stops when no untouched pair is left to interchange.
Input: 34 pearl 61 vine 27 dome 85 kite.
Which of the following is Step 2 of the above arrangement?

Competition practiceInput-Output
  • Akite pearl 61 vine 27 dome 85 34
  • Bkite 85 61 vine 27 dome pearl 34
  • C34 85 61 vine 27 dome pearl kite
  • Dkite 85 dome vine 27 61 pearl 34

Step-by-Step Solution

The line holds eight elements. Step 1 swaps positions 1 and 8, that is 34 and kite: kite pearl 61 vine 27 dome 85 34. Step 2 swaps positions 2 and 7 of that new line, that is pearl and 85: kite 85 61 vine 27 dome pearl 34. The commonest slip is to apply the second swap to the original input rather than to the line Step 1 produced, which leaves 34 and kite sitting at the ends. Step 3, which swaps positions 3 and 6, comes one move later.
Answer: B) kite 85 61 vine 27 dome pearl 34

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…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,…