This type of questions are asked in many examinations to check the candidates ability of word processing. There are basically three types of input output questions which are mostly asked in the exams.

1. Arranging the given numbers in ascending or descending order

2. Arranging the given words/alphabets according to dictionary

3. Changing positions of words/numbers according to a set pattern

So here in this post , first we will discuss about 1st type. The 2nd and 3rd types will be discussed in the next posts.

Arranging the given numbers in ascending or descending order:

Suppose we are given a question like the one given below:

Q:- An electronic device arranges numbers step-by-step in a particular order according to a set of rules. The device stops arranging the numbers when the final result is obtained.

Input- 98 78 96 102 62 33 53

Step-1 102 98 78 96 62 33 53

Step-2 102 98 96 78 62 33 53

Step-3 102 98 96 78 62 53 33

Step-3 is the last step and the device stops at step-3.

Study the above arrangement carefully and give the answer to the following questions:

(a) What is the last step of the input given below?

6 13 18 20 25

(b) What is the step 3 for the input given below?

45 77 53 11 29 27 5

Solution:

Read the above question carefully. You will easily find out that the numbers are arranged in descending order. You have to put the biggest number at first place and smallest number at last place as shown in the step 3 (last step). Also read the step 1 and step 2 so that you can see how the arrangement is done.

(1) In the step 1, 102 is positioned at the first place and all the numbers are then written as per their position remains after taking 102 at first place.

So put 102 at the first place and write all numbers after it. So the arrangement in the 1st step becomes

102 98 78 96 62 33 53

(2) now at step 2, since 98 is the second highest number. So we have to put it at second place. But since it already comes into 2nd place, so we don’t need to move its position. So in this case, we move further to find out next smaller number which is 96. So put 96 in the 3rd place and write all other numbers as it is given in the question right after 96. So the arrangement in 2nd step becomes

102 96 78 62 33 53

Note:-now look at which number comes after 96. Check if it is already at its position or not.

The next number should be 78 which is already at 4th position. So we don’t need to move it and we check for the next smaller number after 78. The next smaller number is 62 which is also at its place (5th position) as per the descending order. So we also don’t need to move its position and we move on to check next smaller number which is 53. 53 is placed after 33. So we need to create a step for positioning it before 33.

(3) So write down all the arrangement of the numbers as per the steps above and now in step 3, put 53 before 33. So the arrangement becomes

102 96 78 62 53 33

So after applying step 3, the arrangement comes in descending order. So no more steps needed. So that’s why step 3 is the last step.

Note:- These steps are nearly same for those questions in which ascending order is given or asked. But you just have to put the arrangement in the descending order.

Now solve the below questions by yourself to check your ability as per the question given above.

(Q-1) What is the step 3 for the input given below?

45 77 53 11 29 27 5

The answer will be

77 53 45 29 11 27 5- step 3

(Q-2)What is the last step of the input given below?

4 13 17 21 28

Answer will be

28 21 17 13 4 – step 4

Solve this question by yourself and check or not you understand the question’s basics.