Practice30Create account

A word-and-number arrangement machine, when given an input line of words and numbers, rearranges it in steps. The elements it has not yet touched always stand together at the left of the line, in their original order. In each step the machine takes one untouched element and places it at the extreme right end of the line: in odd-numbered steps it takes the leftmost untouched element, and in even-numbered steps it takes the rightmost untouched element. The machine stops once no untouched element is left.
Input: 34 pearl 61 vine 27 dome.
Which of the following is Step 3 of the above arrangement?

Competition practiceInput-Output
  • Apearl 61 vine 27 34 dome
  • B61 vine 34 dome pearl 27
  • Cvine 27 dome 34 pearl 61
  • D61 vine 27 34 dome pearl

Step-by-Step Solution

Step 1 is odd, so the leftmost untouched element, 34, goes to the far right: pearl 61 vine 27 dome 34. Step 2 is even, so the rightmost untouched element — dome, since 34 has already been taken — goes to the far right: pearl 61 vine 27 34 dome. Step 3 is odd again, so pearl goes: 61 vine 27 34 dome pearl. Stopping one step short leaves the Step 2 line, and running one step on gives 61 vine 34 dome pearl 27. The other near-miss comes from taking the leftmost element every time, ignoring the alternation, which reaches vine 27 dome 34 pearl 61 by Step 3.
Answer: D) 61 vine 27 34 dome pearl

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