ЁЯЯж GCE A/L ICT – Competency 9
Algorithms + Python Programming | Problem Solving to Execution | Theory + Code + Exam Patterns
GCE A/L ICT - UNIT 9: PROGRAMMING
1. Fundamentals of Problem Solving & Algorithm Design
1.1. Concept of Problem Solving
1.2. Identification of Inputs, Processes, and Outputs (IPO)
1.3. Step-by-Step Approach to Problem Solving
1.4. Representation of Algorithms
1.4.1. Flowcharts (Standard Symbols: Terminal, Input/Output, Process, Decision, Flowlines)
1.4.2. Pseudo-code (Structured Keywords: IF-THEN-ELSE, WHILE, FOR)
2. Introduction to Programming Languages
2.1. Evolution of Programming Languages (Low-level vs. High-level)
2.2. Translators: Compilers, Interpreters, and Assemblers
2.3. Characteristics of the Python Programming Language
3. Basic Syntax and Coding Fundamentals in Python
3.1. Python Coding Environment (IDLE, Script Mode vs. Interactive Mode)
3.2. Identifiers, Keywords, and Naming Conventions
3.3. Variables and Assignment Statements
3.4. Basic Data Types
3.4.1. Integer (int)
3.4.2. Floating-point (float)
3.4.3. String (str)
3.4.4. Boolean (bool)
3.5. Operators and Expressions
3.5.1. Arithmetic Operators (+, -, *, /, //, %, **)
3.5.2. Relational / Comparison Operators (==, !=, >, <, >=, <=)
3.5.3. Logical Operators (and, or, not)
3.6. Basic Input and Output Functions (input() and print())
4. Control Structures
4.1. Sequence Control Structure
4.2. Selection / Decision-Making Structures
4.2.1. Simple 'if' statement
4.2.2. 'if - else' statement
4.2.3. Nested 'if' and 'if - elif - else' chains
4.3. Iteration / Looping Structures
4.3.1. Condition-controlled loops ('while' loop)
4.3.2. Count-controlled loops ('for' loop with range() function)
4.3.3. Nested Loops
4.3.4. Loop control statements (break, continue)
5. Python Data Structures (Collections)
5.1. Strings (Indexing, Slicing, and String Methods)
5.2. Lists (Creating, Indexing, Mutable properties, List Methods)
5.3. Tuples (Immutable sequences)
5.4. Dictionaries (Key-Value pairs, Accessing and Modifying keys)
6. Functions and Modularity
6.1. Concept of Modular Programming
6.2. Built-in Functions vs. User-defined Functions
6.3. Function Definition (def keyword) and Arguments/Parameters
6.4. Return Values (return statement)
6.5. Scope of Variables: Local vs. Global Variables
7. File Handling
7.1. Concept of Data Persistence
7.2. Opening and Closing Files (open(), close())
7.3. File Access Modes ('r' for Read, 'w' for Write, 'a' for Append)
7.4. Reading from Text Files (read(), readline(), readlines())
7.5. Writing data to Text Files (write(), writelines())
8. Error and Exception Handling
8.1. Types of Programming Errors (Syntax, Runtime, Logical Errors)
8.2. Handling Exceptions using 'try - except' blocks
9. Database Connectivity (Python with SQLite)
9.1. Establishing a Database Connection
9.2. Executing SQL queries via Python Scripting (CRUD Operations)
10. Standard Algorithms in Python
10.1. Implementing Linear Search
10.2. Implementing Bubble Sort
ЁЯУШ Competency 9 Overview | Problem-Solving Process ▼
“Develops algorithms to solve problems and uses Python programming language to encode algorithms.”
роЕродாро╡родு: Problem → Algorithm → Flowchart/Pseudocode → Python Program → Testing/Debugging
роТро░ு programming question ро╡рои்родாро▓், роиேро░роЯிропாроХ Python роОро┤ுродுро╡родு роороЯ்роЯுроо் рокோродாродு. рооுродро▓ிро▓் problem-роР рокுро░ிрои்родுроХொрог்роЯு, solution-роР родிроЯ்роЯрооிроЯ்роЯு, algorithm роЙро░ுро╡ாроХ்роХி, рокிрой்ройро░் роЕродை Python-ро▓் роОро┤ுрод ро╡ேрог்роЯுроо்.
9.1 Problem-Solving Process (4 Stages)
1. Understanding
рокிро░роЪ்роЪிройைропைрок் рокுро░ிрои்родுроХொро│்ро│ுродро▓் (Input, Output, Conditions)
2. Defining
рокிро░роЪ்роЪிройை рооро▒்ро▒ுроо் роЕродрой் роОро▓்ро▓ைроХро│ை (boundaries) ро╡ро░ைропро▒ுрод்родро▓்
3. Planning
родீро░்ро╡ைрод் родிроЯ்роЯрооிроЯுродро▓் (Algorithm/Flowchart)
4. Implementation
родீро░்ро╡ை Python-ро▓் роЪெропро▓்рокроЯுрод்родுродро▓்
Q: рокிро░роЪ்роЪிройை родீро░்роХ்роХுроо் роЪெропро▓்рооுро▒ைропிрой் роиாрой்роХு рооுроХ்роХிроп рокроЯிроХро│ை роОро┤ுродுроХ.
Answer:
- рокிро░роЪ்роЪிройைропைрок் рокுро░ிрои்родுроХொро│்ро│ுродро▓்
- рокிро░роЪ்роЪிройை рооро▒்ро▒ுроо் роЕродрой் роОро▓்ро▓ைроХро│ை ро╡ро░ைропро▒ுрод்родро▓்
- родீро░்ро╡ைрод் родிроЯ்роЯрооிроЯுродро▓்
- родீро░்ро╡ை роЪெропро▓்рокроЯுрод்родுродро▓்
ЁЯПЧ️ 9.2 Top-Down Design & Stepwise Refinement ▼
Modularization
роТро░ு рокெро░ிроп problem-роР роЪிро▒ிроп, manageable modules-роЖроХ рокிро░ிрок்рокродு. (Eg: School System → Student, Attendance, Exams)
Top-Down Design
Big problem → Small problems. рооேро▓ிро░ுрои்родு роХீро┤ாроХ problem-роР рокிро░ிрок்рокродு.
Stepwise Refinement
роТро░ு рокெро░ிроп task-роР родொроЯро░்рои்родு роЪிро▒ிроп tasks-роЖроХ detail-роЖроХ рокிро░ிрод்родுроХ் роХொрог்роЯே роЪெро▓்ро╡родு.
Structure Chart Example
Q: Top-down design роОрой்ро▒ாро▓் роОрой்рой?
Answer: роТро░ு рокெро░ிроп рокிро░роЪ்роЪிройைропை рооுродро▓ிро▓் рооுроХ்роХிроп modules-роЖроХро╡ுроо், рокிрой்ройро░் роЕро╡ро▒்ро▒ை роЪிро▒ிроп sub-modules-роЖроХро╡ுроо் рокிро░ிрод்родு родீро░்ро╡ு роХாрогுроо் рооுро▒ைропே Top-down design роЖроХுроо்.
ЁЯза 9.3 Algorithmic Approach | Flowchart & Pseudocode ▼
Algorithm роОрой்рокродு роТро░ு problem-роР solve роЪெроп்ро╡родро▒்роХாрой finite, clear, ordered steps роЖроХுроо்.
Algorithm-рой் 5 Characteristics
1. Finiteness
роТро░ு роХроЯ்роЯрод்родிро▓் рооுроЯிро╡роЯைроп ро╡ேрог்роЯுроо்.
2. Definiteness
роТро╡்ро╡ொро░ு step-роЙроо் родெро│ிро╡ாроХ роЗро░ுроХ்роХ ро╡ேрог்роЯுроо்.
3. Input
Input роЗро░ுроХ்роХро▓ாроо் (zero or more).
4. Output
Result/output роХрог்роЯிрок்рокாроХ роХொроЯுроХ்роХ ро╡ேрог்роЯுроо்.
5. Effectiveness
Practical-роЖроХ execute роЪெроп்ропроХ்роХூроЯிропродாроХ роЗро░ுроХ்роХ ро╡ேрог்роЯுроо்.
Flowchart Symbols
| Symbol | рокропрой்рокாроЯு |
|---|---|
| Oval | Start / Stop |
| Rectangle | Process |
| Parallelogram | Input / Output |
| Diamond | Decision |
| Arrow | Flow direction |
Pseudocode Example (Largest of 2 numbers)
Hand Trace Example
| Step | a | b | c | Output |
|---|---|---|---|---|
| Initial | 5 | 3 | - | - |
| c=a+b | 5 | 3 | 8 | - |
| print(c) | 5 | 3 | 8 | 8 |
123 роОрой்ро▒ роОрог்рогை 321 роЖроХ reverse роЪெроп்ропுроо் logic:
ЁЯзй 9.4 Programming Paradigms & Generations ▼
Imperative
"How to do?"
Computer роОрой்ройெрой்рой steps роЪெроп்роп ро╡ேрог்роЯுроо் роОрой்ро▒ு programmer роХூро▒ுро╡ாро░். (Eg: Python loops)
Declarative
"What should be done?"
роОрок்рокроЯி роЪெроп்роп ро╡ேрог்роЯுроо் роОрой்рокродை ро╡ிроЯ роОрой்рой result ро╡ேрог்роЯுроо் роОрой்рокродிро▓் focus. (Eg: SQL)
Object-Oriented
Program-роР objects рооро▒்ро▒ுроо் classes роЕроЯிрок்рокроЯைропிро▓் роЕрооைрок்рокродு. (Eg: Python classes)
Programming Language Generations
| Generation | Name | Example |
|---|---|---|
| 1GL | Machine language | Binary (0s, 1s) |
| 2GL | Assembly | Assembly Language |
| 3GL | High-level | C, Java, Python |
| 4GL | Very high-level | SQL, MATLAB |
⚙️ 9.5 Program Translation (Compiler vs Interpreter) ▼
Computer роиேро░роЯிропாроХ high-level Python statements-роР execute роЪெроп்ропாродு. роОройро╡ே translation родேро╡ை.
Compiler
рооுро┤ு source program-роР роТро░ே роиேро░род்родிро▓் translate роЪெроп்роХிро▒родு. Execution ро╡ேроХроо் роЕродிроХроо். Object code роЙро░ுро╡ாроХுроо்.
Interpreter
Program-роР line-by-line translate рооро▒்ро▒ுроо் execute роЪெроп்роХிро▒родு. Python рокொродுро╡ாроХ роЗродைрок் рокропрой்рокроЯுрод்родுроХிро▒родு.
Linker
рокро▓ object modules / libraries-роР роТрой்ро▒ாроХ роЗрогைрод்родு executable program роЙро░ுро╡ாроХ்роХ роЙродро╡ுроХிро▒родு.
Compiler vs Interpreter
| Compiler | Interpreter |
|---|---|
| Whole program at once | Statement/line at a time |
| Faster execution | Generally slower |
| Produces Object code | No standalone object code |
| Errors reported after compilation | Errors appear during execution |
ЁЯРЮ 9.6 IDE & Debugging (3 Types of Errors) ▼
IDE (Integrated Development Environment) роОрой்рокродு Code editor, Run/Execute, Debugger рокோрой்ро▒ tools-роР роТро░ே environment-ро▓் ро╡ро┤роЩ்роХுро╡родு.
3 рооுроХ்роХிроп Errors
1. Syntax Error
Grammar родро╡ро▒ு. Program run роЖроХாродு.if x > 5 (: missing)
2. Runtime Error
Program run роЪெроп்ропுроо்рокோродு crash роЖроХுроо்.x = 10 / 0 (Division by zero)
3. Logical Error
Program execute роЖроХுроо். роЖройாро▓் answer родро╡ро▒ாроХ роЗро░ுроХ்роХுроо்.area = length + width (Should be *)
ЁЯРН 9.7 Python Basics | Variables, Types & Operators ▼
Basic Structure & Data Types
int
age = 18
float
price = 25.50
str
name = "Ali"
bool
passed = True
Operators & Precedence
- Arithmetic:
+, -, *, /, %, **, // - Relational:
>, <, >=, <=, ==, != - Logical:
and, or, not
result = 2 + 3 * 4 → First 3*4=12, then 2+12=14.(2 + 3) * 4 → Answer = 20
ЁЯФА 9.8 Control Structures (Sequence, Selection, Repetition) ▼
1. Sequence
Statements order-роЖроХ execute роЖроХுроо்.a=10b=20c=a+b
2. Selection
Condition роЕроЯிрок்рокроЯைропிро▓் decision.if marks >= 50:
print("Pass")else:
print("Fail")
3. Repetition
Looping statements.for i in range(1, 6):
print(i)
Nested Control Structure
Q: Control structures рооூрой்ро▒ை роОро┤ுродுроХ.
Answer: 1. Sequence, 2. Selection, 3. Repetition
ЁЯз▒ 9.9 Sub-programs / Functions ▼
Local vs Global Variables
| Local | Global |
|---|---|
| Function-роХ்роХுро│் роЙро░ுро╡ாроХ்роХрок்рокроЯுроХிро▒родு | Program-роХ்роХு ро╡ெро│ிропே роЙро░ுро╡ாроХ்роХрок்рокроЯுроХிро▒родு |
| Scope limited to function | Wider scope (entire program) |
Q: Student name & food item-рой் рооுродро▓் рооро▒்ро▒ுроо் роХроЯைроЪி роОро┤ுрод்родுроХро│் роТро░ே рооாродிро░ிропா роОрой рокро░ிроЪோродிроХ்роХுроо் function.
ЁЯУж 9.10 Data Structures (Strings, Lists, Tuples, Dicts) ▼
String
name = "Python"
Index: name[0] is 'P', name[-1] is 'n'
List
nums = [10, 20]
Mutable (changeable).
Methods: append(), pop(), sort()
Tuple
nums = (10, 20)
Immutable (cannot change).
Dictionary
std = {"name": "Ali", "age": 18}
Key-value pairs. std["name"]
List operations trace:
ЁЯТ╛ 9.11 & 9.12 File Handling + Database (SQL) ▼
File Handling Modes
| Mode | Meaning |
|---|---|
"r" | Read |
"w" | Write (Overwrites existing data ⚠️) |
"a" | Append (Adds to end of file) |
Database CRUD Operations (SQL)
Create (Insert)
INSERT INTO Student VALUES (101, 'Ali');
Read (Select)
SELECT * FROM Student;
Update
UPDATE Student SET name='Ahmed' WHERE id=101;
Delete
DELETE FROM Student WHERE id=101;
ЁЯФН 9.13 Searching and Sorting (Sequential & Bubble) ▼
Sequential Search
Data роТрой்ро▒ை роТрой்ро▒ாроХ sequentially check роЪெроп்ро╡родு.
Bubble Sort (Ascending)
Adjacent elements-роР compare роЪெроп்родு order родро╡ро▒ாроХ роЗро░ுрои்родாро▓் swap роЪெроп்ро╡родு.
роЗро░рог்роЯு values-роР swap роЪெроп்ропுроо்рокோродு роТро░ு value-роР рокாродுроХாрок்рокாроХ ро╡ைрод்родிро░ுроХ்роХ
temp рокропрой்рокроЯுроХிро▒родு.Python shortcut:
a, b = b, a
ЁЯПЖ Exam Priority & 5-Way Problem Solving Trick ▼
ЁЯФе Exam Focus Priority
| Priority | Section |
|---|---|
| ЁЯФеЁЯФеЁЯФе рооிроХ рооுроХ்роХிропроо் | 9.3 Algorithms, 9.7 Python basics, 9.8 Control structures, 9.9 Functions, 9.10 Data structures |
| ЁЯФеЁЯФе рооுроХ்роХிропроо் | 9.13 Search & Bubble sort, 9.5 Translators, 9.2 Top-down |
| ЁЯФе Theory | 9.11 Files, 9.12 Database (SQL), 9.6 IDE, 9.4 Paradigms |
роТро░ே problem-роР 5 ро╡ிродрооாроХ роОро┤ுродрод் родெро░ிрои்родிро░ுроХ்роХ ро╡ேрог்роЯுроо்:
1. Algorithm
START
INPUT N
IF N MOD 2 = 0 THEN
OUTPUT "Even"
ELSE
OUTPUT "Odd"
END IF
STOP
2. Pseudocode
READ N
IF N % 2 == 0 THEN
PRINT "Even"
ELSE
PRINT "Odd"
3. Python Code
n = int(input())
if n % 2 == 0:
print("Even")
else:
print("Odd")
4. Flowchart
Start → Input N → Diamond (N%2==0?) → Yes (Even) / No (Odd) → Stop
5. Hand Trace (N=7)
n = 7
n % 2 = 1
Condition (1==0) is False
Output: Odd
ЁЯОУ Expert ICT, Coding, School Classes, Digital Marketing & University Project Guidance
Struggling with your university final year project? Want to master coding, upscale your business with expert digital marketing, or learn absolute computer basics from scratch? We offer high-quality individual and group online classes conducted in English, Sinhala, or Tamil mediums. Get guaranteed academic success and professional growth with tailored guidance.
ЁЯОУ University Final Year Project Guidance & AI
Get specialized, end-to-end mentoring and technical support to pass your degree or master's program with flying colors:
- ЁЯПл Targeted Institutes: Expert guidance tailored for BIT UCSC, UoM, SLIIT, NIBM, and other leading universities.
- ЁЯФм Postgraduate Support: Comprehensive assistance for MSc Software Final Year Projects.
- ЁЯдЦ AI & Smart Applications: Step-by-step implementation of AI, Machine Learning (ML), and automation modules.
- ✅ Guaranteed Success: Help with documentation, system architecture, coding, and viva preparation.
ЁЯПл School ICT & Corporate Beginner Classes
- ЁЯТ╗ Non-IT Staff Computer Basics: Absolute beginner-friendly online classes covering essential computer skills, office tools, and internet operations.
- ЁЯОТ Primary & Secondary (Grades 1-10): Interactive online ICT classes tailored to build strong foundations from early ages.
- ЁЯУЭ Exam Prep: Dedicated training packages for GCE O/L, GCE A/L ICT, and GIT exams.
- ЁЯМН Global Syllabuses: Complete curriculum coverage for Local, Edexcel, and Cambridge in English & Tamil Mediums.
ЁЯУв Software Development & Digital Marketing Services
- ⚙️ Software & Web Development: Professional custom software application and website development built using PHP & MySQL.
- ЁЯОп Social Media Management: Content creation, publishing, and channel management for Facebook, Instagram, TikTok, and YouTube.
- ЁЯУИ Ad Boosting: Highly targeted paid advertising campaigns to drive leads, traffic, and sales to your business.
ЁЯУЮ Connect With Us Instantly
Book your slot for online classes or get a premium tech service quote today!
ЁЯТм WhatsApp: +94 729622034
ЁЯУз Email: ITClassSL@gmail.com
ЁЯМР Explore Our Resources & Communities
Stay updated with our latest tutorials, project ideas, and student guides across all our official platforms:
- ЁЯУ║ YouTube Tutorials: Subscribe to our Channel
- ЁЯТ╝ Professional Network: Connect on LinkedIn
- ✍️ Tech Blog: Visit our WordPress Site
- ❓ Project Q&A: Follow our Quora Guide Profile
- ЁЯУ░ Monthly Updates: Read Our Newsletter
- ЁЯМР Official Portfolios: Wix Site | Google Business | Strikingly Portfolio
- ЁЯЧг️ Student Forum: Join our ElaKiri Discussion Thread
No comments:
Post a Comment