Topic 6 of 8 · Form 3
Programming concepts
Integer, real, char, string and Boolean; declaring and assigning variables and constants.
Notes for this topic 1 file, in order
Create a free account to download PDFs.
Variables, constants and data types
Integer, real, char, string and Boolean; declaring and assigning variables and constants.
Input and output
INPUT and OUTPUT statements.
Programming constructs
Sequence, selection (IF … THEN … ELSE … ENDIF; CASE OF … OTHERWISE … ENDCASE) and iteration (FOR … NEXT – count-controlled; REPEAT … UNTIL – post-condition; WHILE … DO … ENDWHILE – pre-condition).
Operators
Arithmetic (+, −, *, /, ^, MOD, DIV), logical (=, <>, <, >, <=, >=) and Boolean (AND, OR, NOT).
String handling
LENGTH, SUBSTRING, UCASE and LCASE.
Procedures and functions
Defined with parameters; functions return values; local and global variables; library routines (ROUND, RANDOM).
Arrays
One- and two-dimensional arrays; iterating with nested loops.
Worked example: Pseudocode to total the values in a 1D array Scores[1:30].
Total ← 0
FOR Index ← 1 TO 30
Total ← Total + Scores[Index]
NEXT Index
File handling
Opening, reading, writing and closing text files.
Maintainable programs
Meaningful identifiers, comments, procedures and functions.
Check yourself
- Which loop is guaranteed to run at least once?
- What is the value of 17 DIV 5?
- Write a statement to output the first three characters of a string Name.
Show answers
- REPEAT … UNTIL.
- 3
- OUTPUT SUBSTRING(Name, 1, 3)
Questions about this topic (0)
No questions about this topic yet.
Sign in or create a free account to join in.