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 machine picks the largest number standing in the part of the line that is not yet fixed, and makes it trade places with whatever element occupies the first position of that not-yet-fixed part; that position then becomes fixed. Nothing else moves — the two elements simply interchange — and the machine stops once every number has been fixed.
Input: fern gorse 48 hazel 19 73 iris 36.
Which of the following is the last step of the above arrangement?

Competition practiceInput-Output
  • A19 36 48 73 fern gorse hazel iris
  • B73 48 36 19 hazel fern gorse iris
  • C73 48 36 19 hazel fern iris gorse
  • D19 36 48 73 hazel fern iris gorse

Step-by-Step Solution

Step 1: 73 trades with fern, giving 73 gorse 48 hazel 19 fern iris 36. Step 2: 48 trades with gorse, giving 73 48 gorse hazel 19 fern iris 36. Step 3: 36 trades with gorse, giving 73 48 36 hazel 19 fern iris gorse. Step 4: 19 trades with hazel, giving 73 48 36 19 hazel fern iris gorse, and every number is now fixed. The words end up in the order hazel, fern, iris, gorse — not their original order — precisely because each was thrown across the line into the slot its partner vacated. A machine that lifted the numbers out and let the rest close up would have finished with 19 36 48 73 fern gorse hazel iris, ascending and with the words undisturbed; that is the trap here.
Answer: C) 73 48 36 19 hazel fern iris gorse

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, when given an input line of words and numbers,…