Grade 11 ICT Lesson 1 O/L Exam Practice: Questions and Answers

© 2026 schoolict.net (Ruwan Mangala Suraweera)

Lesson 1 O/L Exam Practice: Questions and Answersපාඩම 1 O/L විභාග පුහුණුව: ප්‍රශ්න සහ පිළිතුරු

G.C.E. O/L Grade 11 ICT · Lesson 1G.C.E. O/L ICT · 11 ශ්‍රේණිය · පාඩම 1

Prints all tabs in the language you are reading. Use “Save as PDF” in the print window to keep a copy.ඔබ කියවන භාෂාවෙන් සියලු tabs මුද්‍රණය වේ. පිටපතක් තියාගන්න print window එකේ “Save as PDF” තෝරන්න.

Paper I MCQPaper I බහුවරණ

These questions are in the style of the O/L ICT exam. Paper I has multiple choice questions. Paper II has structured questions with parts, model answers and marking points. They cover all of Lesson 1 (1.1 to 1.11): problem analysis, algorithms, flowcharts and pseudocode, variables and data types, operators, selection, iteration, nesting, arrays, sub-programs, languages and translators, testing and debugging. Every program answer was really run in Pascal (Free Pascal) and Python. Try them first, then check the answers.මේ ප්‍රශ්න O/L ICT විභාගයේ ආකාරයටයි හදලා තියෙන්නේ. Paper I එකේ බහුවරණ ප්‍රශ්න ඇත. Paper II එකේ කොටස්, ආදර්ශ පිළිතුරු සහ ලකුණු දීමේ කරුණු සහිත ව්‍යුහගත ප්‍රශ්න ඇත. ඒවා පාඩම 1 සම්පූර්ණයෙන්ම (1.1 සිට 1.11) ආවරණය කරයි: ගැටලු විශ්ලේෂණය, ඇල්ගොරිතම, ගැලීම් සටහන් සහ ව්‍යාජ කේත, විචල්‍ය සහ දත්ත වර්ග, කාරක, වරණය, පුනරාවර්තනය, කැදැලි, අරා, උප වැඩසටහන්, භාෂා සහ පරිවර්තක, පරීක්ෂාව සහ දෝෂ නිරාකරණය. සෑම වැඩසටහන් පිළිතුරක්ම Pascal (Free Pascal) සහ Python වලින් සැබවින්ම ධාවනය කර ඇත. මුලින් උත්සාහ කර පසුව පිළිතුරු පරීක්ෂා කරන්න.

Choose one answer for each question. The explanation appears after you answer. Time guide: about 25 minutes.සෑම ප්‍රශ්නයකටම එක් පිළිතුරක් තෝරන්න. පිළිතුරු දුන් පසු පැහැදිලි කිරීම පෙන්වයි. කාල මාර්ගෝපදේශය: විනාඩි 25 පමණ.

Scoreලකුණු: 0 / 25

1In IPO, the price and quantity in a bill program areබිල් වැඩසටහනක IPO අනුව මිල සහ ප්‍රමාණය

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B

Given in.ඇතුළත් කරයි.

2The step-by-step solution to a problem is anගැටලුවකට පියවරෙන් පියවර විසඳුම

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C

Algorithm.ඇල්ගොරිතමය.

3Choosing between two paths using a condition isකොන්දේසියක් මගින් මාර්ග දෙකක් අතර තේරීම

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D

Selection.වරණය.

4The flowchart symbol for a decision is aතීරණයක් සඳහා ගැලීම් සටහන් සංකේතය

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B

Decision.තීරණය.

5Input and output are shown with aආදාන සහ ප්‍රතිදාන පෙන්වන්නේ

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A

I/O.I/O.

6Which is a valid identifier?වලංගු හඳුන්වනයක් කුමක්ද?

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C

Letter first, no space.මුලින් අකුර, හිස්තැන් නැත.

7The best data type for an average such as 71.67 is71.67 වැනි සාමාන්‍යයකට හොඳම දත්ත වර්ගය

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A

Decimals.දශම.

817 mod 5 equals17 mod 5 සමාන වන්නේ

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D

Remainder.ශේෂය.

9The value of 2 + 3 * 4 is2 + 3 * 4 හි අගය

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B

* first.* මුලින්.

10(Mark >= 35) AND (Mark <= 100) for Mark = 120 isMark = 120 සඳහා (Mark >= 35) AND (Mark <= 100)

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C

Second part False.දෙවන කොටස False.

11Using O/L limits, a mark of 66 gets gradeO/L සීමා අනුව ලකුණු 66 ට ශ්‍රේණිය

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D

65–74.65–74.

12In Pascal, before else you must NOT writePascal හි else ට පෙර නොලිය යුත්තේ

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A

No ; before else.else ට පෙර ; නැත.

13Choosing a day name from a number 1–7 is best done with1–7 අංකයකින් දින නම තේරීමට වඩාත් සුදුසු

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C

By value.අගය අනුව.

14A loop that always runs at least once isසැමවිටම අවම වශයෙන් එක් වරක් ධාවනය වන ලූපය

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B

Test at end.අවසානයේ පරීක්ෂාව.

15for i in range(1, 6) runs the bodyfor i in range(1, 6) ඇතුළත ධාවනය වන්නේ

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C

1 to 5.1 සිට 5.

16Entering 0 to stop reading numbers uses 0 as aසංඛ්‍යා කියවීම නවත්වන්නට 0 ඇතුළත් කිරීම 0 භාවිත කරන්නේ

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D

Sentinel.Sentinel.

17The value of 5! calculated by the factorial program isක්‍රමාරෝපිත වැඩසටහන ගණනය කරන 5! අගය

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D

1×2×3×4×5.1×2×3×4×5.

18Outer loop 4 times, inner loop 3 times each: the inner body runsපිටත ලූපය 4 වරක්, ඇතුළු ලූපය සෑම විටම 3 වරක්: ඇතුළත ධාවනය වන්නේ

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B

4 × 3.4 × 3.

19Array elements are stored inඅරා අවයව ගබඩා වන්නේ

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A

Side by side.එක ළඟ.

20In Python, the third element of marks isPython හි marks හි තුන්වන අවයවය

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B

From 0.0 සිට.

21A sub-program that returns a value is aඅගයක් ආපසු දෙන උප වැඩසටහනක්

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A

Function.ශ්‍රිතය.

22Changing a task in only one place shows the sub-program benefitකාර්යයක් එක් තැනක පමණක් වෙනස් කිරීම පෙන්වන උප වැඩසටහන් වාසිය

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A

Maintain.නඩත්තුව.

23A translator that translates the whole program at once is aසම්පූර්ණ වැඩසටහනම එකවර පරිවර්තනය කරන පරිවර්තකය

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C

Compiler.සම්පාදකය.

24A program that runs but gives a wrong answer has aධාවනය වුවත් වැරදි පිළිතුරක් දෙන වැඩසටහනක ඇත්තේ

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D

Logic.තාර්කික.

25A responsible use of an AI coding assistant is toAI කේත සහායකයක් වගකීමෙන් භාවිතය

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A

Responsible.වගකීම්.

Paper II StructuredPaper II ව්‍යුහගත

Answer all parts. Marks for each part are shown in brackets. Try first, then open the model answer.සියලු කොටස්වලට පිළිතුරු දෙන්න. එක් එක් කොටසේ ලකුණු වරහන් තුළ ඇත. මුලින් උත්සාහ කර පසුව ආදර්ශ පිළිතුර විවෘත කරන්න.

1Problem analysis and algorithms. A shop sells items. The cashier enters the price and quantity and the program shows the total.ගැටලු විශ්ලේෂණය සහ ඇල්ගොරිතම. සාප්පුවක් අයිතම විකුණයි. මුදල් අයකැමි මිල සහ ප්‍රමාණය ඇතුළත් කරයි, වැඩසටහන මුළු මුදල පෙන්වයි. (9 marksලකුණු 9)

  1. (i) Identify the input, process and output.ආදානය, සැකසීම සහ ප්‍රතිදානය හඳුනාගන්න. (3 marksලකුණු 3)
  2. (ii) Name the three basic control structures.මූලික පාලන ව්‍යුහ තුන නම් කරන්න. (3 marksලකුණු 3)
  3. (iii) Draw a flowchart for the bill program.බිල් වැඩසටහන සඳහා ගැලීම් සටහනක් අඳින්න. (3 marksලකුණු 3)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න

(i) (3 marksලකුණු 3)
Input – price, quantity (1); process – total = price × quantity (1); output – total (1).ආදානය – මිල, ප්‍රමාණය (1); සැකසීම – total = price × quantity (1); ප්‍රතිදානය – total (1).

(ii) (3 marksලකුණු 3)
Sequence, selection, iteration (1 each).අනුක්‍රමය, වරණය, පුනරාවර්තනය (එකට 1).

(iii) (3 marksලකුණු 3)
Start; input price, qty; total = price × qty; display total; Stop (3).Start; price, qty ආදානය; total = price × qty; total පෙන්වීම; Stop (3).

StartINPUT Price, QuantityTotal = Price * QuantityDISPLAY TotalStop
Flowchart – Shop bill: price × quantityගැලීම් සටහන – කඩ බිල: මිල × ප්‍රමාණය
🎯 Examiner tip: inputs come in, outputs go out – the process is between them.පරීක්ෂක උපදෙස: ආදාන ඇතුළට, ප්‍රතිදාන පිටතට – සැකසීම මැද.

2Flowcharts, pseudocode and trace tables.ගැලීම් සටහන්, ව්‍යාජ කේත සහ අනුරේඛන වගු. (9 marksලකුණු 9)

  1. (i) Write pseudocode to find the sum of 1 to N.1 සිට N දක්වා එකතුව සොයන ව්‍යාජ කේතය ලියන්න. (3 marksලකුණු 3)
  2. (ii) Complete a trace table for N = 5.N = 5 සඳහා අනුරේඛන වගුවක් සම්පූර්ණ කරන්න. (3 marksලකුණු 3)
  3. (iii) Name the symbols used for start, process and decision.ආරම්භය, සැකසීම සහ තීරණය සඳහා සංකේත නම් කරන්න. (3 marksලකුණු 3)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න

(i) (3 marksලකුණු 3)
INPUT N; Sum = 0; FOR i = 1 TO N, Sum = Sum + i; OUTPUT Sum (3).INPUT N; Sum = 0; FOR i = 1 TO N, Sum = Sum + i; OUTPUT Sum (3).

📝 Pseudocodeව්‍යාජ කේතය (Pseudocode)

BEGIN
  INPUT N
  Total = 0
  i = 1
  WHILE i <= N DO
    Total = Total + i
    i = i + 1
  ENDWHILE
  DISPLAY Total
END

(ii) (3 marksලකුණු 3)
Sum: 1, 3, 6, 10, 15; output 15 (3).Sum: 1, 3, 6, 10, 15; ප්‍රතිදානය 15 (3).

StepපියවරiiTotalTotali <= 5 ?i <= 5 ?
startstart1100––
looploop1111Yesඔව්
looploop2233Yesඔව්
looploop3366Yesඔව්
looploop441010Yesඔව්
looploop551515Yesඔව්
checkcheck661515Noනැත

(iii) (3 marksලකුණු 3)
Oval, rectangle, diamond (1 each).ඕවලය, සෘජුකෝණාස්‍රය, දියමන්තිය (එකට 1).

🎯 Examiner tip: in a trace table, write a new row each time a variable changes.පරීක්ෂක උපදෙස: අනුරේඛන වගුවේ විචල්‍යයක් වෙනස් වන සෑම විටම නව පේළියක් ලියන්න.

3Variables, data types and operators.විචල්‍ය, දත්ත වර්ග සහ කාරක. (9 marksලකුණු 9)

  1. (i) Give a suitable data type for (a) number of students (b) price (c) name (d) passed or not.(a) සිසුන් ගණන (b) මිල (c) නම (d) සමත්ද නැද්ද සඳහා සුදුසු දත්ත වර්ගයක් දෙන්න. (4 marksලකුණු 4)
  2. (ii) Find the values of 17 div 5, 17 mod 5 and (2 + 3) * 4.17 div 5, 17 mod 5 සහ (2 + 3) * 4 අගයන් සොයන්න. (3 marksලකුණු 3)
  3. (iii) Give two rules for naming identifiers.හඳුන්වන නම් කිරීමේ රීති දෙකක් දෙන්න. (2 marksලකුණු 2)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න

(i) (4 marksලකුණු 4)
(a) integer (b) real (c) string (d) Boolean (1 each).(a) integer (b) real (c) string (d) Boolean (එකට 1).

(ii) (3 marksලකුණු 3)
3, 2, 20 (1 each).3, 2, 20 (එකට 1).

💻 Arithmetic operatorsඅංක ගණිත කාරක
program Operators;
var
  a, b: integer;
begin
  a := 17;
  b := 5;
  writeln('Sum = ', a + b);
  writeln('Difference = ', a - b);
  writeln('Product = ', a * b);
  writeln('Division = ', a / b:0:2);
  writeln('Quotient = ', a div b);
  writeln('Remainder = ', a mod b);
end.
a = 17
b = 5
print("Sum =", a + b)
print("Difference =", a - b)
print("Product =", a * b)
print(f"Division = {a / b:.2f}")
print("Quotient =", a // b)
print("Remainder =", a % b)

▶ Sample runනියැදි ධාවනය · same output in Pascal and PythonPascal සහ Python දෙකෙහිම එකම ප්‍රතිදානය

Sum = 22
Difference = 12
Product = 85
Division = 3.40
Quotient = 3
Remainder = 2

(iii) (2 marksලකුණු 2)
Start with a letter; no spaces; not a reserved word (any two).අකුරකින් ආරම්භ; හිස්තැන් නැත; වෙන් කළ වචනයක් නොවේ (ඕනෑම දෙකක්).

🎯 Examiner tip: div gives the whole-number part, mod gives the remainder.පරීක්ෂක උපදෙස: div පූර්ණ කොටස, mod ශේෂය දෙයි.

4Selection. Grades: A ≥ 75, B ≥ 65, C ≥ 50, S ≥ 35, otherwise W.වරණය. ශ්‍රේණි: A ≥ 75, B ≥ 65, C ≥ 50, S ≥ 35, නැතහොත් W. (8 marksලකුණු 8)

  1. (i) Write a program (Pascal or Python) that inputs a mark and displays the grade.ලකුණක් ආදානය කර ශ්‍රේණිය පෙන්වන වැඩසටහනක් (Pascal හෝ Python) ලියන්න. (5 marksලකුණු 5)
  2. (ii) What grades are shown for 82, 66 and 47?82, 66 සහ 47 සඳහා පෙන්වන ශ්‍රේණි මොනවාද? (3 marksලකුණු 3)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න

(i) (5 marksලකුණු 5)
Input (1); IF ≥ 75 A (1); ELSE IF ≥ 65 B, ≥ 50 C (2); ≥ 35 S else W (1).ආදානය (1); IF ≥ 75 A (1); ELSE IF ≥ 65 B, ≥ 50 C (2); ≥ 35 S නැතහොත් W (1).

💻 Marks to grade (A, B, C, S, W)ලකුණු ශ්‍රේණියට (A, B, C, S, W)
program MarksToGrade;
var
  marks: integer;
  grade: char;
begin
  write('Enter marks: ');
  readln(marks);
  if marks >= 75 then
    grade := 'A'
  else if marks >= 65 then
    grade := 'B'
  else if marks >= 50 then
    grade := 'C'
  else if marks >= 35 then
    grade := 'S'
  else
    grade := 'W';
  writeln('Grade: ', grade);
end.
marks = int(input("Enter marks: "))
if marks >= 75:
    grade = "A"
elif marks >= 65:
    grade = "B"
elif marks >= 50:
    grade = "C"
elif marks >= 35:
    grade = "S"
else:
    grade = "W"
print("Grade:", grade)

▶ Sample runනියැදි ධාවනය 1 · same output in Pascal and Python (typed input in yellow)Pascal සහ Python දෙකෙහිම එකම ප්‍රතිදානය (ටයිප් කළ ආදානය කහ පාටින්)

Enter marks: 82
Grade: A

▶ Sample runනියැදි ධාවනය 2 · same output in Pascal and Python (typed input in yellow)Pascal සහ Python දෙකෙහිම එකම ප්‍රතිදානය (ටයිප් කළ ආදානය කහ පාටින්)

Enter marks: 58
Grade: C

▶ Sample runනියැදි ධාවනය 3 · same output in Pascal and Python (typed input in yellow)Pascal සහ Python දෙකෙහිම එකම ප්‍රතිදානය (ටයිප් කළ ආදානය කහ පාටින්)

Enter marks: 30
Grade: W

(ii) (3 marksලකුණු 3)
A, B, S (1 each).A, B, S (එකට 1).

🎯 Examiner tip: test the boundary marks 75, 65, 50 and 35.පරීක්ෂක උපදෙස: මායිම් ලකුණු 75, 65, 50 සහ 35 පරීක්ෂා කරන්න.

5Iteration and nesting.පුනරාවර්තනය සහ කැදැලි. (8 marksලකුණු 8)

  1. (i) Write a program that calculates and displays 5! using a loop.ලූපයක් භාවිතයෙන් 5! ගණනය කර පෙන්වන වැඩසටහනක් ලියන්න. (3 marksලකුණු 3)
  2. (ii) Give one difference between WHILE and REPEAT … UNTIL.WHILE සහ REPEAT … UNTIL අතර එක් වෙනසක් දෙන්න. (2 marksලකුණු 2)
  3. (iii) Complete a trace table for the star triangle with 4 rows.පේළි 4 තරු ත්‍රිකෝණය සඳහා අනුරේඛන වගුවක් සම්පූර්ණ කරන්න. (3 marksලකුණු 3)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න

(i) (3 marksලකුණු 3)
Fact = 1 (1); FOR i = 1 TO 5, Fact = Fact × i (1); display 120 (1).Fact = 1 (1); FOR i = 1 TO 5, Fact = Fact × i (1); 120 පෙන්වීම (1).

💻 Factorial with a FOR loopFOR loop මගින් ක්‍රමාරෝපිතය (factorial)
program Factorial;
var
  n, i, f: integer;
begin
  write('Enter N: ');
  readln(n);
  f := 1;
  for i := 1 to n do
    f := f * i;
  writeln('Factorial = ', f);
end.
n = int(input("Enter N: "))
f = 1
for i in range(1, n + 1):
    f = f * i
print("Factorial =", f)

▶ Sample runනියැදි ධාවනය · same output in Pascal and Python (typed input in yellow)Pascal සහ Python දෙකෙහිම එකම ප්‍රතිදානය (ටයිප් කළ ආදානය කහ පාටින්)

Enter N: 5
Factorial = 120
iiF = F * iF = F * i
1111
2222
3366
442424
55120120

(ii) (2 marksලකුණු 2)
WHILE tests at the start and may run zero times; REPEAT tests at the end and runs at least once (2).WHILE ආරම්භයේ පරීක්ෂා කර ශුන්‍ය වරක් විය හැක; REPEAT අවසානයේ පරීක්ෂා කර අවම වශයෙන් එක් වරක් ධාවනය වේ (2).

(iii) (3 marksලකුණු 3)
Rows print *, , *, **** (3).පේළි *, , *, **** මුද්‍රණය කරයි (3).

💻 Iteration inside iteration: star triangleපුනරාවර්තනය තුළ පුනරාවර්තනය: තරු ත්‍රිකෝණය
program Stars;
var
  row, col: integer;
begin
  for row := 1 to 4 do
  begin
    for col := 1 to row do
      write('*');
    writeln;
  end;
end.
for row in range(1, 5):
    for col in range(1, row + 1):
        print("*", end="")
    print()

▶ Sample runනියැදි ධාවනය · same output in Pascal and PythonPascal සහ Python දෙකෙහිම එකම ප්‍රතිදානය

*
**
***
****
RowRowInner loop runs (times)ඇතුළු ලූපය ධාවනය (වාර)Printedමුද්‍රණය වූ දේ
1111**
2222****
3333******
4444********
🎯 Examiner tip: in a nested loop, the inner loop finishes completely before the outer loop moves on.පරීක්ෂක උපදෙස: කැදැලි ලූපයක පිටත ලූපය ඉදිරියට යාමට පෙර ඇතුළු ලූපය සම්පූර්ණයෙන් අවසන් වේ.

6Arrays and sub-programs. Nums = 12, 45, 7, 30, 18.අරා සහ උප වැඩසටහන්. Nums = 12, 45, 7, 30, 18. (9 marksලකුණු 9)

  1. (i) What are Nums[2] (Pascal) and nums[2] (Python)?Nums[2] (Pascal) සහ nums[2] (Python) මොනවාද? (2 marksලකුණු 2)
  2. (ii) Trace a linear search for 30 and give the output.30 සඳහා රේඛීය සෙවීමක් අනුරේඛනය කර ප්‍රතිදානය දෙන්න. (3 marksලකුණු 3)
  3. (iii) Distinguish a function from a procedure and give two benefits of sub-programs.ශ්‍රිතයක් ක්‍රියා පටිපාටියකින් වෙන්කර උප වැඩසටහන්වල වාසි දෙකක් දෙන්න. (4 marksලකුණු 4)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න

(i) (2 marksලකුණු 2)
45 (1); 7 (1).45 (1); 7 (1).

(ii) (3 marksලකුණු 3)
Checks 12, 45, 7, 30 → Found at position 4 (3).12, 45, 7, 30 පරීක්ෂා කරයි → Found at position 4 (3).

💻 Array: search for a numberඅරාව: සංඛ්‍යාවක් සෙවීම
program SearchArray;
var
  nums: array[1..5] of integer;
  i, key, pos: integer;
begin
  nums[1] := 12;
  nums[2] := 45;
  nums[3] := 7;
  nums[4] := 30;
  nums[5] := 18;
  write('Enter number to find: ');
  readln(key);
  pos := 0;
  for i := 1 to 5 do
    if nums[i] = key then
      pos := i;
  if pos > 0 then
    writeln('Found at position ', pos)
  else
    writeln('Not found');
end.
nums = [12, 45, 7, 30, 18]
key = int(input("Enter number to find: "))
pos = 0
for i in range(5):
    if nums[i] == key:
        pos = i + 1      # position counted from 1
if pos > 0:
    print("Found at position", pos)
else:
    print("Not found")

▶ Sample runනියැදි ධාවනය 1 · same output in Pascal and Python (typed input in yellow)Pascal සහ Python දෙකෙහිම එකම ප්‍රතිදානය (ටයිප් කළ ආදානය කහ පාටින්)

Enter number to find: 30
Found at position 4

▶ Sample runනියැදි ධාවනය 2 · same output in Pascal and Python (typed input in yellow)Pascal සහ Python දෙකෙහිම එකම ප්‍රතිදානය (ටයිප් කළ ආදානය කහ පාටින්)

Enter number to find: 50
Not found
iiNums[i]Nums[i]Nums[i] = 30 ?Nums[i] = 30 ?PosPos
111212Noනැත00
224545Noනැත00
3377Noනැත00
443030Yesඔව්44
551818Noනැත44

(iii) (4 marksලකුණු 4)
Function returns a value, procedure does not (2); reusability, readability, maintainability (any two) (2).ශ්‍රිතය අගයක් ආපසු දෙයි, ක්‍රියා පටිපාටිය නොදෙයි (2); නැවත භාවිතය, කියවීමේ පහසුව, නඩත්තුව (ඕනෑම දෙකක්) (2).

🎯 Examiner tip: Pascal arrays here start at 1, Python lists start at 0.පරීක්ෂක උපදෙස: මෙහි Pascal අරා 1 න්, Python list 0 න් ආරම්භ වේ.

7Languages, translators and debugging.භාෂා, පරිවර්තක සහ දෝෂ නිරාකරණය. (7 marksලකුණු 7)

  1. (i) Give two differences between a compiler and an interpreter.සම්පාදකයක් සහ අර්ථවිනයකයක් අතර වෙනස් දෙකක් දෙන්න. (2 marksලකුණු 2)
  2. (ii) The average of 75, 68, 72 is shown as 107.50. Name the error and fix it.75, 68, 72 හි සාමාන්‍යය 107.50 ලෙස පෙන්වයි. දෝෂය නම් කර නිවැරදි කරන්න. (3 marksලකුණු 3)
  3. (iii) Name one Python IDE and give one rule for using AI assistants responsibly.Python IDE එකක් නම් කර AI සහායක වගකීමෙන් භාවිතයට එක් රීතියක් දෙන්න. (2 marksලකුණු 2)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න

(i) (2 marksලකුණු 2)
Whole program vs line by line; executable file vs none; faster vs slower (any two).සම්පූර්ණ වැඩසටහන එදිරිව පේළියෙන් පේළිය; ක්‍රියාත්මක ගොනුව එදිරිව නැත; වේගවත් එදිරිව මන්දගාමී (ඕනෑම දෙකක්).

(ii) (3 marksලකුණු 3)
Logic error (1); total was divided by 2 (1); divide by 3 → 71.67 (1).තාර්කික දෝෂය (1); එකතුව 2 න් බෙදා ඇත (1); 3 න් බෙදන්න → 71.67 (1).

💻 Logic error: dividing by the wrong numberතාර්කික දෝෂය: වැරදි සංඛ්‍යාවෙන් බෙදීම
program AverageBug;
var
  m1, m2, m3, total: integer;
  avg: real;
begin
  write('Enter mark 1: ');
  readln(m1);
  write('Enter mark 2: ');
  readln(m2);
  write('Enter mark 3: ');
  readln(m3);
  total := m1 + m2 + m3;
  avg := total / 2;            { BUG: should be / 3 }
  writeln('Average = ', avg:0:2);
end.
m1 = int(input("Enter mark 1: "))
m2 = int(input("Enter mark 2: "))
m3 = int(input("Enter mark 3: "))
total = m1 + m2 + m3
avg = total / 2               # BUG: should be / 3
print(f"Average = {avg:.2f}")

▶ Sample runනියැදි ධාවනය · same output in Pascal and Python (typed input in yellow)Pascal සහ Python දෙකෙහිම එකම ප්‍රතිදානය (ටයිප් කළ ආදානය කහ පාටින්)

Enter mark 1: 75
Enter mark 2: 68
Enter mark 3: 72
Average = 107.50

(iii) (2 marksලකුණු 2)
IDLE / Thonny / VS Code (1); understand and test code, do not submit it as your own (1).IDLE / Thonny / VS Code (1); කේතය තේරුම් ගෙන පරීක්ෂා කරන්න, ඔබේ ලෙස ඉදිරිපත් නොකරන්න (1).

🎯 Examiner tip: syntax = grammar, runtime = crash, logic = wrong answer.පරීක්ෂක උපදෙස: syntax = ව්‍යාකරණ, runtime = බිඳ වැටීම, logic = වැරදි පිළිතුර.

Exam Tipsවිභාග උපදෙස්

  • IPO: input → process → output.IPO: ආදානය → සැකසීම → ප්‍රතිදානය.
  • Algorithm: clear, ordered, finite steps.ඇල්ගොරිතමය: පැහැදිලි, පිළිවෙළ, සීමිත පියවර.
  • Oval, parallelogram, rectangle, diamond.ඕවලය, සමාන්තරාස්‍රය, සෘජුකෝණාස්‍රය, දියමන්තිය.
  • Trace tables: one row per change.අනුරේඛන වගු: එක් වෙනසකට එක් පේළියක්.
  • Identifiers: letter first, no spaces, no reserved words.හඳුන්වන: මුලින් අකුර, හිස්තැන් නැත, වෙන් කළ වචන නැත.
  • div = whole part; mod = remainder; brackets first.div = පූර්ණ කොටස; mod = ශේෂය; මුලින් වරහන්.
  • No semicolon before else in Pascal.Pascal හි else ට පෙර semicolon නැත.
  • FOR fixed; WHILE test first; REPEAT test last.FOR ස්ථාවර; WHILE මුලින් පරීක්ෂාව; REPEAT අවසානයේ.
  • Inner loop runs fully each outer run.පිටත සෑම ධාවනයකටම ඇතුළු ලූපය සම්පූර්ණයෙන්.
  • Pascal array[1..5]; Python list index 0.Pascal array[1..5]; Python list දර්ශකය 0.
  • Function returns a value; procedure does not.ශ්‍රිතය අගයක් ආපසු දෙයි; ක්‍රියා පටිපාටිය නොදෙයි.
  • Compiler vs interpreter; syntax, runtime, logic errors.සම්පාදකය එදිරිව අර්ථවිනයකය; syntax, runtime, logic දෝෂ.
NEW 20262026 නව 2026 focus in this paper: programming as it is learned today – Python and Pascal side by side, free tools such as IDLE, Thonny, VS Code and online compilers, testing your own code with trace tables, and checking any AI-suggested code before you trust it.2026 අවධානය: අද ක්‍රමලේඛනය ඉගෙනගන්නා ආකාරය – Python සහ Pascal එකට, IDLE, Thonny, VS Code සහ online compilers වැනි නොමිලේ මෙවලම්, අනුරේඛන වගු මගින් ඔබේ කේතය පරීක්ෂාව, සහ AI යෝජනා කළ කේතය විශ්වාස කිරීමට පෙර පරීක්ෂා කිරීම.

Answers & Downloadsපිළිතුරු සහ බාගත කිරීම්

Paper I – answers with explanationsPaper I – පිළිතුරු සහ පැහැදිලි කිරීම්

#AnswerපිළිතුරWhyහේතුව
1BGiven in.ඇතුළත් කරයි.
2CAlgorithm.ඇල්ගොරිතමය.
3DSelection.වරණය.
4BDecision.තීරණය.
5AI/O.I/O.
6CLetter first, no space.මුලින් අකුර, හිස්තැන් නැත.
7ADecimals.දශම.
8DRemainder.ශේෂය.
9B* first.* මුලින්.
10CSecond part False.දෙවන කොටස False.
11D65–74.65–74.
12ANo ; before else.else ට පෙර ; නැත.
13CBy value.අගය අනුව.
14BTest at end.අවසානයේ පරීක්ෂාව.
15C1 to 5.1 සිට 5.
16DSentinel.Sentinel.
17D1×2×3×4×5.1×2×3×4×5.
18B4 × 3.4 × 3.
19ASide by side.එක ළඟ.
20BFrom 0.0 සිට.
21AFunction.ශ්‍රිතය.
22AMaintain.නඩත්තුව.
23CCompiler.සම්පාදකය.
24DLogic.තාර්කික.
25AResponsible.වගකීම්.

Paper II model answers are under each question in the “Paper II Structured” tab (they open automatically when you print).Paper II ආදර්ශ පිළිතුරු “Paper II ව්‍යුහගත” tab එකේ එක් එක් ප්‍රශ්නය යටතේ ඇත (මුද්‍රණය කරන විට ස්වයංක්‍රීයව විවෘත වේ).

Downloadsබාගත කිරීම්

Full Lesson 1 PDFසම්පූර්ණ පාඩම 1 PDF: English · සිංහල

← Back to Lesson 1පාඩම 1 වෙත ආපසු ‹ 1.11 Programming Languages, Translators and Debuggingක්‍රමලේඛන භාෂා, පරිවර්තක සහ දෝෂ නිරාකරණය

© 2026 schoolict.net (Ruwan Mangala Suraweera). All rights reserved.සියලු හිමිකම් ඇවිරිණි.