Practice30Create account

A word-rearranging machine moves one word per step: in each step the word that comes last in alphabetical order among those not yet fixed is shifted into the rightmost free position, while the other words keep their relative order. Example - Input: 'zebra ant lion bear'. Step I: 'ant lion bear zebra'. Step II: 'ant bear lion zebra'. For the input 'mango apple orange grape', which line is Step II?

Competition practiceInput-Output
  • Agrape apple mango orange
  • Bapple grape orange mango
  • Cmango apple grape orange
  • Dapple grape mango orange

Step-by-Step Solution

Alphabetically last is orange, so Step I gives 'mango apple grape orange'. Next-last is mango, moved to the rightmost free slot in Step II: 'apple grape mango orange'.
Answer: D) apple grape mango orange

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 number-arranging machine moves one number per step: in each step the smallest number…A machine handles both words and numbers each step: the word earliest in alphabetical…A machine rearranges words in steps; each step moves the earliest-in-dictionary…A machine rearranges numbers in steps; each step moves the smallest not-yet-arranged…A machine rearranges numbers in steps; each step moves the largest not-yet-arranged…