Skip to content

Control Structures and Notation Methods

標準~32 min6 terms18 past questions

Goals of this unit

  • Tell the three basic control structures apart by how processing moves: straight through, branching, or looping back
  • Explain the difference between pre-test and post-test loops, and between a continuation condition and a termination condition
  • Read the main flow diagram symbols and basic pseudocode notation, and trace how variable values change
Terms at a glance (6)
TermIn one lineCategoryHow to tell it apart
順次A control structure that runs steps one at a time, top to bottom, in written orderControl structureOne straight path with no branches or returns
選択A control structure that switches the next step based on whether a condition is true or falseControl structureSplits off to a different step for each result of the condition
繰返しA control structure that runs the same block of steps repeatedly while checking a conditionControl structurePasses through the same block many times
流れ図A diagram that shows processing steps with symbols and arrowsNotationLines connect symbols such as terminals and decisions
フローチャートThe English name for the flow diagram (流れ図); both mean the same diagramNotationOnly the name differs; the diagram is the same
擬似言語A notation that writes steps as text in a fixed format, independent of any specific languageNotationUses an assignment arrow and forms such as if and while

Terms

Sequence (順次) is a control structure that runs steps one at a time, top to bottom, in the order they are written.

  1. Store 5 in a
  2. Store 3 in b
  3. Display the sum of a and b

The last step displays the sum, 8, and processing ends. Nothing branches or loops back along the way.

3 / 3

An algorithm (アルゴリズム) is a procedure of processing steps that achieves a goal, and any procedure can be built from three basic control structures (基本制御構造): sequence plus selection and iteration (the structured program theorem). A sequence has no branches and no returns, so processing follows one straight path.

AnalogyIt is like making instant noodles: pour in hot water, wait, then peel back the lid, in exactly the order printed on the cup.

Exam points

  • ExamAn algorithm (アルゴリズム) is the processing procedure itself for achieving a specific goal. Writing it in a different language does not change what the procedure does.
  • ExamSeveral steps placed inside a loop also run in sequence (順次), and each pass runs them again from the top in the same order.

2 past questions on this term 順次

Selection (選択) is a control structure that switches the next step depending on whether a condition (条件) holds (true) or does not hold (false).

  • Score 80 or higher?
    • True: grade A
    • False: score 60 or higher?
      • True: grade B
      • False: grade C

The second condition decides between grade B and C. Nesting selections lets you split processing into three or more cases.

3 / 3

Selection is also called branching (分岐); in a diagram, one line leaves the diamond-shaped decision (判断) symbol for each result, such as true and false (Yes and No). Placing one selection inside another divides processing into three or more paths.

AnalogyIt works like a station ticket gate: a valid ticket opens the gate, and an invalid one keeps it shut.

How to rememberPrograms usually write a selection starting with the word if.

Exam points

  • ExamWhen one selection (選択) is placed inside another (nesting), the inner condition on the side the outer condition leads to splits processing further.
  • ExamWhen decisions (判断) are stacked vertically to sort data into categories, checking the categories with more matching items first reduces the total number of comparisons.

2 past questions on this term 選択

Iteration (繰返し) is a control structure that runs the same block of steps (the body, 本体) again and again while checking a condition; it is also called a loop (ループ).

真

偽

処理の開始

継続条件は真か

処理を実行

繰返しを終了

Depending on where the condition is checked, there is the pre-test loop (前判定), which checks before the steps, and the post-test loop (後判定), which checks after them. A condition can be written as a continuation condition (継続条件), which keeps the loop going while it holds, or as a termination condition (終了条件), which exits once it holds. For a loop with a set number of passes, you specify the variable's initial value (初期値), increment (増分), and final value (終値).

AnalogyIt is like climbing stairs: check whether there is another step above, climb it if there is, and stop when none are left.

How to rememberA loop is literally a ring, and in a diagram drawn with a decision the arrow curves back up like one, so the same range is passed through again.

Exam points

  • ExamTo find the result of a loop (繰返し), write down the variable values pass by pass and stop at the pass where the exit check holds.
  • ExamIn a loop (繰返し) that counts up by 1, the number of passes depends on the counter's initial value (初期値) combined with the boundary of the exit check (less than, or less than or equal to). Shifting either one by 1 shifts the count by one pass.
  • ExamIn a loop (繰返し) that steps a variable from its initial value (初期値) by an increment (増分) up to its final value (終値), the series of values it takes (for example 1, 5, 9 when going from 1 to 9 in steps of 4) feeds the calculation in the body.

3 past questions on this term 繰返し

Selection vs. Iteration

AspectSelectionIteration
Key differenceAfter the condition is checkedRun the step for that result, then move onDepending on the result, run the body and check again, or leave the loop
How many times the same step runsAt most onceZero or more times for a pre-test loop, one or more for a post-test loop

流れ図Flow diagram

Open in glossary 流れ図

A flow diagram (流れ図) shows processing steps as standard symbols joined by arrows (flow lines).

SymbolShapeMeaning
TerminalWide shape with rounded endsStart and end
ProcessRectangleProcessing such as calculation or assignment
DecisionDiamondA fork based on a condition
Loop limitRectangle with clipped corners (paired top and bottom)Start and end of a loop
Flow lineLine or arrowDirection of processing

The main symbols include, for example, the terminal (端子) for start and end, the process (処理) for calculations, the decision (判断) that splits the path by a condition, and the loop limit (ループ端) placed above and below the repeated range. The basic reading direction is top to bottom and left to right, and arrows mark any other direction. The three basic control structures appear as symbols linked vertically, as a split at a decision, and as a range enclosed by loop limits (or an arrow from a decision back upward).

AnalogyIt is like a route map that marks forks and detours with fixed symbols and uses arrows to show which way to go.

Exam points

  • ExamA loop limit (ループ端) holds either the condition of the loop (繰返し) or the variable's initial value (初期値), increment (増分), and final value (終値). When the condition is written as a termination condition (終了条件), it is checked at the loop limit, and the loop exits once it holds.
  • ExamTo get the result of a flow diagram (流れ図), follow each data item along the lines through the branches at each decision (判断). Data that goes down one branch never passes the decisions on another branch.

2 past questions on this term 流れ図

フローチャートFlowchart

Open in glossary フローチャート

A flowchart (フローチャート) is the English name for the flow diagram (流れ図), and both refer to the same diagram.

Only the name differs: the symbols and the way you read them are the same as for a flow diagram. It is used not only for program steps but also for mapping out how work proceeds.

How to rememberTranslate flow and chart word for word into Japanese and you get 流れ図.

Exam points

  • ExamA flowchart (フローチャート) uses symbols to draw the order and branching of processing, such as a program's, so that you can trace it.
  • Mix-upA data flow diagram (データフローダイアグラム, DFD) shows where data comes from, which processes it passes through, and where it is stored. A flowchart (フローチャート) shows the order in which processing is carried out.

1 past questions on this term フローチャート

擬似言語Pseudocode

Open in glossary 擬似言語

Pseudocode (擬似言語) is a notation that describes an algorithm in a fixed, near-prose format, free from the grammar of any particular programming language.

NotationMeaning
variable ← expressionAssign the value of the expression to the variable
if (condition) … else … endifSelection
while (condition) … endwhileRepeat while the condition holds (pre-test)
for (how the variable changes) … endforRepeat while changing a variable
○ type: name(arguments)Function declaration (the type is that of the return value)
○ name(arguments)Declaration of a procedure with no return value
return valueFinish and hand back the return value

In the format used in past exam questions from fiscal 2022 onward, assignment is written with ←, which puts the value of the expression on the right into the variable on the left. Selection is enclosed by if … endif, iteration by while … endwhile or for … endfor, and indentation marks the range of the body. In a function that groups processing together, the values it receives are called arguments (引数) and the value it returns is called the return value (戻り値).

AnalogyIt is like a recipe note written only with fixed symbols and phrases so that it works in any restaurant's kitchen.

How to remember擬似 means imitating the real thing: it is a way of writing that imitates a real programming language.

Exam points

  • Exam“a ← a × 2” is not an equation but an assignment (代入) that replaces a with twice its current value.
  • ExamThe condition of while is a continuation condition (継続条件): the body runs only while it holds, and once it no longer holds, processing moves past endwhile.
  • ExamWhen an if sits inside a for, the condition is checked on every pass: if it is true the if side runs, and if it is false the else side runs. Without an else, nothing between if and endif runs on a pass where the condition is false.

3 past questions on this term 擬似言語

Flow diagram vs. Pseudocode

AspectFlow diagramPseudocode
Key differenceFormDrawn with symbols and arrowsWritten as text in a fixed format
How the loop range is shownEnclosed by loop limits, or an arrow back to the checkEnclosed by while or for and its matching end word, with indentation

Key points

  • Any algorithm can be written by combining the three basic control structures: sequence, selection, and iteration.
  • 流れ図 (flow diagram) and フローチャート (flowchart) are two names for the same diagram, which draws a procedure with symbols such as terminals, decisions, and loop limits.
  • In pseudocode, ← means assignment: the value of the expression on the right replaces the variable on the left.
  • In a loop with a set number of passes, the variable's initial value, increment, and final value determine how many passes run and which values the variable takes.

Check questions

5 past questions from this unit

Start the check questions

All past questions in this topic