Section 5 - Programming Flashcards
What is integer in pseudocode?
Int
What does an integer mean?
Whole numbers only
What is real (or float) in pseudocode?
real
What does real (or float) mean?
Numbers that have a decimal part
What is boolean in pseudocode?
bool
What does boolean mean?
Can only take one of two values, usually TRUE or FALSE
What is character in pseudocode?
char
What does character mean?
A single letter, number, symbol
What is string in pseudocode?
string
What does string mean?
Used to represent text, it is a collection of characters
What are the different data types?
Integer, real, boolean, character, string
How much memory is an integer usually allocated?
2 bytes or 4 bytes
How much memory is real usually allocated?
4 bytes or 8 bytes
How much memory is boolean usually allocated?
1 bit is needed but usually 1 byte is used
How much memory is a character usually allocated?
1 byte
How much memory is a string usually allocated?
1 byte for every character in the string
Why is it important to use the correct data types?
It makes code more memory efficient, robust and predictable
What is casting?
Manually converting between data types by using functions
Which commands can be used for casting?
int(), float(), bool(), str()