Data Types Flashcards

All 9 cards in this deck

Name the five data types you must know for OCR GCSE Computer Science.

Integer, real (float), Boolean, character and string.

What data is stored by the integer data type?

A whole number, positive or negative.
e.g. 11

What data is stored by the real (float) data type?

A number that can have a decimal/fractional part.
e.g. 18.2

What 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.

What is casting?

Temporarily converting data from one data type to another.
e.g. int("25") converts a string to an integer.

Why is casting often needed after using input()?

input() returns a string, so it must be cast (e.g. to an integer) before it can be used in a calculation.

Which casting functions convert a value to an integer, to a real and to a string?

int(), float() / real() and str().

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.