Practice30Create account

A word-and-number arrangement machine, given an input line, rearranges it in steps. In each step it moves exactly one element to the front of the still-unarranged part (already-arranged elements stay fixed on the left and the remaining elements keep their order): on steps 1, 3, 5 and 7 it moves the smallest number still remaining, and on steps 2, 4 and 6 it moves the word that comes earliest in alphabetical order. Input: dog 37 cat 25 box 14 apple 8. Which step produces the arrangement '8 apple 14 box 25 cat dog 37'?

Competition practiceInput-Output
  • AStep IV
  • BStep VII
  • CStep VI
  • DStep V

Step-by-Step Solution

The steps are: I '8 dog 37 cat 25 box 14 apple', II '8 apple dog 37 cat 25 box 14', III '8 apple 14 dog 37 cat 25 box', IV '8 apple 14 box dog 37 cat 25', V '8 apple 14 box 25 dog 37 cat', VI '8 apple 14 box 25 cat dog 37', VII '8 apple 14 box 25 cat 37 dog'. The given arrangement is Step VI.
Answer: C) Step VI

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-arrangement machine rearranges an input line of words in steps. Input: 'tree…A rearrangement machine, given an input line, arranges all words in alphabetical order…A rearrangement machine moves, in each step, the smallest number not yet in place to the…A word-and-number arrangement machine rearranges an input line one step at a time.…A word-and-number rearrangement machine, given an input line, rearranges it step by…