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: fig 82 gorse 47 holly 15 ivy 63.
In Step 4 of the above arrangement, which element is fifth from the left end?

Competition practiceInput-Output
  • A15
  • Bholly
  • Cfig
  • D63

Step-by-Step Solution

Step 1 (leftmost): 82 gorse 47 holly 15 ivy 63 fig. Step 2 (rightmost untouched, which is 63): 82 gorse 47 holly 15 ivy fig 63. Step 3 (leftmost, 82): gorse 47 holly 15 ivy fig 63 82. Step 4 (rightmost untouched, which is ivy): gorse 47 holly 15 fig 63 82 ivy. Counting from the left: gorse, 47, holly, 15, fig — so fig is fifth. Stopping a place short gives 15, running a place past gives 63, and counting to the third place gives holly. The untouched block has shrunk to gorse 47 holly 15 by now, and everything to its right is finished work.
Answer: C) fig

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