ITPEC FE Subject B April 2026 Question 6

Source exam: ITPEC FE Subject B April 2026Topic: Basic Theory & Math

ITPEC FE Subject B April 2026 — Question 6 of 20

A is b and B is sqrt(-val).

The program works with the normalised form x² − 2bx + c = 0, where val holds b × b − c:

  • Blank A — Case 1 applies when val is 0, and the stated double root is simply b
  • Blank B — Case 3 applies when val is negative, and the roots are b ± i√(c − b²). Since val is b² − c, the quantity c − b² equals -val, which is positive here, so sqrt(-val) is the value tmp must hold

Answer (d)

Why not others:
- (a) and (b) — use -b for the double root; the minus sign was already absorbed when b was defined as -b1 ÷ (2 × a1), so negating again flips the root

- (a) and (c) — pass val to sqrt in the imaginary branch, but val is negative there and sqrt is only defined for non-negative arguments; putting a minus outside the call does not fix the argument inside it

Key rule: Track which quantity is negative. In the imaginary case the negation belongs inside the square root, turning b² − c back into c − b².

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.