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

  • Context: Comp Sci 
  • Thread starter Thread starter member 428835
  • Start date Start date
  • Tags Tags
    Charts Code Flow
Click For Summary

Discussion Overview

The discussion revolves around the interpretation of Instruction 2 in a coding flow chart problem, specifically how it affects updates to Box 2 and the overall flow of instructions. Participants are analyzing the implications of modifying instructions within a loop context, focusing on the operational sequence and the resulting values in the boxes.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Homework-related

Main Points Raised

  • Some participants suggest that upon the first loop, no evaluation occurs, and Instruction 1 becomes "increase Box 2 by 2".
  • Others argue that the exercise requires careful tracking of each instruction's operation and result, questioning what number is in Box 2 after executing Instruction 1.
  • One participant posits that Instruction 2 modifies Instruction 1, implying that after the first iteration, only addition occurs without further evaluation of the subtraction.
  • Another participant clarifies that "change" in this context means to modify rather than replace, indicating that the last box number in Instruction 1 is crucial for storing results.
  • Some participants express skepticism about the validity of the provided answer options, suggesting that none are correct.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the interpretation of Instruction 2 and its effects on the flow chart. Multiple competing views remain regarding the operational sequence and the implications of modifying instructions.

Contextual Notes

There are unresolved questions about the specific values in the boxes after each instruction is executed, and the dependence on how the instructions are interpreted may vary among participants.

Who May Find This Useful

Readers interested in coding logic, flow chart analysis, or those preparing for technical interviews may find this discussion relevant.

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
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:
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?
 
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   Reactions: pbuk
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   Reactions: sysprog
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.
 
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   Reactions: pbuk
sysprog said:
The question on the site has answers A-E.
Oh, sorry for giving the game away!
 
  • Haha
Likes   Reactions: sysprog

Similar threads

  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 15 ·
Replies
15
Views
2K
Replies
2
Views
8K
  • · Replies 1 ·
Replies
1
Views
1K
Replies
1
Views
4K
  • · Replies 6 ·
Replies
6
Views
2K