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.
Input: 19 opal 56 pier 32 quill.
At which step of the above arrangement does the line "pier opal 19 56 32 quill" appear?

Competition practiceInput-Output
  • AStep 2
  • BStep 4
  • CStep 5
  • DStep 3

Step-by-Step Solution

Step 1: opal 19 56 pier 32 quill. Step 2: 56 19 opal pier 32 quill. Step 3: pier opal 19 56 32 quill — the line asked about. Step 4 would be 32 56 19 opal pier quill and Step 5, the last, would be quill pier opal 19 56 32. A quick check settles it: the last two elements, 32 and quill, are still in their input places, so the block reversed so far cannot yet have reached them, which rules out Steps 4 and 5.
Answer: D) Step 3

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 reversing a block of elements at the…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,…