Practice30Create account

A word-and-number arrangement machine, when given an input line of words and numbers, rearranges it in steps. In each step two elements trade the places they stand in: the largest number not already shifted, and the word that comes first in alphabetical order among the words not already shifted. Nothing else moves, and the machine stops as soon as either no unshifted number or no unshifted word is left.
Input: 27 patna 84 indore 51 surat 46.
Which of the following is Step 2 of the above arrangement?

Competition practiceInput-Output
  • A27 patna indore 84 51 surat 46
  • B27 51 indore 84 patna 46 surat
  • C27 46 indore 84 51 surat patna
  • D27 51 indore 84 patna surat 46

Step-by-Step Solution

Step 1 makes 84, the largest number, trade places with indore, the alphabetically first word: 27 patna indore 84 51 surat 46. Step 2 takes 51 (the largest number still unshifted) and patna (the alphabetically first word still unshifted) and makes them trade places: 27 51 indore 84 patna surat 46, the answer. "27 patna indore 84 51 surat 46" is Step 1 and "27 51 indore 84 patna 46 surat" is Step 3, the last step. "27 46 indore 84 51 surat patna" takes the smallest unshifted number, 46, instead of the largest.
Answer: D) 27 51 indore 84 patna surat 46

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

An input-output arrangement machine rearranges a line of words and numbers one step at a…An input-output arrangement machine rearranges a line of words and numbers one step at a…An arrangement machine works on an input line of words and numbers in steps. In each…A word-and-number arrangement machine, when given an input line of words and numbers,…A word-rearranging machine, given an input line of words, produces one step per pass.…