Practice30Create account

A word-and-number arrangement machine, when given an input line of words and numbers, rearranges it in steps. In each step the word having the most letters, among the words not already shifted in an earlier step, is taken out and placed at the extreme right end of the line; if two words are equally long, the one that comes earlier in alphabetical order is taken first. Every other element keeps its relative position, and the machine stops once every word has been shifted.
Input: 47 lantern 82 fig 19 breeze 63 opal.
Which of the following is Step 2 of the above arrangement?

Competition practiceInput-Output
  • A47 82 fig 19 breeze 63 opal lantern
  • B47 lantern 82 19 breeze 63 fig opal
  • Cbreeze lantern 47 82 fig 19 63 opal
  • D47 82 fig 19 63 opal lantern breeze

Step-by-Step Solution

Letter counts: lantern 7, breeze 6, opal 4, fig 3, so the words leave in that order. Step 1: 47 82 fig 19 breeze 63 opal lantern. Step 2: 47 82 fig 19 63 opal lantern breeze. Two slips are on offer: taking the shortest word first would put fig then opal at the right end, and sending the longest word to the left instead of the right would open with breeze lantern. Stopping at Step 1 leaves lantern alone at the end.
Answer: D) 47 82 fig 19 63 opal lantern breeze

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 of words and numbers,…A word-and-number arrangement machine, when given an input line of words and numbers,…A word-and-number arrangement machine, when given an input line of words and numbers,…A word-and-number arrangement machine, when given an input line of words and numbers,…A word-and-number arrangement machine, when given an input line of words and numbers,…