Practice30Create account

A word-and-number rearrangement machine, given an input line, rearranges it step by step. In each step the smallest number not yet moved is shifted to the left, keeping the other elements in their existing relative order. Illustration — Input: cat 45 dog 12 ant 30 bee 8; Step 1: 8 cat 45 dog 12 ant 30 bee; Step 2: 8 12 cat 45 dog ant 30 bee; Step 3: 8 12 30 cat 45 dog ant bee; Step 4: 8 12 30 45 cat dog ant bee (last step). For the new Input: pen 27 owl 9 fan 51 sun 14, what will Step 2 be?

Competition practiceInput-Output
  • A9 14 pen owl 27 fan 51 sun
  • B14 9 pen 27 owl fan 51 sun
  • C9 14 27 pen owl fan 51 sun
  • D9 14 pen 27 owl fan 51 sun

Step-by-Step Solution

Step 1 moves the smallest number 9 to the front: 9 pen 27 owl fan 51 sun 14. Step 2 moves the next smallest, 14, to the second position, keeping the rest in order: 9 14 pen 27 owl fan 51 sun.
Answer: D) 9 14 pen 27 owl fan 51 sun

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, rearranges it step by…A word-and-number arrangement machine, when given an input line, rearranges it step by…A word-and-number machine rearranges an input line in steps. Input: 'gone 34 far 17 tree…A word-and-number machine rearranges an input line in steps. Input: 'gone 34 far 17 tree…A word-arrangement machine rearranges a line of words: at each step it moves the word…