Algorithms & Flow Control MCQs for NSCT

By the NSCT Exam Editorial Team · Updated 2026-11-24 · Facts checked against official sources on 2026-11-24

Algorithms & Flow Control is about reading and writing step-by-step solutions: pseudocode, flowcharts, and the three control structures (sequence, selection and loops) that decide which step runs next. It is the fourth topic in Problem Solving and Analytical Skills, the area that carries 20% of the NSCT according to HEC's Areas of Competencies. In 2026 candidates averaged 49.1% in this area, per the HEC NSCT report and APP.

An algorithm is a finite, unambiguous sequence of steps that turns inputs into outputs. Knuth lists five properties: finiteness, definiteness, input, output and effectiveness. Questions on this topic mostly ask you to trace a short algorithm by hand, so the skill is careful, line-by-line reading.

Pseudocode

Pseudocode is an informal, language-independent description of an algorithm. It uses keywords such as IF, WHILE and OUTPUT but has no fixed syntax and is never compiled. Most exam pseudocode uses ← for assignment, MOD for remainder and DIV for integer division.

total ← 0
FOR i ← 1 TO 10
    IF i MOD 2 = 0 THEN
        total ← total + i
    END IF
END FOR
OUTPUT total        // 2 + 4 + 6 + 8 + 10 = 30

Exam angle: note whether FOR i ← 1 TO 10 includes 10. In standard pseudocode it does, unlike Python's range(1, 10).

Flowcharts

A flowchart shows the same logic as connected symbols. Learn the five standard shapes:

Symbol Meaning Example
Oval (terminator) Start or end Start, Stop
Parallelogram Input or output Read n, Print sum
Rectangle Process sum ← sum + n
Diamond Decision (one entry, Yes/No exits) Is n > 0?
Small circle On-page connector A → A

A loop in a flowchart is simply a flow line that goes back up to an earlier box. Exam angle: check where the decision sits. If it comes after the process boxes, the loop is post-test and its body always runs at least once.

Sequence

Sequence means statements run one after another, in order, and each assignment overwrites the old value. For a ← 3, b ← a + 2, a ← b * 2, the final values are a = 10 and b = 5. Exam angle: the classic trap is a swap without a temporary variable, where the first assignment destroys a value that the second one needs.

Selection

Selection chooses between paths: IF ... THEN ... ELSE for two ways, and IF ... ELSE IF chains or CASE for many. In an ELSE IF chain only the first true branch runs, so the order of the conditions matters. Test the narrowest condition first: marks >= 85 before marks >= 70 before marks >= 50.

Exam angle: try boundary values (exactly 70, exactly 0). Most selection bugs are a > that should be >=.

Loops

Iteration repeats a block. The three common forms differ in when they test:

Loop Test Minimum runs Best for
FOR i ← 1 TO n Counter, fixed in advance 0 Known number of repeats
WHILE condition DO Before the body (pre-test) 0 Repeat while data says so
REPEAT ... UNTIL condition After the body (post-test) 1 Input that must be read at least once

Note that REPEAT-UNTIL stops when its condition becomes true, while WHILE continues while its condition is true. Exam angle: count iterations exactly. A loop that doubles i from 1 up to n runs about log2(n) times, not n/2. Nested loops multiply, or add up to a triangle number when the inner bound depends on the outer variable.

Common traps in Algorithms & Flow Control questions

Worked examples

1. Understanding. Which flowchart symbol holds the step total ← total + price? Answer: a rectangle. It is a calculation (a process). Inputs and outputs use parallelograms and yes/no tests use diamonds.

2. Application. What are the final values of x and y?

x ← 0
WHILE x < 3 DO
    x ← x + 1
END WHILE
y ← 7
REPEAT
    y ← y + 1
UNTIL y > 3

Answer: x = 3, y = 8. The WHILE loop runs three times and stops when 3 < 3 is false. The REPEAT body runs once before its first test, making y 8, and 8 > 3 ends it.

3. Analysis. This pseudocode should print 1 to 5 but prints 2 to 6. What is the fix?

i ← 1
WHILE i <= 5 DO
    i ← i + 1
    OUTPUT i
END WHILE

Answer: swap the two lines in the body so OUTPUT i comes before i ← i + 1. The increment happens before printing, so the first value shown is 2, and the last pass (i = 5) prints 6. Changing the bound to i < 5 would print 2 to 5, which is still wrong.

Practise Algorithms & Flow Control MCQs

The quiz below has 100 questions you can filter by tier (understanding, application, analysis) and difficulty, each with a full explanation.

Practise: 100 questions

Interactive quiz loading. The first 10 questions are shown below.

  1. In a standard flowchart, which symbol represents a decision such as "Is x > 0?"

    1. Rectangle
    2. Diamond
    3. Parallelogram
    4. Oval
    Show answer

    Answer: B. Diamond

    A diamond holds a yes/no (true/false) test and has one flow line in and two labelled flow lines out. Rectangles are processes, parallelograms are input/output and ovals mark start or end.

  2. Which flowchart symbol is used for "Read marks" or "Print result"?

    1. Rectangle
    2. Diamond
    3. Parallelogram
    4. Small circle
    Show answer

    Answer: C. Parallelogram

    Input and output steps use the parallelogram. A rectangle is for a process or calculation, a diamond for a decision and a small circle is an on-page connector.

  3. What does the oval (rounded rectangle) symbol mark in a flowchart?

    1. A calculation or assignment
    2. A loop condition
    3. The start or end of the algorithm
    4. A call to a stored file
    Show answer

    Answer: C. The start or end of the algorithm

    The oval is the terminator symbol. Every flowchart begins with a Start terminator and finishes with a Stop or End terminator. Calculations go in rectangles and conditions in diamonds.

  4. Which three control structures are enough to express the flow of any algorithm in structured programming?

    1. Sequence, selection and iteration
    2. Input, process and output
    3. Sequence, recursion and GOTO
    4. Selection, functions and arrays
    Show answer

    Answer: A. Sequence, selection and iteration

    Structured programming builds every algorithm from three structures: sequence (steps in order), selection (IF/CASE) and iteration (loops). Input-process-output describes a system's data flow, not its control flow.

  5. Which property of an algorithm requires it to stop after a finite number of steps for every valid input?

    1. Definiteness
    2. Effectiveness
    3. Generality
    4. Finiteness
    Show answer

    Answer: D. Finiteness

    Finiteness (from Knuth's list of algorithm properties) means the algorithm must always terminate. Definiteness is about each step being unambiguous, and effectiveness is about each step being basic enough to carry out.

  6. Which statement best describes pseudocode?

    1. An informal, language-independent description of an algorithm's steps
    2. A low-level language that a compiler translates directly to machine code
    3. A diagram built from standard shapes joined by arrows
    4. A programming language that runs on a virtual machine
    Show answer

    Answer: A. An informal, language-independent description of an algorithm's steps

    Pseudocode mixes plain English with programming-style keywords (IF, WHILE, OUTPUT) to describe an algorithm. It has no fixed syntax and is not compiled or run. The diagram with standard shapes is a flowchart.

  7. You must repeat a step exactly 12 times, and the count is known before the loop starts. Which loop fits best?

    1. A sentinel-controlled WHILE loop
    2. A count-controlled FOR loop
    3. A REPEAT-UNTIL loop that waits for user input
    4. A nested IF-ELSE chain
    Show answer

    Answer: B. A count-controlled FOR loop

    When the number of iterations is known in advance, a count-controlled FOR loop is the natural choice: FOR i ← 1 TO 12. WHILE and REPEAT loops suit conditions that depend on data, such as reading until a sentinel.

  8. An algorithm step says "add a few more items if needed". Which algorithm property does this step break?

    1. Finiteness
    2. Definiteness
    3. Output
    4. Input
    Show answer

    Answer: B. Definiteness

    Definiteness requires every step to be precisely and unambiguously defined. "A few" and "if needed" can be read in different ways, so two people could follow the step differently.

  9. What is the key difference between a pre-test loop (WHILE) and a post-test loop (REPEAT-UNTIL or do-while)?

    1. A post-test loop always runs its body at least once
    2. A pre-test loop always runs its body at least once
    3. Only a post-test loop can run forever
    4. Only a pre-test loop can use a counter variable
    Show answer

    Answer: A. A post-test loop always runs its body at least once

    A WHILE loop tests its condition before the body, so the body may run zero times. A post-test loop runs the body first and tests afterwards, so the body runs at least once. Both kinds can loop forever and both can use counters.

  10. In an input loop, what is a sentinel value?

    1. The first value read, used to set the loop counter
    2. A value that the loop body must never change
    3. The largest value the loop can process
    4. A special value that signals the end of the input
    Show answer

    Answer: D. A special value that signals the end of the input

    A sentinel (for example -1 when all real marks are 0 or more) tells the loop to stop reading. The loop must test for the sentinel before processing it, otherwise the sentinel gets counted as data.

FAQs

Is Algorithms & Flow Control part of the NSCT syllabus?

Yes. It is one of the 16 topics HEC lists under Problem Solving and Analytical Skills in the Areas of Competencies, and that area carries 20% of the test. Expect it to overlap with debugging and code-tracing topics, because all of them ask you to follow logic step by step.

Do I need to know a programming language for these questions?

Not deeply. Most questions use pseudocode or flowcharts, which you can read with basic logic. Knowing one language such as Python or C++ helps, because loops and IF statements work the same way. Watch for differences: pseudocode FOR loops usually include the upper bound, while Python's range() excludes it.

How do I trace a loop quickly without mistakes?

Draw a small trace table with one column per variable and one row per iteration. Update the values in exactly the order the lines appear, and write down the condition result at each test. It feels slow at first, but it stops the off-by-one and order errors that cost most marks here.

What is the difference between a flowchart and pseudocode?

They describe the same algorithm in different forms. A flowchart is visual, using standard shapes joined by arrows, so it shows branching clearly. Pseudocode is text, closer to real code and easier to write for longer algorithms. Exam questions may give either one, or ask you to match a flowchart to its pseudocode.

Next step

Move on to Data Representation & Abstraction MCQs, revisit Logical Reasoning if conditions trip you up, or browse the full Problem Solving MCQs hub. When you are ready, time yourself in a NSCT mock test.