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: 52 opal 34 pine 71 quartz 68.
Which of the following is the last step of the above arrangement?

Competition practiceInput-Output
  • A25 opal 34 pine 71 quartz 68
  • B25 opal 43 pine 17 quartz 86
  • C17 opal 34 pine 25 quartz 68
  • D25 opal 34 pine 17 quartz 68

Step-by-Step Solution

Test each number: 52 has 5 greater than 2, so it qualifies; 34 has 3 less than 4 and is left alone; 71 has 7 greater than 1 and qualifies; 68 has 6 less than 8 and is left alone. Step 1 turns the leftmost offender round, 52 becoming 25: 25 opal 34 pine 71 quartz 68. Step 2 turns 71 into 17: 25 opal 34 pine 17 quartz 68. Every number now runs upward, so the machine halts. Stopping at Step 1 leaves 71 untouched. Turning every number round regardless gives 25 opal 43 pine 17 quartz 86. The remaining line turns the right numbers round but also swaps their places, which the machine never does — nothing moves.
Answer: D) 25 opal 34 pine 17 quartz 68

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