Grade 13 A/L ICT Lesson 9 Exam Practice: Questions and Answers

© 2026 schoolict.net (Ruwan Mangala Suraweera)

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

Grade 13 A/L ICT · Lesson 913 ශ්‍රේණිය A/L ICT · පාඩම 9

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 බහුවරණ

This practice paper assesses Lesson 9: Programming (syllabus competency 9). Paper I has 30 five-option MCQs. Paper II Part A has four structured questions; Part B has three essays. Marking points are shown in brackets. Every Python answer was checked by running it.මෙම පුහුණු පත්‍රය පාඩම 9: ක්‍රමලේඛනය (නිපුණතාව 9) ඇගයීමටය. Paper I හි MCQ 30; Paper II ව්‍යුහගත හතරක් සහ රචනා තුනක්. සෑම Python පිළිතුරක්ම ධාවනය කර පරීක්ෂා කර ඇත.

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

Scoreලකුණු: 0 / 30

1Breaking a problem into smaller sub-problems isකුඩා කොටස්

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

Top-down.Top-down.

2A diagram showing modules and their sub-modules is amodules

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

Structure chart.ව්‍යුහ සටහන.

3In a flowchart a decision is drawn as aතීරණය

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

Diamond.දියමන්තිය.

4Input and output in a flowchart use aආදානය

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

Parallelogram.සමාන්තරාස්‍රය.

5The largest of [12, 45, 7, 30] found by the trace isවිශාලතම

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

Compare each.සසඳන්න.

6Machine code is aMachine code

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

1GL.1GL.

7Prolog is mainly aProlog

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

Logic.තාර්කික.

8A translator that converts the whole program before running is aසම්පූර්ණ

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

Compiler.Compiler.

9A translator that runs a program line by line is anපේළියෙන්

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

Interpreter.Interpreter.

10Joining object code with library code is done by alibrary

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

Linker.Linker.

11A program that runs but gives a wrong answer has aවැරදි පිළිතුර

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

Logic.තාර්කික.

12Pausing a program at a chosen line in an IDE uses aනවත්වන

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

Breakpoint.Breakpoint.

137 // 2 in Python gives7 // 2

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

Floor division.පූර්ණ බෙදීම.

142 3 2 in Python gives2 3 2

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

Right to left.දකුණේ සිට.

155 · 3 (bitwise XOR) gives5 · 3

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

101 XOR 011.101 XOR 011.

16The data type of 3.6 is3.6

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

Float.Float.

17if / elif / else is an example ofif

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

Selection.වරණය.

18The digit-sum loop prints for 472472

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

4 + 7 + 2.4 + 7 + 2.

19range(1, 4) producesrange

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

Stop excluded.4 නැත.

20total_price(3) with price=100 by default returnstotal_price

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

3 × 100.3 × 100.

21A variable that exists only while its function runs islocal

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

Local.Local.

22For s = “Sri Lanka”, s[4:9] isslice

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

Index 4–8.4–8.

23Which structure cannot be changed after creation?tuple

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

Tuple.Tuple.

24Key → value pairs are stored in akey

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

Dictionary.ශබ්දකෝෂය.

25Which file mode adds data to the end?අගට

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

Append.Append.

26The files program prints TotalTotal

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

78 + 45 + 88.78 + 45 + 88.

27Changes made through sqlite3 are saved byසුරැකීම

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

Commit.Commit.

28Sequential search for 23 in [34, 7, 23, 32, 5, 62] needs23

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

34, 7, 23.34, 7, 23.

29After pass 1 of bubble sort, [5, 1, 4, 2, 8] becomespass 1

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

5 moves right.5 දකුණට.

30Total swaps when bubble sorting [5, 1, 4, 2, 8] areහුවමාරු

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

3 + 1.3 + 1.

Paper II Part APaper II A කොටස

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

1Problem solving and algorithmsගැටලු විසඳීම සහ ඇල්ගොරිතම (8 marksලකුණු 8)

  1. (i) State the steps of problem solving.පියවර. (2 marksලකුණු 2)
  2. (ii) Draw a flowchart that finds the largest of a list of numbers.ගැලීම් සටහන. (3 marksලකුණු 3)
  3. (iii) Trace the algorithm for [12, 45, 7, 30] and give the output.අනුරේඛනය. (3 marksලකුණු 3)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න

(i) (2 marksලකුණු 2)
Understand, plan (1); implement, test and evaluate (1).(2).

(ii) (3 marksලකුණු 3)
Initialise largest (1); loop with decision n > largest (1); output (1).(3).

(iii) (3 marksලකුණු 3)
Rows for each n (2); output 45 (1).(3).

🎯 Examiner tip: draw every column of the trace table.trace table හි සෑම තීරුවක්ම අඳින්න.

2Languages and translatorsභාෂා සහ පරිවර්තක (8 marksලකුණු 8)

  1. (i) Compare compilers and interpreters (three points).compiler සහ interpreter. (3 marksලකුණු 3)
  2. (ii) Explain the role of a linker.linker. (2 marksලකුණු 2)
  3. (iii) Name three programming paradigms with an example language each.paradigms. (3 marksලකුණු 3)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න

(i) (3 marksලකුණු 3)
Whole program vs line (1); speed (1); error reporting (1).(3).

Program translatorsSource programCompilerObject programLinker →executableSource programInterpreterRuns lineby lineHybrid (Python, Java): compile to bytecode, then a virtual machine interprets it.
Translators.පරිවර්තක.

(ii) (2 marksලකුණු 2)
Joins object code (1); with libraries into an executable (1).(2).

(iii) (3 marksලකුණු 3)
Procedural C (1); object-oriented Java/Python (1); logic Prolog or functional Haskell (1).(3).

🎯 Examiner tip: give an example language for each paradigm.උදාහරණ භාෂාවක් දෙන්න.

3Python basics and controlPython මූලික සහ පාලනය (8 marksලකුණු 8)

  1. (i) Evaluate 7 // 2, 7 % 2 and 2 3 2.ගණනය කරන්න. (3 marksලකුණු 3)
  2. (ii) Write a while loop that prints the digit sum of 472.while ලූපය. (3 marksලකුණු 3)
  3. (iii) Distinguish iteration and looping.iteration සහ looping. (2 marksලකුණු 2)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න

(i) (3 marksලකුණු 3)
3 (1); 1 (1); 512 (1).(3).

Python operator precedence (high → low)( ) brackets** power (right to left)* / // %+ −< <= > >= == !=notandor3 + 4 * 2 = 11(3 + 4) * 2 = 142 ** 3 ** 2 = 51210 − 4 − 3 = 3
Precedence.ප්‍රමුඛතාව.

(ii) (3 marksලකුණු 3)
while n > 0 (1); add n % 10 and n //= 10 (1); prints 13 (1).(3).

(iii) (2 marksලකුණු 2)
Count-controlled for (1); condition-controlled while (1).(2).

🎯 Examiner tip: indent every block correctly.නිවැරදිව indent කරන්න.

4Functions and data structuresශ්‍රිත සහ දත්ත ව්‍යුහ (8 marksලකුණු 8)

  1. (i) Write a function with a default parameter and show two calls.පෙරනිමි පරාමිතිය. (3 marksලකුණු 3)
  2. (ii) Compare local and global variables.local සහ global. (2 marksලකුණු 2)
  3. (iii) Write code that counts words using a dictionary.වචන ගණන. (3 marksලකුණු 3)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න

(i) (3 marksලකුණු 3)
def with price=100 (1); return (1); 300 and 750 (1).(3).

Anatomy of a function and variable scopedef total_price(qty, price=100): return qty * pricename · parameters · default value · return valueGlobal: countLocal: count (inside)A local variable lives only whileits function runs.Call: total_price(3) → 300 total_price(3, 250) → 750
Function parts.ශ්‍රිත කොටස්.

(ii) (2 marksලකුණු 2)
Where created / scope (1); lifetime (1).(2).

(iii) (3 marksලකුණු 3)
split (1); freq.get(w, 0) + 1 (1); red 3, blue 1, green 1 (1).(3).

🎯 Examiner tip: show the output you expect.අපේක්ෂිත ප්‍රතිදානය පෙන්වන්න.

Paper II Part BPaper II B කොටස

Part B: essay questions. Write full answers in paragraphs. Marks for each part are shown in brackets.B කොටස: රචනා ප්‍රශ්න. ඡේද ලෙස සම්පූර්ණ පිළිතුරු ලියන්න. එක් එක් කොටසේ ලකුණු වරහන් තුළ ඇත.

1Developing a marks programලකුණු වැඩසටහනක් සංවර්ධනය (10 marksලකුණු 10)

  1. (i) Use top-down design to break a marks program into modules and draw a structure chart.structure chart. (3 marksලකුණු 3)
  2. (ii) Write Python to read five marks into a list and print the average.සාමාන්‍යය. (4 marksලකුණු 4)
  3. (iii) Explain syntax, runtime and logic errors and how an IDE helps find them.දෝෂ. (3 marksලකුණු 3)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න

(i) (3 marksලකුණු 3)
Modules input, process, output (2); chart (1).(3).

Structure chart (top-down design)Produce reportGet marksCalculateaverageFind gradePrint reportmarks ↓↑ gradeEach box is a module; lines show which module calls which; arrows on lines show data passed.
Structure chart.ව්‍යුහ සටහන.

(ii) (4 marksලකුණු 4)
Loop input (1); int and append (1); sum / len (1); print (1).(4).

(iii) (3 marksලකුණු 3)
Three errors defined (2); breakpoint / step / watch (1).(3).

🎯 Examiner tip: test with known values.දන්නා අගයන්ගෙන් පරීක්ෂා කරන්න.

2Files and databasesගොනු සහ දත්ත සමුදා (10 marksලකුණු 10)

  1. (i) Explain the r, w and a file modes.modes. (3 marksලකුණු 3)
  2. (ii) Write a program that appends a mark to marks.txt and then prints the total of all marks.ගොනු වැඩසටහන. (4 marksලකුණු 4)
  3. (iii) Describe the steps to add, modify, delete and retrieve records with sqlite3.sqlite3. (3 marksලකුණු 3)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න

(i) (3 marksලකුණු 3)
r (1); w (1); a (1).(3).

File modesopen(f, “w”)write – new/emptyopen(f, “a”)append – add to endopen(f, “r”)read linesclose()save and freeOpening in “w” mode erases an existing file – use “a” to keep old data.
File modes.ගොනු modes.

(ii) (4 marksලකුණු 4)
open a, write, close (1); open r (1); split and int (1); total 211 style output (1).(4).

(iii) (3 marksලකුණු 3)
connect and cursor (1); INSERT/UPDATE/DELETE with commit (1); SELECT and close (1).(3).

Python program and a databasePythonprogramsqlite3connect()cursorexecute(SQL)DatabasetablesINSERT, UPDATE, DELETE need commit(); SELECT rows come back as tuples.
Python and a database.Python සහ දත්ත සමුදාය.
🎯 Examiner tip: always close files and connections.ගොනු සහ සම්බන්ධතා වසන්න.

3Searching and sortingසෙවීම සහ වර්ග කිරීම (11 marksලකුණු 11)

  1. (i) Write a sequential search function and explain why it returns -1.සෙවීම. (3 marksලකුණු 3)
  2. (ii) Find 23 and 99 in [34, 7, 23, 32, 5, 62] and count the comparisons.23 සහ 99. (2 marksලකුණු 2)
  3. (iii) Write bubble sort with a swapped flag and show every pass for [5, 1, 4, 2, 8].bubble sort. (6 marksලකුණු 6)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න

(i) (3 marksලකුණු 3)
for loop (1); return index (1); -1 when not found (1).(3).

(ii) (2 marksලකුණු 2)
23: index 2, 3 comparisons (1); 99: -1, 6 comparisons (1).(2).

(iii) (6 marksලකුණු 6)
Nested loops (2); swap (1); flag stop (1); passes [1, 4, 2, 5, 8], [1, 2, 4, 5, 8], [1, 2, 4, 5, 8] (2).(6).

Bubble sort: largest value bubbles to the end each passStart51428Pass 114258Pass 212458Pass 312458Pass 3 makes no swap, so the algorithm stops early.
Bubble sort.Bubble sort.
🎯 Examiner tip: show the list after every pass.සෑම pass එකකටම පසු ලැයිස්තුව පෙන්වන්න.

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

  • Steps: understand, plan, implement, test.පියවර: තේරුම්, සැලසුම්, ක්‍රියාත්මක, පරීක්ෂා.
  • Know every flowchart symbol.සෑම සංකේතයක්ම දැනගන්න.
  • Draw a full trace table column for each variable.සෑම විචල්‍යයකටම තීරුවක්.
  • Compiler = whole program; interpreter = line by line.Compiler සහ interpreter.
  • Syntax, runtime and logic errors are different.දෝෂ වර්ග තුන.
  • // floor division, % remainder, ** right to left.//, %, **.
  • for = iteration; while = looping.for සහ while.
  • Parameters receive arguments; return sends back.පරාමිති සහ return.
  • Lists change; tuples and strings do not.ලැයිස්තු වෙනස් වේ.
  • w erases, a appends, r reads.w, a, r.
  • commit() saves database changes.commit() සුරකියි.
  • Beyond boxes (AI assistants, type hints) are interest only.Beyond කොටු විභාගයට අවශ්‍ය නැත.
NEW 20262026 නව A/L exam technique: in Paper I, read all five options before choosing and watch for words like NOT and TRUE. In Paper II, look at the marks – one mark usually means one clear point. Show every step in calculations, and in essays write one paragraph for each point with a real Sri Lankan example.A/L විභාග ක්‍රමය: Paper I හි තේරීමට පෙර විකල්ප පහම කියවා NOT සහ TRUE වැනි වචන ගැන සැලකිලිමත් වන්න. Paper II හි ලකුණු බලන්න – සාමාන්‍යයෙන් ලකුණක් යනු පැහැදිලි කරුණකි. ගණනය කිරීම්වල සෑම පියවරක්ම පෙන්වා, රචනාවලදී සැබෑ ශ්‍රී ලාංකීය උදාහරණයක් සමඟ එක් එක් කරුණට එක් ඡේදයක් ලියන්න.

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

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

#AnswerපිළිතුරWhyහේතුව
1BTop-down.Top-down.
2CStructure chart.ව්‍යුහ සටහන.
3DDiamond.දියමන්තිය.
4BParallelogram.සමාන්තරාස්‍රය.
5ECompare each.සසඳන්න.
6B1GL.1GL.
7DLogic.තාර්කික.
8ECompiler.Compiler.
9BInterpreter.Interpreter.
10DLinker.Linker.
11CLogic.තාර්කික.
12EBreakpoint.Breakpoint.
13DFloor division.පූර්ණ බෙදීම.
14ARight to left.දකුණේ සිට.
15C101 XOR 011.101 XOR 011.
16EFloat.Float.
17ASelection.වරණය.
18E4 + 7 + 2.4 + 7 + 2.
19AStop excluded.4 නැත.
20A3 × 100.3 × 100.
21BLocal.Local.
22DIndex 4–8.4–8.
23ETuple.Tuple.
24ADictionary.ශබ්දකෝෂය.
25BAppend.Append.
26C78 + 45 + 88.78 + 45 + 88.
27ACommit.Commit.
28D34, 7, 23.34, 7, 23.
29C5 moves right.5 දකුණට.
30C3 + 1.3 + 1.

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

Downloadsබාගත කිරීම්

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

← Back to Lesson 9පාඩම 9 වෙත ආපසු ‹ 9.13 Searching and Sorting: Sequential Search and Bubble Sortසෙවීම සහ වර්ග කිරීම: අනුක්‍රමික සෙවීම සහ Bubble Sort

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

Resource Book Lesson Note Download Questions Syllabus Sinhala LMS Simulator Tool