02 Section 5 - Data types, operators,constants, variables and strings Flashcards
What are the main five data types of programming languages?
Integer Real (or float) Boolean Character String
What is the pseudocode for Integer data type?
INT
What is the pseudocode for Real data type?
REAL
What is the pseudocode for boolean data type?
BOOL
What is the pseudocode for character data type?
CHAR
What is the pseudocode for string data type?
STRING
What is the characteristics of the integer data type?
Whole numbers only
What is the characteristics of the real data type?
Numbers that have a decimal part
What is the characteristics of the boolean data type?
Can only take one of two values, usually TRUE or FALSE
What is the characteristics of the character data type?
A single letter, number, symbol
What is the characteristics of the string data type?
Used to represent text, it is a collection of characters
What are the features of the different types of data types?
- different data types are allocated different amounts of memory
- using correct data types make code more memory efficient, robust and predictable
What are weakly typed programming languages?
Languages that will try to convert data types to avoid errors, however this can lead to unpredictable errors
What are strongly typed programming languages?
Languages that won’t try to convert data types and so will produce more errors but more predictable results
How much memory does an integer data type take up?
2/4 bytes
How much memory does a real data type take up?
4/8 bytes
How much memory does a boolean data type take up?
1 bit is needed but 1 byte is normally used
How much memory does a character data type take up?
1 byte
How much memory does a string data type take up?
1 byte for every character in the string
What is casting?
Changing the data type
-languages have functions that let yopu manually convert between data types
What commands can you use to convert between data types?
int()
float()
bool()
str()
What commands can you use top convert between ASCII numbers and characters?
ASC()
CHR()