Practice30Create account

A word-arrangement machine rearranges a line of words: at each step it moves the word that comes earliest in alphabetical order (among those not yet placed) to the left, keeping the other words in their order. Example - Input: 'orange apple grape lemon'; Step 1: 'apple orange grape lemon'; Step 2: 'apple grape orange lemon'. For the input 'table chair book desk lamp', what is Step 2?

Competition practiceInput-Output
  • Achair book table desk lamp
  • Bbook chair desk table lamp
  • Cbook table chair desk lamp
  • Dbook chair table desk lamp

Step-by-Step Solution

Step 1 moves 'book' to the left: book table chair desk lamp. Step 2 moves the next alphabetical word 'chair' next: book chair table desk lamp.
Answer: D) book chair table desk lamp

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-arrangement machine reorders numbers by moving the smallest not-yet-placed…A number-arrangement machine reorders numbers by shifting the largest not-yet-placed…A machine rearranges a line of words by moving the leftmost word to the right end at…A machine rearranges words by moving the word that comes last in alphabetical order…A machine rearranges a line of numbers; in each step it moves the smallest number not…