Practice30Create account

An arrangement machine reshuffles an input line by reversing a block of elements at the left end, one block per step. In Step 1 it reverses the order of the first two elements, in Step 2 the first three elements, in Step 3 the first four, and so on, each step reversing one element more than the step before. Nothing is added to or taken out of the line, and the machine stops after the step that reverses the whole line.
The last step of a certain run of this machine reads: vine 85 27 gale fern.
Which of the following was the input line?

Competition practiceInput-Output
  • Agale 27 85 fern vine
  • B27 gale 85 fern vine
  • Cfern gale 27 85 vine
  • D85 27 gale fern vine

Step-by-Step Solution

Five elements means four steps, so run each candidate forward and see which one finishes as vine 85 27 gale fern. From 27 gale 85 fern vine: Step 1 gale 27 85 fern vine, Step 2 85 27 gale fern vine, Step 3 fern gale 27 85 vine, Step 4 vine 85 27 gale fern — a match. The tempting shortcut is to assume the last step simply turns the input round, which would make the input fern gale 27 85 vine; run that forward and it ends as vine 27 fern gale 85 instead. The other two candidates are lines from the correct run itself — gale 27 85 fern vine is its Step 1 and 85 27 gale fern vine its Step 2 — and neither reproduces the quoted line when started afresh.
Answer: B) 27 gale 85 fern vine

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