Practice30Create account

A word-and-number arrangement machine works on an input line of words and two-digit numbers in steps. In each step it finds the leftmost number whose tens digit is greater than its units digit and writes that number backwards in the place where it stands. Nothing changes position — only the digits of that one number are turned round — and the machine stops as soon as every number in the line has its tens digit smaller than its units digit.
Input: 96 pearl 38 quill 72 raven 54 stone 29.
Which of the following is Step 2 of the above arrangement?

Competition practiceInput-Output
  • A69 pearl 38 quill 72 raven 45 stone 29
  • B69 pearl 83 quill 27 raven 54 stone 29
  • C69 pearl 38 quill 27 raven 54 stone 29
  • D69 pearl 38 quill 27 raven 45 stone 29

Step-by-Step Solution

The offenders are 96, 72 and 54; 38 and 29 already run upward. The machine always takes the leftmost offender, so the order is 96, then 72, then 54. Step 1: 69 pearl 38 quill 72 raven 54 stone 29. Step 2: 69 pearl 38 quill 27 raven 54 stone 29. Working from the right end instead would deal with 54 second and give the first line. Turning 38 round as well gives the second line, but 3 is less than 8, so 38 is never touched. The last line is Step 3, one turn too far.
Answer: C) 69 pearl 38 quill 27 raven 54 stone 29

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