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: 34 pearl vine 72 18 dome 65 quartz.
Which of the following is Step 2 of the above arrangement?

Competition practiceInput-Output
  • A72 pearl vine 34 18 dome 65 quartz
  • B72 65 vine 34 18 dome pearl quartz
  • C72 65 34 vine 18 dome pearl quartz
  • D65 72 34 pearl vine 18 dome quartz

Step-by-Step Solution

Step 1: the largest number is 72, at position 4; it trades places with 34, which occupies position 1, giving 72 pearl vine 34 18 dome 65 quartz, and position 1 is now fixed. Step 2: the largest number still loose is 65, at position 7; the first unfixed position is 2, held by pearl, so 65 and pearl interchange: 72 65 vine 34 18 dome pearl quartz. The trap is to treat this like the familiar machine that lifts a number out and slides everything else along — that would give 65 72 34 pearl vine 18 dome quartz, with the words still in their original order. Here nothing slides; pearl is thrown back into the slot 65 vacated.
Answer: B) 72 65 vine 34 18 dome pearl quartz

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