Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
3 views6 pages

Chapter7 8 Fun Notes

The document provides revision notes for IGCSE Computer Science, focusing on Algorithm Design and Programming. Key concepts include the PDLC steps, algorithm types, data validation, and programming constructs such as variables, control structures, and file handling. It also includes pseudocode examples for common tasks like totalling, searching, and sorting.

Uploaded by

Zephy Tron
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views6 pages

Chapter7 8 Fun Notes

The document provides revision notes for IGCSE Computer Science, focusing on Algorithm Design and Programming. Key concepts include the PDLC steps, algorithm types, data validation, and programming constructs such as variables, control structures, and file handling. It also includes pseudocode examples for common tasks like totalling, searching, and sorting.

Uploaded by

Zephy Tron
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

■ IGCSE Computer Science – Fun Revision Notes

(Chapters 7 & 8)

■ Chapter 7 – Algorithm Design & Problem Solving


■■ PDLC Steps → Analysis ■ → Design ✏■ → Coding ■ → Testing ■ → Maintenance ■
■ Decomposition = Breaking BIG problem into small easy steps (like LEGO blocks ■).
■ Algorithms = Recipe for solving problems (Flowcharts ■ / Pseudocode ■).
■ Standard Solutions: Totalling ■, Counting ■, Max/Min ■■■■, Search ■, Sort ■
■ Validation = 'Is data sensible?' (Range, Type, Length, Format)
■ Verification = 'Did we type it correctly?' (Double entry ✍■, Visual check ■)
■ Test Data Types: Normal ■, Boundary ■, Abnormal ■
■ Trace Tables = Track variables step by step (catch hidden mistakes ■■).
■■ Error Types: Syntax ■ (rules), Logic ■ (wrong answer), Runtime ■ (crash)
■ Tips: Use clear names, modular design, and test with all data types.
■ Chapter 8 – Programming
■ Variables = Boxes that can change. Constants = Locked boxes ■.
■ Control: Sequence ■■ → Selection (IF ■) → Loops ■ (FOR, WHILE, REPEAT).
■ Operators: Arithmetic ■■✖■■, Relational > < =, Logical AND/OR/NOT ■
■ Strings: Join ■, Length ■, Substring ✂■.
■ Subroutines: Procedure ■■ (no return), Function ■ (returns value).
■ Parameters: Local (inside only) ■, Global (everywhere) ■.
■ Arrays: 1D = list ■, 2D = table ■ (use indexes #■■).
■ Files: OPEN ■, READ ■, WRITE ✍■, CLOSE ■.
■ Good Code: Indent ↔■, Comments ■, Clear names ■■, Break into parts ■.
■■ Pseudocode Examples
■ Totalling
total ← 0
FOR counter ← 1 TO 5
INPUT number
total ← total + number
NEXT counter
OUTPUT total

■ Counting
count ← 0
FOR counter ← 1 TO 10
INPUT mark
IF mark >= 50 THEN
count ← count + 1
ENDIF
NEXT counter
OUTPUT count

■ Find Max/Min
INPUT firstNumber
max ← firstNumber
min ← firstNumber
FOR counter ← 2 TO 10
INPUT number
IF number > max THEN
max ← number
ENDIF
IF number < min THEN
min ← number
ENDIF
NEXT counter
OUTPUT "Max = ", max
OUTPUT "Min = ", min

■ Linear Search
found ← FALSE
index ← 0
INPUT searchItem
WHILE index < arrayLength AND found = FALSE
IF array[index] = searchItem THEN
found ← TRUE
ELSE
index ← index + 1
ENDIF
ENDWHILE
IF found = TRUE THEN
OUTPUT "Item found at position ", index
ELSE
OUTPUT "Item not found"
ENDIF

■ Bubble Sort
FOR pass ← 1 TO arrayLength - 1
FOR index ← 0 TO arrayLength - 2
IF array[index] > array[index+1] THEN
temp ← array[index]
array[index] ← array[index+1]
array[index+1] ← temp
ENDIF
NEXT index
NEXT pass

■ IF / ELSE
INPUT age
IF age >= 18 THEN
OUTPUT "Adult"
ELSE
OUTPUT "Not Adult"
ENDIF

■ WHILE Loop
count ← 0
WHILE count < 5
OUTPUT "Hello"
count ← count + 1
ENDWHILE

■ REPEAT…UNTIL
REPEAT
INPUT number
UNTIL number >= 0

■ FOR Loop
FOR counter ← 1 TO 10
OUTPUT counter
NEXT counter

■ Procedure
PROCEDURE greet(name)
OUTPUT "Hello ", name
ENDPROCEDURE
CALL greet("Ali")

■ Function
FUNCTION square(number)
RETURN number * number
ENDFUNCTION
result ← square(5)
OUTPUT result

■ 1D Array
FOR index ← 0 TO 4
INPUT names[index]
NEXT index
FOR index ← 0 TO 4
OUTPUT names[index]
NEXT index
■ 2D Array
FOR row ← 0 TO 2
FOR col ← 0 TO 2
INPUT marks[row][col]
NEXT col
NEXT row

■ File Write
OPENFILE "data.txt" FOR WRITE
FOR i ← 1 TO 5
INPUT item
WRITEFILE "data.txt", item
NEXT i
CLOSEFILE "data.txt

■ File Read
OPENFILE "data.txt" FOR READ
WHILE NOT EOF("data.txt")
READFILE "data.txt", item
OUTPUT item
ENDWHILE
CLOSEFILE "data.txt
■ Trace Table Example (Average Calculator)
Algorithm (Average of 3 numbers):
count ← 0
total ← 0
FOR i ← 1 TO 3
INPUT number
total ← total + number
count ← count + 1
NEXT i
average ← total / count
OUTPUT average

i number total count


1 4 4 1
2 6 10 2
3 8 18 3
average = 18 / 3 = 6 OUTPUT = 6

You might also like