How does Instruction 2 affect the updates in a flow chart for coding?

I assumed the question was over and the answer was given. I didn't realize that there were more options to choose from.
  • #1
member 428835
Homework Statement
See the attached screenshot.
Relevant Equations
nothing comes to mind
I found this as problem 3/42 from here (copied below for viewing convenience). I'm a little confused about Instruction 2. The way I interpret it, upon the first loop, no evaluation is occurring, but instruction 1 now becomes "increase Box 2 by 2". So now the three instructions are
1) increase the last value mentioned in box 2 by 2
2) change instruction 1: Increase the last box number mentioned in it by 2.
3) Is the last box number mentioned in Instruction 1 equal to (number in box 3)?

But this makes me think box 2 will becomes 2 -> 4 ->6... since it is the ONLY, and therefor last, box mentioned. What am I missing?
flow_chart.png
 
Physics news on Phys.org
  • #2
joshmccraney said:
The way I interpret it, upon the first loop, no evaluation is occurring, but instruction 1 now becomes "increase Box 2 by 2".
I think that the exercise seeks to have you carefully track the operation and result of each instruction.

What number is in box 2 after after instruction 1 is executed?
What is the last number in instruction 1?
Isn't changing that number the only modification that instruction 2 makes to instruction 1?
 
Last edited:
  • #3
sysprog said:
I think that the exercise seeks to have you carefully track the operation and result of each instruction.

What number is in box 2 after after instruction 1 is executed?
What is the last number in instruction 1?
Isn't changing that number the only modification that instruction 2 makes to instruction 1?
I'll answer your questions as you've asked:
1) 0
2) 2
3) I think not. Doesn't instruction 2 literally change instruction 1, so that we only evaluate the subtraction on the first iteration, and after that we just add 2, since the instruction has changed?
 
  • #4
3) I think not. Doesn't instruction 2 literally change instruction 1, so that we only evaluate the subtraction on the first iteration, and after that we just add 2, since the instruction has changed?
In this instance "change" doesn't mean 'exchange' or 'replace'; it means modify ##-## instruction 2 says modify instruction 1 so that the last box number in instruction 1 is increased by 2 ##-## the last box number in instruction 1 is the number of the box at which the result of the subtraction is to be stored.
 
Last edited:
  • Like
Likes pbuk
  • #5
On the first pass through the loop, what is the last box number mentioned in instruction 1? What does instruction 1 say after we increase it by 2?
 
  • Like
Likes sysprog
  • #6
Oh, note that none of the answers A-D is correct. There are hundreds of these "interview questions" sites, all of them I have seen are useless.
 
  • #7
pbuk said:
Oh, note that none of the answers A-D is correct.
The question on the site has answers A-E.

1650277490840.png
 
  • Haha
Likes pbuk
  • #8
sysprog said:
The question on the site has answers A-E.
Oh, sorry for giving the game away!
 
  • Haha
Likes sysprog

1. How does Instruction 2 affect the updates in a flow chart for coding?

Instruction 2 can affect the updates in a flow chart for coding in several ways. It may introduce new steps or conditions, modify existing steps or conditions, or remove certain steps or conditions altogether. It is important to carefully consider the impact of Instruction 2 on the flow chart and make necessary updates to accurately reflect the coding process.

2. Should Instruction 2 be added to the beginning or end of the flow chart for coding?

The placement of Instruction 2 in the flow chart for coding depends on its purpose and how it relates to the other instructions. If it is a prerequisite for the rest of the instructions, it should be added at the beginning. If it is a result of the previous instructions, it should be added at the end. Otherwise, it can be placed in the appropriate location within the flow chart.

3. Can Instruction 2 be skipped or ignored in the coding process?

It depends on the specific instructions and the coding language being used. Some instructions may be essential and cannot be skipped without affecting the final outcome. Others may be optional and can be skipped if they are not relevant to the coding process. It is important to carefully read and understand Instruction 2 before deciding whether to skip or ignore it.

4. What happens if Instruction 2 conflicts with other instructions in the flow chart for coding?

If Instruction 2 conflicts with other instructions in the flow chart for coding, it is important to carefully evaluate the situation and determine which instruction takes precedence. This may require consulting with other team members or seeking clarification from the person who created the flow chart. Resolving conflicts in a timely and effective manner is crucial for ensuring the accuracy and functionality of the code.

5. How often should the flow chart for coding be updated when Instruction 2 is added?

The frequency of updating the flow chart for coding depends on the complexity and frequency of changes to the code. If Instruction 2 significantly alters the coding process, it may be necessary to update the flow chart immediately. Otherwise, it is recommended to review and update the flow chart periodically, such as after completing a certain number of instructions or after a significant milestone in the coding process.

Similar threads

  • Programming and Computer Science
2
Replies
66
Views
15K
  • Special and General Relativity
Replies
11
Views
428
  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
1K
  • Classical Physics
Replies
4
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Programming and Computer Science
Replies
11
Views
814
  • Special and General Relativity
Replies
7
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
844
  • Quantum Interpretations and Foundations
Replies
12
Views
936
Back
Top