1/101
Cambrdige AS level computer science 2025. Textbook references: Cambridge International AS and A level computer science coursebook Sylvia Langfield, David Duddell 2019 press ||| Cambrdige International AS and A Levels Computer science by David Wastson, Helen Williams press 2019
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
why are data types important
helps the computer and the user understand the information
what data type is for numbers
integer
what data type is for one letter or one symbol
char
what data type is for mainly words
string
what data type is for decimal
real
what data type is for yes and no or true and false
Boolean
what data type is for a specific date
date
what data type would you for your name
string
what data type would you use for the number of children in a class
integer
what data type would you use for the time taken to run a race
date/time
what data type would you use for whether a door is opened or closed
boolean
what data type would you use for your birthday
date
what is a record
composite date type comprising several related items
what is a random file
file that stores records at specific addresses that can be accessed directly
what is a binary file
where we store records serially or sequentially
what do we use files for
store and read lines of text
what do text files allow you to write
strings in serial or sequential manner
where can you append strings to a file
at the end of the file
what does this do(pseudocode): OPENFILE <filename> FOR WRITE
create a file and open it for writing
what does this do(pseudocode):OPENFILE <filename> FOR APPEND
open a file in append mode
what does this do(pseudocode): OPENFILE <filename> for read
open a file for reading
what does this do(pseudocode): OPENFILE <filename> FOR RANDOM
open a file for random acces
what does this do(pseudocode): CLOSEFILE <filename>
close a file
what does this do(pseudocode): PUTRECORD <filename>, <identifier>
write a record to a file
what does this do(pseudocode): GETRECORD <filename>, <identifier>
read a record from a file
what does this do(pseudocode): SEEK <filename>, <address>
move to a specific disk address within the file
what does this do(pseudocode): EOF(<filename>)
test for end of file
What is going on here?
Dim fileNum As Integer = FreeFile()
FileOpen(fileNum, "filename.txt", OpenMode.Output)
create a file and open for writing
What is going on here?
Dim fileNum As Integer = FreeFile()
FileOpen(fileNum, "filename.txt", OpenMode.Append)
PrintLine(fileNum, "New data")
opening a file in append mode
What is going on here?
Dim fileNum As Integer = FreeFile()
FileOpen(fileNum, "filename.txt", OpenMode.Input)
Dim line As String
Do While Not EOF(fileNum)
line = LineInput(fileNum)
Console.WriteLine(line)
Loop
opening a file for reading
What is going on here?
Dim fileNum As Integer = FreeFile()
Dim recordLength As Integer = Len(New Student())
FileOpen(fileNum, "students.dat", OpenMode.Random, , , recordLength)
opening a file for random access
What is going on here?
FileClose(fileNum)
closing a file
What is going on here?
Dim student As Student
student.Name = "Alice"
student.ID = 101
FilePut(fileNum, student, recordNumber)
writing a record to a file
What is going on here?
Dim student As Student
FileGet(fileNum, student, recordNumber)
Console.WriteLine($"Name: {student.Name}, ID: {student.ID}")
reading a record from a file
What is going on here?
Seek(fileNum, address)
moving to a specific position (random access)
What is going on here?
If EOF(fileNum) Then
Console.WriteLine("End of file reached.")
End If
testing for the end of a file
what does lineinput(filenum) do
reads one line
what is append mode
opening a file so that new data is added to the end of the existing content in the file
what is sequential file processing
a way of saving records on a disk before the program quits in order so you don’t lose the data
uses for append mode
saving user input over multiple sessions
what kind of array does random-access file processing use
fixed-length records
why does random-access file processing use fixed-length records
allows computer to directly calculate the position of any record in the file
what does random-access file processing do
store each record in a binary file as the record is created
what can a hashing function calculate
address from the record key and store the record at the calculated address
what does READ do in file handling
read data from the file
what does WRITE do in file handling
writes data to the file
what is the disadvantage of using WRITE when you opened a file
overwrites the data
what is a positive when using APPEND when opening a file
does not overwrite the data
what does APPEND do in file handling
adds data to the end of the file i
is a 1D array a list or table
list
is a 2D array a list or table
table
what is a flowline for
shows the process’ direction. connects two blocks
what is a data type
a classification attributed to an item of data which determine the types of value it can take and how it can be used
what is an identifier
a unique name applied to an item of data
what is a record data type
a composite data type comprising of several related items that may be of different data types
what is a composite data type
data type constructed using several of the basic data types available in a praticular language
what is an array
a data structure containing several elements of the same data type
what is an array index
a numerical indicator of an item of data' positions in an array
what is a lower bound
index of the first element in an array
what is an upper bound
the index of the last element in an array
what is linear search
a method of searching in which each element of an array is checked in order
what is bubble sort
method of sorting data in an array into ascending or decending order
what is a file
collection of data stored by a computer program to be used again
how does bubble sort work
swapping adjacent pairs of values that are compared and swapped
what does linear search help with
check each element of an array in turn for required value
what is a 1D array
list
what is a 2D array
table
what is a primitive data type
variables that can be definded simply by commans built into the programming language
what is also know as an atomic data type
primitive data type
what is an INTEGER
a single whole number
what is a REAL
a single number with a decimal point
what is a CHAR
a single character
what is a STRING
a sequence of zero or more character
what is a BOOLEAN
the logical values TRUE and FALSE
what is a DATE
data consisting of day, month, year
what is an empty string
data of type string with no characters stored in it
what is a structured type
sequence of characters
what kind of data type is a record
user-defined
give an example of an atomic data type
primitive data type
which data type is TECHNICALLY not a primitive data type
string
what are the types of data types
composite, user defined and primitive
what is an atomic data type
basic type of data that cannot be broken down into simpler components
what are features of atomic data types
single value, directly supported in languages, fixed memory blocks
what are the advantaged or atomic data types
efficient, build complex composite types, good for basic computations
what is a user-defined data type
custom data type created to model a specific entity or structure
what does UDT stand for
user-defined data type
what is the structure of a UDT
combination of multiple primitive data types into a single logical unit
what are the features of an UDT
custom structure, abstraction, reusability
what makes UDTs reusable
defined once
where can you use UDTs
complex systems based on real-world entities
what makes primitive data types built-in
directly supported by a programming language
what is the syntax of UDTs
defining using type declarations
benefits of UDTs
readability, reduced redundancy
how do you access a 1D array
loop
how do you access a 2D array
nesteed loop
why do you need to use a nested loop when accessing a 2D array
you need to access columns to be able to access rows
why would declare a record as an array
works when used for several sets of data all part of one particular use
what application (Windows) do we use when making a code for file handling
NotePad
what is a text file
sequence of characters formatted into lines
what happens when you have a code that isn’t saved in a file
lose data when program stops