© 2026 schoolict.net (Ruwan Mangala Suraweera)
9.6 Integrated Development Environments and Debuggingඒකාබද්ධ සංවර්ධන පරිසර (IDE) සහ Debug කිරීම
Grade 13 A/L ICT · Lesson 913 ශ්රේණිය A/L ICT · පාඩම 9
In this videoමේ වීඩියෝවේ
- An IDE combines editor, runner and debugger.IDE editor, ධාවකය, debugger එකතු කරයි.
- Save Python files as .py.Python ගොනු .py ලෙස සුරකින්න.
- Breakpoints pause execution.Breakpoints ධාවනය නවත්වයි.
- Step and watch reveal logic errors.Step සහ watch තාර්කික දෝෂ හෙළි කරයි.
- Logic errors need testing to be found.තාර්කික දෝෂ සොයා ගැනීමට පරීක්ෂාව අවශ්යයි.
Notesසටහන්
Syllabus 9.6. An IDE brings together an editor, translator, runner and debugger in one program (for example IDLE, Thonny or VS Code). You learn to open and save files, run programs and use debugging facilities such as breakpoints, stepping and watching variables.විෂය නිර්දේශය 9.6. IDE එකක් editor, පරිවර්තකය, ධාවකය සහ debugger එක් වැඩසටහනක එකතු කරයි (උදා: IDLE, Thonny, VS Code). ගොනු විවෘත කිරීම සහ සුරැකීම, වැඩසටහන් ධාවනය සහ breakpoints, stepping, variables watch වැනි debug පහසුකම් ඉගෙන ගනිමු.
1. Basic features of an IDE1. IDE හි මූලික ලක්ෂණ
- Editor with syntax colouring, auto-indent, auto-complete and line numbers.Editor: syntax වර්ණ, ස්වයං indent, auto-complete, පේළි අංක.
- File menu: New, Open, Save, Save As (Python files end in .py).File මෙනුව: New, Open, Save, Save As (.py ගොනු).
- Run: translate and execute (F5 in IDLE); output and errors appear in the console.Run: පරිවර්තනය සහ ධාවනය (IDLE හි F5); ප්රතිදානය console හි.
- Debugger: breakpoints, step into/over, watch variables and the call stack.Debugger: breakpoints, step into/over, විචල්ය watch, call stack.
2. Debugging an off-by-one error2. off-by-one දෝෂයක් debug කිරීම
🐍 Debugging an off-by-one erroroff-by-one දෝෂයක් debug කිරීම
marks = [60, 70, 80] def average_bug(m): total = 0 for i in range(len(m) - 1): # bug: skips the last item total += m[i] return total / len(m) def average_fixed(m): total = 0 for i in range(len(m)): total += m[i] return total / len(m) print("Buggy:", average_bug(marks)) print("Fixed:", average_fixed(marks))
▶ Outputප්රතිදානය
Buggy: 43.333333333333336 Fixed: 70.0
Set a breakpoint inside the loop and watch i and total. i takes only 0 and 1, so total reaches 130 and 130 ÷ 3 = 43.33. The range should be range(len(m)); then total = 210 and the average is 70.0.loop තුළ breakpoint තබා i සහ total watch කරන්න. i 0 සහ 1 පමණි; total 130; 130 ÷ 3 = 43.33. range(len(m)) විය යුතුය; එවිට 70.0.
| Error typeදෝෂ වර්ගය | Found byසොයන්නේ | Exampleඋදාහරණය |
|---|---|---|
| SyntaxSyntax | Translator, before runningපරිවර්තකය, ධාවනයට පෙර | missing colon after ifif පසු : නැත |
| Runtimeධාවන කාල | Program crash while runningධාවනයේදී බිඳවැටීම | division by zeroශුන්යයෙන් බෙදීම |
| Logicතාර්කික | Wrong output; use the debuggerවැරදි ප්රතිදානය; debugger | range(len(m) – 1)range(len(m) – 1) |
Key Wordsප්රධාන පද
Sample Q&Aආදර්ශ ප්රශ්න සහ පිළිතුරු
1Name four IDE features.IDE ලක්ෂණ හතරක්.
2What is a breakpoint?Breakpoint?
3Buggy and fixed averages?සාමාන්ය දෙක?
4What caused the bug?දෝෂයට හේතුව?
5Which errors give no message?පණිවිඩයක් නොදෙන දෝෂ?
6How do you save a Python file?Python ගොනුව සුරැකීම?
MCQබහුවරණ ප්රශ්න
Choose the correct answer for each question.සෑම ප්රශ්නයකටම නිවැරදි පිළිතුර තෝරන්න.
1The IDE part that pauses at a marked line is aනවතින
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B
Breakpoint.Breakpoint.
2Showing a variable value during debugging isඅගය පෙන්වීම
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: E
Watch.Watch.
3The buggy program prints averagebuggy
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D
130 ÷ 3.130 ÷ 3.
4The fixed program prints averagefixed
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C
210 ÷ 3.210 ÷ 3.
5range(len(m) – 1) instead of range(len(m)) is anrange
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A
Logic.තාර්කික.
6Output and error messages appear in theප්රතිදානය
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C
Console.Console.
7A missing colon after if is found: නැත
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A
Syntax.Syntax.
8Python source files are saved with the extensionextension
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: E
.py..py.
9Which term means: “Software combining editor, translator, runner and debugger”?“editor, පරිවර්තකය, ධාවකය, debugger එකතු කළ මෘදුකාංගය” යන්නෙන් අදහස් වන පදය කුමක්ද?
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D
IDE – Software combining editor, translator, runner and debugger.IDE – editor, පරිවර්තකය, ධාවකය, debugger එකතු කළ මෘදුකාංගය.
10Which term means: “Part of an IDE where source code is typed”?“මූලාශ්ර කේතය ටයිප් කරන IDE කොටස” යන්නෙන් අදහස් වන පදය කුමක්ද?
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: E
Code editor – Part of an IDE where source code is typed.කේත editor – මූලාශ්ර කේතය ටයිප් කරන IDE කොටස.
11Which term means: “Colouring keywords and strings to aid reading”?“කියවීමට පහසුවට keywords වර්ණ ගැන්වීම” යන්නෙන් අදහස් වන පදය කුමක්ද?
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B
Syntax highlighting – Colouring keywords and strings to aid reading.Syntax වර්ණ – කියවීමට පහසුවට keywords වර්ණ ගැන්වීම.
12Which term means: “Suggesting names while typing”?“ටයිප් කරන විට නම් යෝජනා කිරීම” යන්නෙන් අදහස් වන පදය කුමක්ද?
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A
Auto-complete – Suggesting names while typing.Auto-complete – ටයිප් කරන විට නම් යෝජනා කිරීම.
13Which term means: “Window showing program output and errors”?“ප්රතිදානය සහ දෝෂ පෙන්වන කවුළුව” යන්නෙන් අදහස් වන පදය කුමක්ද?
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B
Console – Window showing program output and errors.Console – ප්රතිදානය සහ දෝෂ පෙන්වන කවුළුව.
14Which term means: “Tool for running a program step by step to find errors”?“දෝෂ සෙවීමට පියවරෙන් පියවර ධාවනය කරන මෙවලම” යන්නෙන් අදහස් වන පදය කුමක්ද?
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C
Debugger – Tool for running a program step by step to find errors.Debugger – දෝෂ සෙවීමට පියවරෙන් පියවර ධාවනය කරන මෙවලම.
15Which term means: “Marked line where execution pauses”?“ධාවනය නවතින සලකුණු කළ පේළිය” යන්නෙන් අදහස් වන පදය කුමක්ද?
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D
Breakpoint – Marked line where execution pauses.Breakpoint – ධාවනය නවතින සලකුණු කළ පේළිය.
16Which term means: “Run the next line, entering any function called”?“ඊළඟ පේළිය ධාවනය; ශ්රිතය ඇතුළට යාම” යන්නෙන් අදහස් වන පදය කුමක්ද?
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A
Step into – Run the next line, entering any function called.Step into – ඊළඟ පේළිය ධාවනය; ශ්රිතය ඇතුළට යාම.
17Which term means: “Showing the current value of chosen variables”?“තෝරාගත් විචල්යවල වත්මන් අගය පෙන්වීම” යන්නෙන් අදහස් වන පදය කුමක්ද?
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C
Watch – Showing the current value of chosen variables.Watch – තෝරාගත් විචල්යවල වත්මන් අගය පෙන්වීම.
18Which term means: “Mistake that gives wrong results without crashing”?“බිඳ නොවැටී වැරදි ප්රතිඵල දෙන වරද” යන්නෙන් අදහස් වන පදය කුමක්ද?
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B
Logic error – Mistake that gives wrong results without crashing.තාර්කික දෝෂය – බිඳ නොවැටී වැරදි ප්රතිඵල දෙන වරද.
19Which term means: “Loop that runs one time too many or too few”?“එක් වරක් වැඩි හෝ අඩු වන ලූපය” යන්නෙන් අදහස් වන පදය කුමක්ද?
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D
Off-by-one error – Loop that runs one time too many or too few.Off-by-one දෝෂය – එක් වරක් වැඩි හෝ අඩු වන ලූපය.
20Which term means: “List of functions currently being executed”?“දැනට ධාවනය වන ශ්රිත ලැයිස්තුව” යන්නෙන් අදහස් වන පදය කුමක්ද?
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: E
Call stack – List of functions currently being executed.Call stack – දැනට ධාවනය වන ශ්රිත ලැයිස්තුව.
MCQ answer keyMCQ පිළිතුරු
- B – Breakpoint.Breakpoint.
- E – Watch.Watch.
- D – 130 ÷ 3.130 ÷ 3.
- C – 210 ÷ 3.210 ÷ 3.
- A – Logic.තාර්කික.
- C – Console.Console.
- A – Syntax.Syntax.
- E – .py..py.
- D – IDE – Software combining editor, translator, runner and debugger.IDE – editor, පරිවර්තකය, ධාවකය, debugger එකතු කළ මෘදුකාංගය.
- E – Code editor – Part of an IDE where source code is typed.කේත editor – මූලාශ්ර කේතය ටයිප් කරන IDE කොටස.
- B – Syntax highlighting – Colouring keywords and strings to aid reading.Syntax වර්ණ – කියවීමට පහසුවට keywords වර්ණ ගැන්වීම.
- A – Auto-complete – Suggesting names while typing.Auto-complete – ටයිප් කරන විට නම් යෝජනා කිරීම.
- B – Console – Window showing program output and errors.Console – ප්රතිදානය සහ දෝෂ පෙන්වන කවුළුව.
- C – Debugger – Tool for running a program step by step to find errors.Debugger – දෝෂ සෙවීමට පියවරෙන් පියවර ධාවනය කරන මෙවලම.
- D – Breakpoint – Marked line where execution pauses.Breakpoint – ධාවනය නවතින සලකුණු කළ පේළිය.
- A – Step into – Run the next line, entering any function called.Step into – ඊළඟ පේළිය ධාවනය; ශ්රිතය ඇතුළට යාම.
- C – Watch – Showing the current value of chosen variables.Watch – තෝරාගත් විචල්යවල වත්මන් අගය පෙන්වීම.
- B – Logic error – Mistake that gives wrong results without crashing.තාර්කික දෝෂය – බිඳ නොවැටී වැරදි ප්රතිඵල දෙන වරද.
- D – Off-by-one error – Loop that runs one time too many or too few.Off-by-one දෝෂය – එක් වරක් වැඩි හෝ අඩු වන ලූපය.
- E – Call stack – List of functions currently being executed.Call stack – දැනට ධාවනය වන ශ්රිත ලැයිස්තුව.
Structured Questionsව්යුහගත ප්රශ්න
1Describe four basic features of an IDE.IDE ලක්ෂණ හතර. (4 marksලකුණු 4)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න
2List the steps to open, edit, save and run a Python file in an IDE.පියවර. (5 marksලකුණු 5)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න
3Explain breakpoint, step and watch.breakpoint, step, watch. (3 marksලකුණු 3)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න
4Find and fix the bug in average_bug().දෝෂය සොයා නිවැරදි කිරීම. (3 marksලකුණු 3)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න
5Distinguish syntax, runtime and logic errors.දෝෂ වර්ග තුන. (3 marksලකුණු 3)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න
🎮 Game🎮 ක්රීඩා
Summary & Downloadsසාරාංශය සහ බාගත කිරීම්
Key pointsප්රධාන කරුණු
- An IDE combines editor, runner and debugger.IDE editor, ධාවකය, debugger එකතු කරයි.
- Save Python files as .py.Python ගොනු .py ලෙස සුරකින්න.
- Breakpoints pause execution.Breakpoints ධාවනය නවත්වයි.
- Step and watch reveal logic errors.Step සහ watch තාර්කික දෝෂ හෙළි කරයි.
- Logic errors need testing to be found.තාර්කික දෝෂ සොයා ගැනීමට පරීක්ෂාව අවශ්යයි.
Downloadsබාගත කිරීම්
Resource Book Lesson Note Download Questions Syllabus Sinhala LMS Simulator Tool
