21. The object of the following flow-chart is to rearrange the numbers in boxes 1, 2 and 3 in such a fashion that, at the end:
Box 3 will always contain the largest number,
Box 1 will always contain the smallest number,
However, this flow-chart is INCORRECT. As it stands, it will not accomplish the desired purpose.
Which one instruction must be changed to correct the flow-chart?
Answer: Instruction 5 Box 3 Box 2
Explanation:The two conditions in the flowchart are :
Instruction 1 : IS (1) < (2) ? YES --(1)
Instruction 5 : IS (3) < (2) ? NO --(2)
ANSWER
The error is in Instruction 5, because BOX 3 will always contain the largest number and so the output to Instruction 5 will always be NO and the loop will end only on a YES.
Workspace
ThoughtWorks Accenture
22. Study the flow chart shown below to answer the following questions.
For an individual who works for a government organization and owns a house, it is given that he is 35 years old and earns Rs. 15,000 per month. What would be the approved_amt (in Rs.) for him?
Answer: 1875000
Explanation:approved_amt = sal * 5 * (60 - age) = 15,000 * 5 * (60 - 35) = 18,75,000 Rs.
Workspace
ThoughtWorks
23. Study the flow chart shown below to answer the following questions.
A person wishes to apply for a loan worth Rs. 20, 00,000. Person does not own a house and also does not work for a government
organization. Will he get this loan approved if he draws a salary of Rs. 50,000 and his current age is 26 years?
Answer: No, he would not get this amount.
Explanation:approved_amt = sal * (60 - age)
= 50,000 * (60 - 26)
= 17,00,000 Rs.
So, the loan will not be approved for the person mentioned in the question.
Workspace
ThoughtWorks
24. Study the flow chart shown below to answer the following questions.
A person wishes to avail a loan of Rs. 50, 00,000. He works for a government organization and does not own a house. Would he get the loan if he draws a salary of Rs. 60,000 and his age is 28 years. If he does get a loan, what amount would he be entitled? If not, by what amount he would be short of the required amount?
Answer: Yes, he would get a loan equal to Rs. 57, 60,000.
Explanation:approved_amt = sal * 3 * (60 - age)
approved_amt = 60,000 * 3 * (60 - 28)
approved amt = 57,60,000 Rs. So, yes, he would get a loan equal to Rs. 57,60,000.
Workspace
ThoughtWorks
25. Study the flow chart shown below to answer the following questions.
In which situation can this flowchart get stuck in an infinite loop?
Answer: When N <= 0
Explanation:From the flowchart it is evident that M will always be a natural number equal to or greater than 1. For
values of N less than or equal to 0 the flowchart will get struck in an infinite loop.
Workspace
ThoughtWorks
26. Study the flow chart shown below to answer the following questions.
Which of the following correctly represents the bug present in this flowchart?
Answer: Not handled for N <= 0
Explanation:The values of N equal to or less than 0 will make the flowchart to get struck in an infinite loop, so this is this bug
in the flowchart for values of N less than equal to 0.
Workspace
ThoughtWorks
27. Study the flow chart shown below to answer the following questions.
Which of the following value will be printed if the value of N = 0?
Answer: None of these
Explanation:For value of N equal to 0, the flowchart gets struck in an infinite loop. Hence answer to this question is option D (none of these)
Workspace
ThoughtWorks
28. Study the flow chart shown below to answer the following questions.
Which among the following operations is not performed as per the process of the flow chart?
Answer: Print all 5 values which were given as input.
Explanation:Here is no explanation for this answer
Workspace
ThoughtWorks
29. Study the flow chart shown below to answer the following questions.
For which sets of values will the above flow chart get into an infinite loop?
Answer: This flowchart will never get into an infinite loop
Explanation:Here is no explanation for this answer
Workspace
ThoughtWorks
30. Study the flow chart shown below to answer the following questions.
At the end of the flowchart execution, what would be the values of I and M?
Answer: I=6, M=5
Explanation:Here is no explanation for this answer
Workspace
ThoughtWorks Sopra Steria