Breaking a Problem into Boxes
OCR J277 asks for structure diagrams. They show a problem split into sub-problems, and which boxes call which other boxes. The top box is the whole system. Lower boxes are modules such as “Get login” or “Show menu”.
You are not drawing every step yet. A structure diagram answers “what are the parts?” so you can later write a subroutine for each box. Lines show that the parent uses the child.
A structure diagram mainly shows
{"answers": {"A": "How a problem splits into linked sub-problems", "B": "The exact binary of a CPU instruction", "C": "A Huffman tree for compression", "D": "The layers of a firewall"}, "question_text": "A structure diagram mainly shows", "correct_answer": "A"}
Structure Diagram versus Flowchart
Structure diagram
Hierarchy of modules. Example: Game → Input move → Update board → Draw board. No diamonds for decisions. Good for planning which subprograms you will write.
Flowchart
Sequence of steps with decisions and loops. Example: Is the move legal? Yes/No. Good for tracing one algorithm, not the whole program’s module map.
A [[structure]] diagram shows modules and links. A [[flowchart]] shows steps and decisions.
{"cloze_text": "A [[structure]] diagram shows modules and links. A [[flowchart]] shows steps and decisions."}
{"keyword": "structure diagram", "definition": "A chart that splits a problem into sub-problems and shows how those parts link"}
Question Type: fill in the blanks
{"paragraph": "Each box in a structure diagram can become a [[subprogram]] in the finished [[code]]."}
{"paragraph": "Each box in a structure diagram can become a [[subprogram]] in the finished [[code]]."}
Question Type: short answer
{"answer": "It shows which subprograms you need and how they fit together.", "rubric": {"0": "Incorrect or no response", "1": "Partial credit", "2": "It shows which subprograms you need and how they fit together."}, "question": "Give one reason to draw a structure diagram before coding."}
{"answer": "It shows which subprograms you need and how they fit together.", "rubric": {"0": "Incorrect or no response", "1": "Partial credit", "2": "It shows which subprograms you need and how they fit together."}, "question": "Give one reason to draw a structure diagram before coding."}
Complete! Ready to test your knowledge?
Structure diagrams
- Breaking a Problem into Boxes
- Structure Diagram versus Flowchart