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. What is Step III of this arrangement?

Competition practiceInput-Output
  • A8 apple 14 dog 37 cat 25 box
  • B8 apple 14 box 25 dog 37 cat
  • C8 apple dog 37 cat 25 box 14
  • D8 apple 14 box dog 37 cat 25

Step-by-Step Solution

Step I moves 8: '8 dog 37 cat 25 box 14 apple'. Step II moves apple: '8 apple dog 37 cat 25 box 14'. Step III moves 14: '8 apple 14 dog 37 cat 25 box'.
Answer: A) 8 apple 14 dog 37 cat 25 box

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, given an input line, rearranges it in steps. In…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.…