CSS Computer Science (Optional) — Paper-I, Section-A, Topic II subtopic. The three ways instructions can flow through a program.

Flowchart Shape & Pseudocode for Each Structure

Structure Flowchart Shape(s) Pseudocode Form
Sequence Rectangles connected top-to-bottom by plain arrows, no branching step1
step2
step3
Selection (if-else) Diamond (the test), with two outgoing arrows labelled Yes/No leading to separate rectangles IF cond THEN ... ELSE ... ENDIF
Iteration (loop) Diamond (the test) with a rectangle for the body, and an arrow looping back from the body to the diamond WHILE cond DO ... ENDWHILE

If-else flowchart (textual): Decision: cond? (diamond) → YesStatement A (rectangle) → join | NoStatement B (rectangle) → join

While-loop flowchart (textual): Decision: cond? (diamond) → YesLoop body (rectangle) → arrow back up to the Decision | Noexit the loop, continue after it

Do-while flowchart (textual): Loop body (rectangle) runs first → Decision: cond? (diamond) → Yesarrow back up to the body | Noexit — note the body sits before the diamond, which is exactly why it always runs at least once.

Sequential Structure

Selection (Branching) Structures

switch (grade) {
    case 'A': printf("Excellent"); break;
    case 'B': printf("Good"); break;
    default: printf("Needs improvement");
}

Iteration (Looping) Structures

Loop Condition Check Minimum Executions Typical Use
for Before each iteration 0 Known/fixed number of iterations
while Before each iteration (pre-test) 0 Unknown iteration count, condition-driven
do-while After each iteration (post-test) 1 Body must run at least once (e.g. menus)
for (int i = 0; i < 5; i++) { ... }   // init; condition; update

while (n > 0) { ... }                  // checks BEFORE running body

do { ... } while (n > 0);              // checks AFTER running body — runs at least once

Jump Statements