Data Types and Structures
Choosing the right container: simple types, records, arrays and files.
RUN THE PSEUDOCODE
Write the pseudocode your syllabus uses and press Run. Assignment is the arrow — type <- and it works the same as ←. Both syllabuses are accepted, so OUTPUT and PRINT both work; where a word differs from the one the exam prints, the runner says so.
Press Run to see what it doesTotal ← 0
FOR Count ← 1 TO N
Total ← Total + Count
NEXT Count
OUTPUT TotalSTARTN = 5
| Count | Total | OUTPUT |
|---|---|---|
One row per pass through the loop. Leave a cell blank if it does not change on that pass.
//Records group related fields
A record lets one variable hold several different types that belong together — far clearer than parallel arrays.
TYPE Student
DECLARE Name : STRING
DECLARE Age : INTEGER
DECLARE Grade : CHAR
ENDTYPE
DECLARE Class : ARRAY[1:30] OF Student
Class[1].Name ← "Bat"
Class[1].Age ← 14//File organisation
Serial: records in the order they arrived, no order — used for transaction logs. Sequential: records kept in key order — good for processing everything in order. Random (direct): the position is calculated from the key, so any record can be reached immediately — used when fast individual lookups matter.
CHECK YOURSELF
1.Why use a record rather than several parallel arrays?
2.Which file organisation lets you jump straight to a record without reading the others?
3.A transaction log written in the order events happened is which organisation?