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: 81 fern 47 gale 62 hazel 35 ivy 94.
At which step of the above arrangement does the line "18 fern 47 gale 26 hazel 35 ivy 94" appear?

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

Step-by-Step Solution

The offenders, left to right, are 81, 62 and 94; 47 and 35 already run upward. Step 1: 18 fern 47 gale 62 hazel 35 ivy 94. Step 2: 18 fern 47 gale 26 hazel 35 ivy 94 — the line asked about. Step 3, the last, would be 18 fern 47 gale 26 hazel 35 ivy 49. Since 94 is still standing at the end of the quoted line, the third and final turn has not yet been made, which rules out Step 3; and there is no Step 4, because only three numbers ever qualify.
Answer: D) Step 2

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 works on an input line of words and two-digit…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,…