Programming Basics - Data Types Flashcards
1
Q
5 main data types
A
Integer
Real
Boolean
Character
String
Using correct data types makes code more memory efficient, robust
2
Q
Data type: Integer
A
Whole number
‘int’
3
Q
Data type: Real
A
Decimals
‘real’
4
Q
Data type: Boolean
A
Can take one of two values: e.g. true or false
‘bool’
5
Q
Data type: Character
A
A single letter, character, symbol
‘char’
6
Q
Data type: String
A
To represent text
‘string’
7
Q
Size of integer
A
2 bytes
8
Q
Size of real
A
4 bytes
9
Q
Size of boolean
A
1 byte
10
Q
Size of character
A
1 byte
11
Q
Size of string
A
1 byte per character
12
Q
Casting
A
Functions to manually convert between data types
e.g. int(), real(), bool(), str()