Data Types Flashcards
All 8 cards in this deck
Name the five data types used in AQA pseudo-code.
Integer, real (float), Boolean, character and string.
What data is stored by the integer data type?
A whole number, positive or negative.
e.g. 11What data is stored by the real (float) data type?
A number that can have a decimal/fractional part.
e.g. 18.2What data is stored by the Boolean data type?
One of two values: true or false.
What is the difference between the character and string data types?
A character is a single letter, digit or symbol; a string is a sequence of characters.
True or false? A telephone number should be stored as an integer.
False. It should be a string, because leading zeros must be kept and no arithmetic is done on it.
Why is it important to choose the correct data type for a variable?
So the data behaves as intended and the program is robust. With the wrong type, code can crash or give wrong output, e.g.
"4" + "2"joins two strings to give"42"instead of adding to 6.What is a data type?
The kind of data a variable or value holds, e.g. integer or string. It decides which values can be stored and which operations can be carried out on them.