Programming Languages, Translators and Debugging – Grade 11 ICT Notes 1.11

© 2026 schoolict.net (Ruwan Mangala Suraweera)

1.11 Programming Languages, Translators and Debuggingක්‍රමලේඛන භාෂා, පරිවර්තක සහ දෝෂ නිරාකරණය

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” තෝරන්න.
🎬Video coming soon in this language. Switch language to watch the other video.මේ භාෂාවෙන් වීඩියෝව ඉක්මනින් එනවා. අනෙක් වීඩියෝව බලන්න භාෂාව මාරු කරන්න.

In this videoමේ වීඩියෝවේ

  • Low-level: machine and assembly.පහළ මට්ටම: යන්ත්‍ර සහ ඇසෙම්බ්ලි.
  • High-level: Python, Pascal – need translators.ඉහළ මට්ටම: Python, Pascal – පරිවර්තක අවශ්‍යයි.
  • Compiler: whole program; interpreter: line by line.සම්පාදකය: සම්පූර්ණයෙන්; අර්ථවිනයකය: පේළියෙන් පේළිය.
  • Errors: syntax, runtime, logic.දෝෂ: වාක්‍ය රීති, ධාවන කාල, තාර්කික.
  • Use IDEs and AI assistants responsibly.IDE සහ AI සහායක වගකීමෙන් භාවිත කරන්න.
CompilerInterpreterAssemblerSyntax errorLogic errorDebuggingIDE

Notesසටහන්

Syllabus 10.11. A computer only understands 0s and 1s. People prefer words like print and if. In this part we see the different kinds of programming languages, how a translator (interpreter or compiler) changes our code into machine code, and how to test and debug a program.විෂය නිර්දේශය 10.11. පරිගණකයක් තේරුම් ගන්නේ 0 සහ 1 පමණි. මිනිසුන් print, if වැනි වචන කැමතියි. මෙම කොටසේ විවිධ ක්‍රමලේඛන භාෂා වර්ග, පරිවර්තකයක් (අර්ථවිනයක හෝ සම්පාදකයක) අපගේ කේතය යන්ත්‍ර කේතයට හරවන ආකාරය සහ වැඩසටහනක් පරීක්ෂා කර දෝෂ නිරාකරණය කරන ආකාරය බලමු.

1. Low-level and high-level languages1. පහළ මට්ටමේ සහ ඉහළ මට්ටමේ භාෂා

Typeවර්ගයWhat it looks likeපෙනුමNotesසටහන්
Machine languageයන්ත්‍ර භාෂාව10110000 0110000110110000 01100001Only 0s and 1s. The CPU runs it directly. Very hard for people.0 සහ 1 පමණි. CPU එක කෙළින්ම ධාවනය කරයි. මිනිසුන්ට ඉතා අපහසුයි.
Assembly languageඇසෙම්බ්ලි භාෂාවMOV AL, 61hMOV AL, 61hShort words (mnemonics). Needs an assembler. Depends on the CPU.කෙටි වචන (mnemonics). ඇසෙම්බ්ලරයක් අවශ්‍යයි. CPU එක මත රඳා පවතී.
High-level languageඉහළ මට්ටමේ භාෂාවprint(“Hello”)print(“Hello”)English-like, easy to learn, runs on many computers. Needs a compiler or interpreter. E.g. Python, Pascal, Java, C.ඉංග්‍රීසි වැනි, ඉගෙනීමට පහසු, බොහෝ පරිගණකවල ධාවනය වේ. සම්පාදකයක් හෝ අර්ථවිනයකයක් අවශ්‍යයි. උදා Python, Pascal, Java, C.

Machine and assembly languages are called low-level languages because they are close to the hardware.යන්ත්‍ර සහ ඇසෙම්බ්ලි භාෂා දෘඪාංගයට සමීප නිසා පහළ මට්ටමේ භාෂා ලෙස හැඳින්වේ.

2. Kinds of high-level languages2. ඉහළ මට්ටමේ භාෂා වර්ග

1
Proceduralක්‍රියා පටිපාටික
Tell the computer how to do it, step by step. E.g. Pascal, C.එය කරන්නේ කෙසේද යන්න පියවරෙන් පියවර පරිගණකයට කියන්න. උදා Pascal, C.
2
Declarativeප්‍රකාශන
Tell the computer what you want; it finds how. E.g. SQL, Prolog.ඔබට අවශ්‍ය දේ කියන්න; ක්‍රමය එය සොයා ගනී. උදා SQL, Prolog.
3
Structuredව්‍යුහගත
Built only from sequence, selection, iteration and sub-programs (no messy jumps). E.g. Pascal.අනුක්‍රමය, වරණය, පුනරාවර්තනය සහ උප වැඩසටහන් වලින් පමණක් ගොඩනැගේ. උදා Pascal.
4
Object-orientedවස්තු-නැඹුරු
Built from objects that hold data and actions together (e.g. a Student object). E.g. Java, C++, Python.දත්ත සහ ක්‍රියා එකට තබන වස්තු වලින් ගොඩනැගේ (උදා Student වස්තුවක්). උදා Java, C++, Python.

3. Programming and scripting languages3. ක්‍රමලේඛන සහ ස්ක්‍රිප්ටින් භාෂා

Scripting languages are usually interpreted and used to control other software or add actions to web pages – e.g. JavaScript (web pages), PHP (web servers), Python scripts. Programming languages such as C or Pascal are usually compiled into stand-alone programs.ස්ක්‍රිප්ටින් භාෂා සාමාන්‍යයෙන් අර්ථවිනයනය කරන අතර වෙනත් මෘදුකාංග පාලනයට හෝ වෙබ් පිටුවලට ක්‍රියා එක් කිරීමට භාවිත වේ – උදා JavaScript (වෙබ් පිටු), PHP (වෙබ් සේවාදායක), Python ස්ක්‍රිප්ට්. C හෝ Pascal වැනි ක්‍රමලේඛන භාෂා සාමාන්‍යයෙන් ස්වාධීන වැඩසටහන් ලෙස සම්පාදනය කෙරේ.

NEW 20262026 නව 2026 – Python is now one of the most popular programming languages in the world. It is used for AI, data science, websites and school teaching, because its code is short and easy to read.2026 – Python දැන් ලෝකයේ වඩාත්ම ජනප්‍රිය ක්‍රමලේඛන භාෂාවලින් එකකි. කේතය කෙටි සහ කියවීමට පහසු නිසා එය AI, දත්ත විද්‍යාව, වෙබ් අඩවි සහ පාසල් ඉගැන්වීම සඳහා භාවිත වේ.

4. Translators: compiler and interpreter4. පරිවර්තක: සම්පාදකය සහ අර්ථවිනයකය

Compilerසම්පාදකයInterpreterඅර්ථවිනයකය
How it translatesපරිවර්තනය කරන ආකාරයthe whole program at onceසම්පූර්ණ වැඩසටහනම එකවරone line at a time, then runs itවරකට එක් පේළියක්, පසුව ධාවනය
Outputප්‍රතිදානයan executable file (e.g. .exe)ක්‍රියාත්මක ගොනුවක් (උදා .exe)no separate fileවෙනම ගොනුවක් නැත
Errorsදෝෂlisted after compiling the whole programසම්පූර්ණ සම්පාදනයෙන් පසු ලැයිස්තුගත වේstops at the first line with an errorදෝෂයක් ඇති පළමු පේළියේ නතර වේ
Speed when runningධාවන වේගයfasterවේගවත්slowerමන්දගාමී
ExampleඋදාහරණයFree Pascal (FPC), CFree Pascal (FPC), CPythonPython

The code we write is the source code. The translated result is machine code (object code). An assembler translates assembly language.අප ලියන කේතය මූලාශ්‍ර කේතයයි (source code). පරිවර්තිත ප්‍රතිඵලය යන්ත්‍ර කේතයයි (object code). ඇසෙම්බ්ලරයක් ඇසෙම්බ්ලි භාෂාව පරිවර්තනය කරයි.

5. Program errors5. වැඩසටහන් දෝෂ

ErrorදෝෂයMeaningතේරුමExampleඋදාහරණය
Syntax errorවාක්‍ය රීති දෝෂයBreaking the grammar rules of the language. The translator finds it.භාෂාවේ ව්‍යාකරණ රීති කැඩීම. පරිවර්තකය එය සොයා ගනී.prnt(“Hi”) / missing ;prnt(“Hi”) / missing ;
Runtime errorධාවන කාල දෝෂයThe program stops while running.ධාවනය වන අතරතුර වැඩසටහන නතර වේ.dividing by zeroබිංදුවෙන් බෙදීම
Logic errorතාර්කික දෝෂයThe program runs but gives a wrong answer.වැඩසටහන ධාවනය වේ නමුත් වැරදි පිළිතුරක් දෙයි.total / 2 instead of total / 3total / 3 වෙනුවට total / 2

6. Testing and debugging6. පරීක්ෂාව සහ දෝෂ නිරාකරණය

Testing means running the program with chosen data and checking the output against the expected answer. Debugging means finding and fixing the errors (bugs). The program below should find the average of three marks, but it has a logic error.පරීක්ෂාව යනු තෝරාගත් දත්ත සමඟ වැඩසටහන ධාවනය කර ප්‍රතිදානය අපේක්ෂිත පිළිතුර සමඟ සැසඳීමයි. දෝෂ නිරාකරණය (debugging) යනු දෝෂ (bugs) සොයා නිවැරදි කිරීමයි. පහත වැඩසටහන ලකුණු තුනක සාමාන්‍යය සොයා ගත යුතු නමුත් එහි තාර්කික දෝෂයක් ඇත.

💻 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
💡 Expected average of 75, 68 and 72 = 215 ÷ 3 = 71.67, but the program shows 107.50. Fix: divide by 3. Test with normal data (60), boundary data (0, 100, 35) and invalid data (−5, 150).75, 68 සහ 72 හි අපේක්ෂිත සාමාන්‍යය = 215 ÷ 3 = 71.67, නමුත් වැඩසටහන 107.50 පෙන්වයි. නිවැරදි කිරීම: 3 න් බෙදන්න. සාමාන්‍ය (60), මායිම් (0, 100, 35) සහ අවලංගු (−5, 150) දත්ත සමඟ පරීක්ෂා කරන්න.

Ways to debug: read the error message, use a trace table (dry run), print variable values, and use the debugger in an IDE to run step by step.දෝෂ නිරාකරණ ක්‍රම: දෝෂ පණිවිඩය කියවන්න, අනුරේඛන වගුවක් (dry run) භාවිත කරන්න, විචල්‍ය අගයන් මුද්‍රණය කරන්න, සහ IDE එකක debugger එක භාවිතයෙන් පියවරෙන් පියවර ධාවනය කරන්න.

7. IDEs and tools in 20267. 2026 IDE සහ මෙවලම්

An IDE (Integrated Development Environment) gives an editor, translator and debugger in one program.IDE එකක් (ඒකාබද්ධ සංවර්ධන පරිසරය) සංස්කාරකයක්, පරිවර්තකයක් සහ debugger එකක් එක් වැඩසටහනක ලබා දෙයි.

  • IDLE – comes free with Python; simple for beginners.IDLE – Python සමඟ නොමිලේ ලැබේ; ආරම්භකයින්ට සරලයි.
  • Thonny – a beginner Python IDE that shows variables step by step.Thonny – විචල්‍ය පියවරෙන් පියවර පෙන්වන ආරම්භක Python IDE එකකි.
  • VS Code – a popular free editor for Python, Pascal and many languages.VS Code – Python, Pascal සහ බොහෝ භාෂා සඳහා ජනප්‍රිය නොමිලේ සංස්කාරකයකි.
  • Free Pascal / Lazarus – for Pascal; online compilers run code in a web browser.Free Pascal / Lazarus – Pascal සඳහා; ඔන්ලයින් සම්පාදක වෙබ් බ්‍රවුසරයක කේතය ධාවනය කරයි.
  • Scratch – block coding: drag blocks instead of typing; a fun first step before Python.Scratch – බ්ලොක් කේතනය: ටයිප් කිරීම වෙනුවට බ්ලොක් ඇදගෙන යන්න; Python ට පෙර විනෝදජනක පළමු පියවරකි.
NEW 20262026 නව 2026 – AI assistants (such as chatbots inside VS Code) can explain errors and suggest code. Use them responsibly: try the problem yourself first, understand every line before using it, test the code, never submit AI work as your own in exams or assignments, and do not paste personal data into them.2026 – AI සහායක (VS Code තුළ ඇති chatbot වැනි) දෝෂ පැහැදිලි කර කේත යෝජනා කළ හැක. ඒවා වගකීමෙන් භාවිත කරන්න: මුලින් ගැටලුව ඔබම උත්සාහ කරන්න, භාවිත කිරීමට පෙර සෑම පේළියක්ම තේරුම් ගන්න, කේතය පරීක්ෂා කරන්න, විභාග හෝ පැවරුම්වල AI වැඩ ඔබේ ලෙස ඉදිරිපත් නොකරන්න, සහ පුද්ගලික දත්ත ඒවාට ඇතුළත් නොකරන්න.

Key Wordsප්‍රධාන පද

Machine languageයන්ත්‍ර භාෂාව
Instructions in 0s and 1s that the CPU runs directly.CPU එක කෙළින්ම ධාවනය කරන 0 සහ 1 උපදෙස්.
Assembly languageඇසෙම්බ්ලි භාෂාව
A low-level language using short mnemonics like MOV.MOV වැනි කෙටි වචන භාවිත කරන පහළ මට්ටමේ භාෂාව.
High-level languageඉහළ මට්ටමේ භාෂාව
An English-like language such as Python or Pascal.Python හෝ Pascal වැනි ඉංග්‍රීසි වැනි භාෂාව.
Compilerසම්පාදකය
Translates the whole program at once into machine code.සම්පූර්ණ වැඩසටහනම එකවර යන්ත්‍ර කේතයට පරිවර්තනය කරයි.
Interpreterඅර්ථවිනයකය
Translates and runs one line at a time.වරකට එක් පේළියක් පරිවර්තනය කර ධාවනය කරයි.
Assemblerඇසෙම්බ්ලරය
Translates assembly language into machine code.ඇසෙම්බ්ලි භාෂාව යන්ත්‍ර කේතයට පරිවර්තනය කරයි.
Source codeමූලාශ්‍ර කේතය
The program as written by the programmer.ක්‍රමලේඛකයා ලියූ වැඩසටහන.
Syntax errorවාක්‍ය රීති දෝෂය
A mistake in the grammar rules of the language.භාෂාවේ ව්‍යාකරණ රීතිවල වැරැද්දක්.
Logic errorතාර්කික දෝෂය
The program runs but gives a wrong result.වැඩසටහන ධාවනය වුවත් වැරදි ප්‍රතිඵලයක් දෙයි.
Runtime errorධාවන කාල දෝෂය
An error that stops the program while running.ධාවනය වන අතරතුර වැඩසටහන නවත්වන දෝෂයක්.
Debuggingදෝෂ නිරාකරණය
Finding and correcting errors in a program.වැඩසටහනක දෝෂ සොයා නිවැරදි කිරීම.
IDEIDE
A program with an editor, translator and debugger together.සංස්කාරකය, පරිවර්තකය සහ debugger එක එකට ඇති වැඩසටහනක්.

Sample Q&Aආදර්ශ ප්‍රශ්න සහ පිළිතුරු

1Why do high-level programs need a translator?ඉහළ මට්ටමේ වැඩසටහන්වලට පරිවර්තකයක් අවශ්‍ය ඇයි?

Answerපිළිතුර: The CPU understands only machine code (0s and 1s).CPU එක තේරුම් ගන්නේ යන්ත්‍ර කේතය (0 සහ 1) පමණි.

2Give one difference between a compiler and an interpreter.සම්පාදකයක් සහ අර්ථවිනයකයක් අතර එක් වෙනසක් දෙන්න.

Answerපිළිතුර: A compiler translates the whole program at once; an interpreter translates one line at a time.සම්පාදකය සම්පූර්ණ වැඩසටහනම එකවර පරිවර්තනය කරයි; අර්ථවිනයකය වරකට එක් පේළියක්.

3Procedural vs declarative?ක්‍රියා පටිපාටික සහ ප්‍රකාශන?

Answerපිළිතුර: Procedural says how (steps); declarative says what is wanted.ක්‍රියා පටිපාටික කෙසේද (පියවර) කියයි; ප්‍රකාශන අවශ්‍ය දේ කියයි.

4What kind of error is total / 2 instead of total / 3?total / 3 වෙනුවට total / 2 කුමන දෝෂයක්ද?

Answerපිළිතුර: A logic error.තාර්කික දෝෂයකි.

5Name two IDEs for Python.Python සඳහා IDE දෙකක් නම් කරන්න.

Answerපිළිතුර: IDLE and Thonny (or VS Code).IDLE සහ Thonny (හෝ VS Code).

6Give one rule for using AI assistants responsibly.AI සහායක වගකීමෙන් භාවිතයට එක් රීතියක් දෙන්න.

Answerපිළිතුර: Understand and test the code; do not submit it as your own work.කේතය තේරුම් ගෙන පරීක්ෂා කරන්න; එය ඔබේ වැඩ ලෙස ඉදිරිපත් නොකරන්න.

MCQබහුවරණ ප්‍රශ්න

Choose the correct answer for each question.සෑම ප්‍රශ්නයකටම නිවැරදි පිළිතුර තෝරන්න.

Scoreලකුණු: 0 / 15

1The language the CPU runs directly is…CPU එක කෙළින්ම ධාවනය කරන භාෂාව…

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

0s and 1s.0 සහ 1.

2MOV AL, 61h is written in…MOV AL, 61h ලියා ඇත්තේ…

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

Mnemonics.Mnemonics.

3Assembly language is translated by an…ඇසෙම්බ්ලි භාෂාව පරිවර්තනය කරන්නේ…

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

Assembler.ඇසෙම්බ්ලරය.

4Which is a high-level language?ඉහළ මට්ටමේ භාෂාවක් කුමක්ද?

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

English-like.ඉංග්‍රීසි වැනි.

5A compiler translates…සම්පාදකයක් පරිවර්තනය කරන්නේ…

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

Compiler.සම්පාදකය.

6Python is usually run by an…Python සාමාන්‍යයෙන් ධාවනය කරන්නේ…

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

Interpreter.අර්ථවිනයකය.

7SQL, which says what data is wanted, is…අවශ්‍ය දත්ත මොනවාදැයි කියන SQL…

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

What, not how.කෙසේද නොව කුමක්ද.

8A language built around objects that hold data and actions is…දත්ත සහ ක්‍රියා තබන වස්තු වටා ගොඩනැගූ භාෂාවක්…

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

OOP.OOP.

9JavaScript, used to add actions to web pages, is a…වෙබ් පිටුවලට ක්‍රියා එක් කිරීමට භාවිත වන JavaScript…

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

Scripting.ස්ක්‍රිප්ටින්.

10Writing prnt(“Hi”) in Python causes a…Python හි prnt(“Hi”) ලිවීමෙන් ඇති වන්නේ…

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

Misspelt word.වැරදි අක්ෂර වින්‍යාසය.

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

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

Logic.තාර්කික.

12Dividing by zero while running causes a…ධාවනයේදී බිංදුවෙන් බෙදීම නිසා ඇති වන්නේ…

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

Runtime.ධාවන කාල.

13Marks 75, 68, 72 with total / 2 give Average = …ලකුණු 75, 68, 72 total / 2 සමඟ Average = …

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

215 ÷ 2.215 ÷ 2.

14Finding and fixing errors in a program is…වැඩසටහනක දෝෂ සොයා නිවැරදි කිරීම…

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

Debugging.දෝෂ නිරාකරණය.

15A responsible way to use an AI coding assistant is to…AI කේත සහායකයක් වගකීමෙන් භාවිත කිරීමේ ක්‍රමයක්…

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

Responsible use.වගකීම් සහගත භාවිතය.

MCQ answer keyMCQ පිළිතුරු

  1. C – 0s and 1s.0 සහ 1.
  2. A – Mnemonics.Mnemonics.
  3. C – Assembler.ඇසෙම්බ්ලරය.
  4. A – English-like.ඉංග්‍රීසි වැනි.
  5. B – Compiler.සම්පාදකය.
  6. A – Interpreter.අර්ථවිනයකය.
  7. B – What, not how.කෙසේද නොව කුමක්ද.
  8. B – OOP.OOP.
  9. D – Scripting.ස්ක්‍රිප්ටින්.
  10. B – Misspelt word.වැරදි අක්ෂර වින්‍යාසය.
  11. D – Logic.තාර්කික.
  12. A – Runtime.ධාවන කාල.
  13. C – 215 ÷ 2.215 ÷ 2.
  14. D – Debugging.දෝෂ නිරාකරණය.
  15. C – Responsible use.වගකීම් සහගත භාවිතය.

Structured Questionsව්‍යුහගත ප්‍රශ්න

1(i) Name two low-level languages. (1 mark)
(ii) Give two advantages of high-level languages. (2 marks)
(i) පහළ මට්ටමේ භාෂා දෙකක් නම් කරන්න. (ලකුණු 1)
(ii) ඉහළ මට්ටමේ භාෂාවල වාසි දෙකක් දෙන්න. (ලකුණු 2)
(3 marksලකුණු 3)

Show model answerආදර්ශ පිළිතුර පෙන්වන්න
(i) Machine language, assembly language. (ii) English-like / easy to learn; runs on different computers; fewer errors (any two).(i) යන්ත්‍ර භාෂාව, ඇසෙම්බ්ලි භාෂාව. (ii) ඉංග්‍රීසි වැනි / ඉගෙනීමට පහසු; විවිධ පරිගණකවල ධාවනය; අඩු දෝෂ (ඕනෑම දෙකක්).

2Compare a compiler and an interpreter under three headings. (3 marks)සම්පාදකයක් සහ අර්ථවිනයකයක් ශීර්ෂ තුනක් යටතේ සසඳන්න. (ලකුණු 3) (3 marksලකුණු 3)

Show model answerආදර්ශ පිළිතුර පෙන්වන්න
Translation: whole program vs line by line; output: executable file vs none; errors: listed together vs stops at the first; speed: faster vs slower (any three).පරිවර්තනය: සම්පූර්ණ වැඩසටහන එදිරිව පේළියෙන් පේළිය; ප්‍රතිදානය: ක්‍රියාත්මක ගොනුව එදිරිව නැත; දෝෂ: එකට එදිරිව පළමු එකේ නතර; වේගය: වේගවත් එදිරිව මන්දගාමී (ඕනෑම තුනක්).

3State the difference between (a) procedural and declarative languages (b) structured and object-oriented programming. (4 marks)(a) ක්‍රියා පටිපාටික සහ ප්‍රකාශන භාෂා (b) ව්‍යුහගත සහ වස්තු-නැඹුරු ක්‍රමලේඛනය අතර වෙනස සඳහන් කරන්න. (ලකුණු 4) (4 marksලකුණු 4)

Show model answerආදර්ශ පිළිතුර පෙන්වන්න
(a) Procedural gives step-by-step how (Pascal); declarative states what is wanted (SQL) (2). (b) Structured uses sequence, selection, iteration and sub-programs; OOP builds programs from objects holding data and actions (2).(a) ක්‍රියා පටිපාටික පියවරෙන් පියවර කෙසේද දෙයි (Pascal); ප්‍රකාශන අවශ්‍ය දේ සඳහන් කරයි (SQL) (2). (b) ව්‍යුහගත අනුක්‍රමය, වරණය, පුනරාවර්තනය සහ උප වැඩසටහන් භාවිත කරයි; OOP දත්ත සහ ක්‍රියා තබන වස්තු වලින් ගොඩනගයි (2).

4A program to find the average of three marks displays 107.50 for 75, 68, 72.
(i) What type of error is this? (1 mark)
(ii) What is the correct answer and how do you fix it? (2 marks)
(iii) Give two other types of error with an example. (2 marks)
ලකුණු තුනක සාමාන්‍යය සොයන වැඩසටහනක් 75, 68, 72 සඳහා 107.50 පෙන්වයි.
(i) මෙය කුමන දෝෂයක්ද? (ලකුණු 1)
(ii) නිවැරදි පිළිතුර කුමක්ද, එය නිවැරදි කරන්නේ කෙසේද? (ලකුණු 2)
(iii) වෙනත් දෝෂ වර්ග දෙකක් උදාහරණ සමඟ දෙන්න. (ලකුණු 2)
(5 marksලකුණු 5)

Show model answerආදර්ශ පිළිතුර පෙන්වන්න
(i) Logic error. (ii) 71.67; divide the total by 3. (iii) Syntax error – prnt(“Hi”); runtime error – dividing by zero.(i) තාර්කික දෝෂය. (ii) 71.67; එකතුව 3 න් බෙදන්න. (iii) වාක්‍ය රීති දෝෂය – prnt(“Hi”); ධාවන කාල දෝෂය – බිංදුවෙන් බෙදීම.
💻 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

5What is an IDE? Name two IDEs used for Python and state two rules for using AI assistants responsibly. (4 marks)IDE එකක් යනු කුමක්ද? Python සඳහා භාවිත වන IDE දෙකක් නම් කර AI සහායක වගකීමෙන් භාවිතයට රීති දෙකක් සඳහන් කරන්න. (ලකුණු 4) (4 marksලකුණු 4)

Show model answerආදර්ශ පිළිතුර පෙන්වන්න
Editor, translator and debugger in one program (1); IDLE, Thonny or VS Code (1); try yourself first / understand and test the code / do not submit as your own / no personal data (2).සංස්කාරකය, පරිවර්තකය සහ debugger එක එකම වැඩසටහනක (1); IDLE, Thonny හෝ VS Code (1); මුලින් ඔබම උත්සාහ කිරීම / කේතය තේරුම් ගෙන පරීක්ෂා කිරීම / ඔබේ ලෙස ඉදිරිපත් නොකිරීම / පුද්ගලික දත්ත නොදීම (2).

🎮 Game🎮 ක්‍රීඩා

Pick a game. Each one uses words from this lesson.ක්‍රීඩාවක් තෝරන්න. හැම එකක්ම මේ පාඩමේ වචන පාවිච්චි කරනවා.

Summary & Downloadsසාරාංශය සහ බාගත කිරීම්

Key pointsප්‍රධාන කරුණු

  • Low-level: machine (0/1) and assembly.පහළ මට්ටම: යන්ත්‍ර (0/1) සහ ඇසෙම්බ්ලි.
  • High-level: English-like – Python, Pascal.ඉහළ මට්ටම: ඉංග්‍රීසි වැනි – Python, Pascal.
  • Procedural = how; declarative = what.ක්‍රියා පටිපාටික = කෙසේද; ප්‍රකාශන = කුමක්ද.
  • Structured vs object-oriented.ව්‍යුහගත එදිරිව වස්තු-නැඹුරු.
  • Compiler: whole program; interpreter: line by line.සම්පාදකය: සම්පූර්ණ වැඩසටහන; අර්ථවිනයකය: පේළියෙන් පේළිය.
  • Errors: syntax, runtime, logic.දෝෂ: වාක්‍ය රීති, ධාවන කාල, තාර්කික.
  • Test with normal, boundary, invalid data.සාමාන්‍ය, මායිම්, අවලංගු දත්ත සමඟ පරීක්ෂා කරන්න.
  • IDEs: IDLE, Thonny, VS Code; use AI responsibly.IDE: IDLE, Thonny, VS Code; AI වගකීමෙන් භාවිත කරන්න.

Downloadsබාගත කිරීම්

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

Next: Lesson 1 O/L Exam Practiceඊළඟට: පාඩම 1 O/L විභාග පුහුණුව →

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