Unit 7: Programming Flashcards
What are the 5 data types needed for programming languages?
Integer, Real/Float, Boolean, Character, String
What is the code, characteristics and examples of an Integer?
Code: int
Characteristics: Whole number only
Examples: 0, 6, 102, -984
What is the code, characteristics and examples of a Real/Float?
Code: real
Characteristics: Numbers that have a decimal
Examples: -0.15, 100.0
What is the code, characteristics and examples of a Boolean?
Code: bool
Characteristics: Can only take one of two values (usually true/false)
Examples: True/False, Yes/No, 1/0
What is the code, characteristics and examples of a character?
Code: char
Characteristics: A single letter, number or symbol
Examples: A, k, 5, &
What is the code, characteristics and examples of an String?
Code: string
Characteristics: Used to represent text, it is a collection of characters
Examples: “Fs5tQR$”, “hi9)27S”
How much memory does each Data Type require?
Integer: 2 bytes or 4 bytes
Real: 4 bytes or 8 bytes
Boolean: 1 bit is needed but a byte is usually used
Character: 1 byte
String: 1 byte for every character in the string
ARRAYS
Info on CGP Page 94/95