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: rope 48 mint 63 lark 29 fern 85 gale 12.
In Step 3 of the above arrangement, which element is fourth from the right end?

Competition practiceInput-Output
  • Amint
  • B29
  • C63
  • Dfern

Step-by-Step Solution

Ten elements, so the swaps are (1,10), (2,9), (3,8), (4,7), (5,6). Step 1: 12 48 mint 63 lark 29 fern 85 gale rope. Step 2: 12 gale mint 63 lark 29 fern 85 48 rope. Step 3: 12 gale 85 63 lark 29 fern mint 48 rope. Counting from the right: rope, 48, mint, fern — so fern is fourth. Stopping a place short gives mint, going a place past gives 29, and counting from the left end instead gives 63.
Answer: D) fern

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