Logical Reasoning :: Flow Chart - Discussion
3 / 42
Study the flow chart give below and the questions that follow.
The purpose of the following chart is to put a zero in each of the boxes 2,4 and 6. In order to accomplish exactly this - no more and no less - Which number must be in box 3?
A0
B6
C10
D3
E8
Show Explanation
The answer is E.
The instruction 1 gets modified as long as the condition becomes false.
Step 1 defines (on the first occurance) and executes the instruction
Step 2 modifies the instruction
Step 3 does an evaluation
On each loop, the box 2, 4, 6, 8, 10... gets filled with 0. We need to limit it until 6 only.
When the last box count becomes 6, we need to execute the instruction. So, box 3 should not have 6. After executing instruction, it updates the box number to 8. Here, we need to break.
So, box 3 should contain 8.
Asked In ::
it should be 6
Execute this code and see
Map<Integer, Integer> box=new HashMap<>();
box.put(1,7);
box.put(2,6);
box.put(3,8);
box.put(4,1);
box.put(5,6);
box.put(6,10);
box.put(7,4);
box.put(8,3);
box.put(9,2);
box.put(10,14);
box.put(11,8);
box.put(12,9);
int result=box.get(12)-box.get(12);
int boxNumber=2;
int lastboxNumber=2;
while(true) {
box.put(boxNumber, result);
lastboxNumber=boxNumber;
boxNumber+=2;
if(lastboxNumber==box.get(3))
break;
}
System.out.println(box);
Read Full Answer
Report Error
Please Login First Click Here
People are confused with the question
In step 3 its says is the last box number mentioned in instruction 1 equal to number in box 3.
Here we need to compare the Box number with the box value...and also the question says update box B2,B4,B6 values but the answer given above is updating Box 8 also
Read Full Answer
Report Error
Please Login First Click Here
Explanation : Assume Box 3=8
Instruction 1 : 9[Box 12] - 9[Box 12] = 0[Box 2]
Instruction 2 : [Box 2] 2 = [Box 4]
Instruction 3 : IS [Box 2] = 6 ? NO
Instruction 1 : 9[Box 12] - 9[Box 12] = 0[Box 4]
Instruction 2 : [Box 4] 2 = [Box 6]
Instruction 3 : IS [Box 4] = 6 ? NO
Instruction 1 : 9[Box 12] - 9[Box 12] = 0[Box 6]
Instruction 2 : [Box 6] 2 = [Box 8]
Instruction 3 : IS [Box 6] = 6 ? YES
So answer is, number in box 3 = 6(B)
Read Full Answer
Report Error
Please Login First Click Here
Correct answer is Option B because in instruction 3, the last box number mentioned should be 6. And this box number 6 should be equal to the number in box 3.
Read Full Answer
Report Error
Please Login First Click Here
Assume [Box 3]=6 // becoz they mention above of the example put the 0 in boxes 2,4,6.
Instruction 1: 9[Box 12]- 9[Box 12]= 0[Box 2]
Instruction 2: [Box 2] 2= [Box 4] //increase box no from 2 to 4..
Instruction 3: IS[Box 2] = 6[Box 3] NO.
Instruction 1: 9[Box 12]- 9[Box 12]= 0[Box 4] // we have to use [Box 4] instead of [Box 2].
Instruction 2: [Box 4] 2= [Box 6] //increase box no from 4 to 6..
Instruction 3: IS[Box 4] = 6[Box 3] NO.
Instruction 1: 9[Box 12]- 9[Box 12]= 0[Box 4] // we have to use [Box 6] instead of [Box 4].
Instruction 2: [Box 6] 2= [Box 8]
Instruction 3: IS[Box 6] = 6[Box 3] YES.
End...
so [Box 3] = 6 // Option B
Read Full Answer
Report Error
Please Login First Click Here
The answer is E.
The instruction 1 gets modified as long as the condition becomes false.
Step 1 defines (on the first occurance) and executes the instruction
Step 2 modifies the instruction
Step 3 does an evaluation
On each loop, the box 2, 4, 6, 8, 10... gets filled with 0. We need to limit it until 6 only.
When the last box count becomes 6, we need to execute the instruction. So, box 3 should not have 6. After executing instruction, it updates the box number to 8. Here, we need to break.
So, box 3 should contain 8.
Read Full Answer
Report Error
Please Login First Click Here
Every iteration moves the Box number that (9-9) is going into.
Iteration one 9-9 = 0 moves into box 2
Iteration two 9-9 = 0 moves to box 4
Iteration three 9-9 = 0 is moves to box 6
So we've completed our task, all target boxes conatin a zero.
On iteration three instruction two - "Increase the last box number mentioned by 2" This now means
box 8 will have a 0 put in it if we go back around the loop. We do not want box 8 to have a zero in it.
So iteration three instruction three asks us " is box 8 (ie the number 8) = the NUMBER IN box 3.
We need this to be true so we can get out while box 8 hasn't been zerod.
So this means box 3 must be 8 for this to be true.
Read Full Answer
Report Error
Please Login First Click Here
correct ans is d).
inst 1. this is nothing but putting 0 in a box. which box? in first pass box no 2. but further this no increases by 2 by instruction 2. so in next pass box no will become 4 and 6 in third pass and so on.
inst 2. already explained above. this dose nothing but change box no used by inst1 to put 0 in.
inst3. now this is for terminating the loop.
how may time we want to run above instructions.
we want to put 0 in 2,4,6.
in first loop box2 will be selected and 0 goes there
in second loop box number in instruction 1 becomes 4 thus 0 goes there.
in third loop box number become 6 hence 0 goes there.
now the condition. last box mention in instruction 1 is getting increased by 2 and compared to value in box3.
so in loop1 value (1) in box4 compared to box3 --> don't want to terminate
so in loop2 value (10) in box6 compared to box3 --> don't want to terminate
so in loop1 value (3) in box8 compared to box3 --> want to termination loop hence be need value in box8 which is 3
hence answer is 3.
so we need
Read Full Answer
Report Error
Please Login First Click Here
Please can anybody explain to me how it is 3
Read Full Answer
Report Error
Please Login First Click Here
Correct answer is: Option E, box 3 should contain 8
Read Full Answer
Report Error
Please Login First Click Here