Data types and structures

0.0(0)
studied byStudied by 1 person
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/101

flashcard set

Earn XP

Description and Tags

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

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

102 Terms

1
New cards

why are data types important

helps the computer and the user understand the information

2
New cards

what data type is for numbers

integer

3
New cards

what data type is for one letter or one symbol

char

4
New cards

what data type is for mainly words

string

5
New cards

what data type is for decimal

real

6
New cards

what data type is for yes and no or true and false

Boolean

7
New cards

what data type is for a specific date

date

8
New cards

what data type would you for your name

string

9
New cards

what data type would you use for the number of children in a class

integer

10
New cards

what data type would you use for the time taken to run a race

date/time

11
New cards

what data type would you use for whether a door is opened or closed

boolean

12
New cards

what data type would you use for your birthday

date

13
New cards

what is a record

composite date type comprising several related items

14
New cards

what is a random file

file that stores records at specific addresses that can be accessed directly

15
New cards

what is a binary file

where we store records serially or sequentially

16
New cards

what do we use files for

store and read lines of text

17
New cards

what do text files allow you to write

strings in serial or sequential manner

18
New cards

where can you append strings to a file

at the end of the file

19
New cards

what does this do(pseudocode): OPENFILE <filename> FOR WRITE

create a file and open it for writing

20
New cards

what does this do(pseudocode):OPENFILE <filename> FOR APPEND

open a file in append mode

21
New cards

what does this do(pseudocode): OPENFILE <filename> for read

open a file for reading

22
New cards

what does this do(pseudocode): OPENFILE <filename> FOR RANDOM

open a file for random acces

23
New cards

what does this do(pseudocode): CLOSEFILE <filename>

close a file

24
New cards

what does this do(pseudocode): PUTRECORD <filename>, <identifier>

write a record to a file

25
New cards

what does this do(pseudocode): GETRECORD <filename>, <identifier>

read a record from a file

26
New cards

what does this do(pseudocode): SEEK <filename>, <address>

move to a specific disk address within the file

27
New cards

what does this do(pseudocode): EOF(<filename>)

test for end of file

28
New cards

What is going on here?

Dim fileNum As Integer = FreeFile()
FileOpen(fileNum, "filename.txt", OpenMode.Output)

create a file and open for writing

29
New cards

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

30
New cards

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

31
New cards

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

32
New cards

What is going on here?

FileClose(fileNum) 

closing a file

33
New cards

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

34
New cards

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

35
New cards

What is going on here?

Seek(fileNum, address)

moving to a specific position (random access)

36
New cards

What is going on here?

If EOF(fileNum) Then
    Console.WriteLine("End of file reached.")
End If

testing for the end of a file

37
New cards

what does lineinput(filenum) do

reads one line

38
New cards

what is append mode

opening a file so that new data is added to the end of the existing content in the file

39
New cards

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

40
New cards

uses for append mode

saving user input over multiple sessions

41
New cards

what kind of array does random-access file processing use

fixed-length records

42
New cards

why does random-access file processing use fixed-length records

allows computer to directly calculate the position of any record in the file

43
New cards

what does random-access file processing do

store each record in a binary file as the record is created

44
New cards

what can a hashing function calculate

address from the record key and store the record at the calculated address

45
New cards

what does READ do in file handling

read data from the file

46
New cards

what does WRITE do in file handling

writes data to the file

47
New cards

what is the disadvantage of using WRITE when you opened a file

overwrites the data

48
New cards

what is a positive when using APPEND when opening a file

does not overwrite the data

49
New cards

what does APPEND do in file handling

adds data to the end of the file i

50
New cards

is a 1D array a list or table

list

51
New cards

is a 2D array a list or table

table

52
New cards

what is a flowline for

shows the process’ direction. connects two blocks

53
New cards

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

54
New cards

what is an identifier

a unique name applied to an item of data

55
New cards

what is a record data type

a composite data type comprising of several related items that may be of different data types

56
New cards

what is a composite data type

data type constructed using several of the basic data types available in a praticular language

57
New cards

what is an array

a data structure containing several elements of the same data type

58
New cards

what is an array index

a numerical indicator of an item of data' positions in an array

59
New cards

what is a lower bound

index of the first element in an array

60
New cards

what is an upper bound

the index of the last element in an array

61
New cards

what is linear search

a method of searching in which each element of an array is checked in order

62
New cards

what is bubble sort

method of sorting data in an array into ascending or decending order

63
New cards

what is a file

collection of data stored by a computer program to be used again

64
New cards

how does bubble sort work

swapping adjacent pairs of values that are compared and swapped

65
New cards

what does linear search help with

check each element of an array in turn for required value

66
New cards

what is a 1D array

list

67
New cards

what is a 2D array

table

68
New cards

what is a primitive data type

variables that can be definded simply by commans built into the programming language

69
New cards

what is also know as an atomic data type

primitive data type

70
New cards

what is an INTEGER

a single whole number

71
New cards

what is a REAL

a single number with a decimal point

72
New cards

what is a CHAR

a single character

73
New cards

what is a STRING

a sequence of zero or more character

74
New cards

what is a BOOLEAN

the logical values TRUE and FALSE

75
New cards

what is a DATE

data consisting of day, month, year

76
New cards

what is an empty string

data of type string with no characters stored in it

77
New cards

what is a structured type

sequence of characters

78
New cards

what kind of data type is a record

user-defined

79
New cards

give an example of an atomic data type

primitive data type

80
New cards

which data type is TECHNICALLY not a primitive data type

string

81
New cards

what are the types of data types

composite, user defined and primitive

82
New cards

what is an atomic data type

basic type of data that cannot be broken down into simpler components

83
New cards

what are features of atomic data types

single value, directly supported in languages, fixed memory blocks

84
New cards

what are the advantaged or atomic data types

efficient, build complex composite types, good for basic computations

85
New cards

what is a user-defined data type

custom data type created to model a specific entity or structure

86
New cards

what does UDT stand for

user-defined data type

87
New cards

what is the structure of a UDT

combination of multiple primitive data types into a single logical unit

88
New cards

what are the features of an UDT

custom structure, abstraction, reusability

89
New cards

what makes UDTs reusable

defined once

90
New cards

where can you use UDTs

complex systems based on real-world entities

91
New cards

what makes primitive data types built-in

directly supported by a programming language

92
New cards

what is the syntax of UDTs

defining using type declarations

93
New cards

benefits of UDTs

readability, reduced redundancy

94
New cards

how do you access a 1D array

loop

95
New cards

how do you access a 2D array

nesteed loop

96
New cards

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

97
New cards

why would declare a record as an array

works when used for several sets of data all part of one particular use

98
New cards

what application (Windows) do we use when making a code for file handling

NotePad

99
New cards

what is a text file

sequence of characters formatted into lines

100
New cards

what happens when you have a code that isn’t saved in a file

lose data when program stops