අන්තර්ගතයට යන්න
mcqdinethlive
SPARK · UNIT 9

Is 2026 MCQ 40 a Python question or an algorithm question

2026 Paper I Q40 asked which Python code matches a REPEAT UNTIL pseudocode. Students who know loops still freeze on it, and two rules and a 30-second check fix that.

සිංහලෙන් කියවන්න

2026 P-I Q40 froze many students. The pseudocode said REPEAT ... UNTIL n < 1, and Python has no REPEAT. Students knew while, but not where to split the loop. That is not a gap in what they know. It is a gap in the picture, and the books never draw it. The Sinhala paper calls pseudocode "ව්‍යාජ කේතය".

The question is older than it looks. Since 2013 P-I Q19, the paper has asked "which Python code matches this algorithm". From 2015 P-I Q31 on, most of those flowcharts put the test at the bottom, after the body. That is a REPEAT UNTIL loop drawn as a picture. 2026 only wrote it in words. Pseudocode is one of the ways to show an algorithm, and students hand trace it before they write code (Syllabus 9.3, page 36) (විෂය නිර්දේශය 9.3, පිටුව 34). The Sinhala syllabus calls them "ව්‍යාජ කේත(pseudo code)" and "හස්තානුරේඛන (hand traces)".

Two rules do the work. First, REPEAT tests at the bottom, so its body runs at least once, while while tests at the top. Second, UNTIL says when to stop and while says when to go on, so flip the condition: UNTIL n < 1 becomes while n >= 1. When in doubt, trace the pseudocode first. It prints 5 3 1. Then cross out every option that prints something else.

Our worked answer is (5), because the 2026 scheme is not out yet. Each wrong option hides one planted mistake: a copied condition, a wrong break test, a swapped order and a counter. The Explained post covers the traps, the full history since 2013 and the book gaps. It also shows six ways this pattern can come next. Read it in REPEAT UNTIL pseudocode to Python loops in 2026 MCQ 40.

මේ Spark එක බෙදාගන්න

A/L ICT කරන යාළුවෙකුට යවන්න.

තවත් Sparks

  1. English

    Layer 2 and Layer 3 switches 101

    A Layer 2 switch forwards frames by MAC address inside one LAN, and a Layer 3 switch also routes packets by IP address between networks. Why both exist, where they work today, and the past paper questions that test them.

  2. English

    Planning an A/L ICT second attempt

    A low 2026 A/L ICT result is a map of gaps, not an end. Six units carry 73.4% of the marks, and every paper for the plan is free on this site.

  3. English

    Sequential search in Python 101

    A sequential search returns inside the loop on a match and gives the not found value only after the loop. 2026 Paper II Q9(c) shows where that line goes.

All Sparks