ITPEC FE Subject B October 2024 Question 6

Source exam: ITPEC FE Subject B October 2024Topic: Math & Numbers

ITPEC FE Subject B October 2024 — Question 6 of 20

Quadratic equation: mapping the discriminant formula and branching logic to pseudocode.

The discriminant of ax² + bx + c = 0 is b² - 4ac.

Blank A — must compute b² - 4ac. Since means b × b (not b × 2), the correct expression is b × b - 4 × a × c. This eliminates options (a)–(d), which all use b × 2.

Blank B — the if branch computes two roots using sqrt(discriminant), which is only valid when discriminant > 0.

Blank C — the elseif branch computes a single repeated root −b / 2a, which applies when discriminant = 0.

Matching: A = b × b - 4 × a × c, B = discriminant > 0, C = discriminant = 0(h).

Why not others:
- (a)–(d) — Use b × 2 instead of b × b; this computes 2b - 4ac, not the discriminant b² - 4ac

- (e) — B = discriminant < 0 would attempt sqrt of a negative number; C = discriminant = 0 is correct but B is wrong

- (f) — B = discriminant = 0 and C = discriminant < 0 reverses the logic; the two-root branch needs > 0, not = 0

- (g) — B = discriminant = 0 puts the single-root case in the two-root branch, which is incorrect

Key rule: in code is b × b, not b × 2 — a common exam trap. The two-root case requires discriminant > 0; the single-root case requires discriminant = 0.

AI-generated — may contain errors

The original exam layout is preserved in the image so diagrams, formulas, tables, and code remain accurate.

This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.