Practice30Create account

A word-and-number arrangement machine rearranges any input line in steps. In each step two shifts happen together: the smallest number that has not already been shifted in an earlier step is taken out and placed at the extreme left end of the line, and at the same time the word that comes first in alphabetical order among the words not already shifted in an earlier step is taken out and placed at the extreme right end of the line. All the remaining elements keep their relative order, and the machine stops when no further shift is possible.
Input: 66 pearl 23 oak 95 grape 51 bell 38 tide.
Which of the following is Step 4 of the above arrangement?

Competition practiceInput-Output
  • A66 51 38 23 95 tide bell grape oak pearl
  • B95 66 51 38 23 bell grape oak pearl tide
  • C51 38 23 66 pearl 95 tide bell grape oak
  • D38 51 66 95 23 bell tide pearl oak grape

Step-by-Step Solution

Work the machine forward from the input. Step 1: 23 66 pearl oak 95 grape 51 38 tide bell. Step 2: 38 23 66 pearl oak 95 51 tide bell grape. Step 3: 51 38 23 66 pearl 95 tide bell grape oak. Step 4: 66 51 38 23 95 tide bell grape oak pearl. Hence the line shown is Step 4.
Answer: A) 66 51 38 23 95 tide bell grape oak pearl

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,…