Practice30Create account

A word-and-number arrangement machine, when given an input line of words and numbers, rearranges it in steps. In each step the machine takes the number lying nearest to 50 in value, among the numbers not already shifted, and places it at the extreme left end of the line; if two unshifted numbers lie equally far from 50, the larger of them is taken first. Words are never shifted, every other element keeps its relative position, and the machine stops once every number has been shifted.
Input: 82 pretzel 47 candy 19 fudge 63.
Which of the following is Step 2 of the above arrangement?

Competition practiceInput-Output
  • A47 82 pretzel candy 19 fudge 63
  • B19 63 47 82 pretzel candy fudge
  • C63 47 82 pretzel candy 19 fudge
  • D47 63 82 pretzel candy 19 fudge

Step-by-Step Solution

Distances from 50 are: 82 is 32 away, 47 is 3 away, 19 is 31 away, 63 is 13 away. Step 1 takes 47: 47 82 pretzel candy 19 fudge 63. Step 2 takes 63, the next nearest: 63 47 82 pretzel candy 19 fudge, the answer. "47 82 pretzel candy 19 fudge 63" is Step 1 and "19 63 47 82 pretzel candy fudge" is Step 3. "47 63 82 pretzel candy 19 fudge" keeps the two shifted numbers in the order they were taken, forgetting that each new one is placed in front of the earlier one.
Answer: C) 63 47 82 pretzel candy 19 fudge

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