Data Types (1.4.1) Flashcards
What are the five main data types?
- Character
- String
- Boolean
- Integer
- Real
What is an integer?
A whole number with no fractional part.
e.g. 6, -12, 451 , 0
What is a real number/float?
Numbers which can have a fractional part.
e.g. 0, -71.5, 5.01
What is a character?
A single letter, digit, symbol or control code
e.g. R, g, 7, &
What is a string?
A collection of characters.
e.g. “Hello world!”, “07789”
What is a boolean data type?
Can take one of two values (TRUE or FALSE)
How are data types represented in the computer?
Using binary (0s and 1s)
What is binary?
A number system in base 2 where each step represents a value of 2x the previous place
What is a bit?
A single binary digit
What is a byte?
Eight bits
What is a nybble?
Half a byte of four bits
Binary addition:
0+0+0=
0
Binary addition:
0+0+1=
1
Binary addition:
0+1+1=
10
Binary addition:
1+1+1=
11
Conjunction (AND)
gate: =|}-
symbol: ^
needs both inputs to be 1
Disjunction (OR)
gate: =)}-
symbol: v
needs one or both inputs to be 1
Negation (NOT)
gate:=|>.-
symbol: ¬
reverses the input i.e. 0 to 1, 1 to 0
Exclusive Disjunction (XOR)
gate: =))}-
symbol: ⊻
needs one input to be true only, not when both are