data types

studied byStudied by 0 people
0.0(0)
Get a hint
Hint

what is an integer?

1 / 30

31 Terms

1

what is an integer?

  • a whole number

  • zero is an integer

  • negative numbers are integers

  • can’t have a fractional part

New cards
2

what are real/floating point numbers?

  • any positive or negative numbers

  • can, but do not necessarily, have a fractional part

  • useful for measuring things

  • all integers are real numbers

New cards
3

what is a character?

  • a single symbol used by a computer

  • the letters A to Z

  • the numbers 0 to 9

  • symbols like %, £, and #

New cards
4

what is a string?

  • a collection of characters

  • can be used to store a single character

  • can also be used to store many characters in succession

  • useful for storing text

  • don’t cut off leading 0s like numeric types (floats/ints)

New cards
5

what is a boolean value?

  • values restricted to True or False

  • useful for recording data that can only take two values

New cards
6

what is a bit?

a single binary digit

New cards
7

what is a byte?

eight bits

New cards
8

what is a nybble?

half a byte // four bits

New cards
9

what is the most significant bit?

the bit furthest to the left

New cards
10

how do you make a number negative by using the sign and magnitude method?

add a leading 1 to signify a negative number

New cards
11

how do you make a number negative by using the two’s complement method?

  • take the positive binary number and ‘flip‘ all the bits

  • then add 1

New cards
12

what are the four rules of binary addition?

  1. 0 + 0 = 0

  2. 0 + 1 = 1

  3. 1 + 1 = 10

  4. 1 + 1 + 1 = 11

New cards
13

how do you perform binary subtraction?

  • subtracting a number from another is the same as adding a negative number

  • to subtract in binary, use binary addition with a negative two’s complement number

New cards
14

how do you convert a hexadecimal number into a binary number?

  • first convert any hexadecimal characters to a decimal number

  • convert each number to a binary nybble

  • combine the nybbles to form a single binary number

New cards
15

how do you convert a hexadecimal number into a denary number?

  • first convert to binary, and then convert from binary to decimal

  • alternatively, use the place values of hexadecimal to convert directly to denary (the nth place is equivalent to 16n)

New cards
16

what are the two components of a floating point binary number?

the mantissa and the exponent

New cards
17

what is the exponent?

  • a two’s complement number

  • part of a floating point number, shows the position of the decimal point in the number

  • it represents the number of places the decimal point should move forwards or backwards

    • if the exponent is positive the decimal point moves backwards

    • if the exponent is negative the decimal point moves forwards

New cards
18

what is the mantissa?

  • a two’s complement number

  • part of a floating point number, the number itself

  • it is always taken to have the binary point after the most significant bit

New cards
19

why do we normalise floating point numbers?

maximises precision in a given number of bits and ensures there is only one way to store any given number

New cards
20

how do you normalise a floating point number?

  • adjust the mantissa so that it starts with 01 for a positive number

  • adjust the mantissa so that it starts with 10 for a negative number

New cards
21

what is the effect of increasing the number of bits used for the mantissa?

can store more accurate numbers

New cards
22

what is the effect of increasing the number of bits used for the exponent?

can store a wider range of numbers

New cards
23

how do you add floating point numbers?

  • to add floating point binary numbers, their exponents need to be the same

  • then add the mantissas

  • finally, normalise the result if required

New cards
24

how do you subtract floating point numbers?

  • involves converting to two’s complement and adding

  • the exponents must be the same

  • make the number being subtracted negative using two's complement

  • then add the mantissas

New cards
25

what is a shift?

  • moving all of the bits in a binary number a specified number of places to the right or to the left

  • this can be thought of as adding a number of leading/trailing zeros

New cards
26

what is the affect of shifting a number n spaces left?

multiplication by 2n

New cards
27

what is the affect of shifting a number n spaces right?

division by 2n

New cards
28

what is a mask?

combining one or more binary numbers with a logic gate

New cards
29

what is a character set?

  • a published collection of codes that correspond to characters

  • can be used by computers for representing text

  • two widely used character sets are ASCII and Unicode

New cards
30

what is ASCII?

  • American Standard Code for Information Interchange

  • was the leading character set before Unicode

  • uses 7 bits to represent 27 (128) different characters

  • ASCII soon came into trouble when computers needed to represent other languages with different characters

New cards
31

what is Unicode?

  • a character set designed to solve the problem of ASCII’s limited character set

  • uses a varying number of bits allowing for over 1 million different characters

  • many characters are yet to be allocated

  • enough capacity to represent different languages, symbols, and emojis

New cards

Explore top notes

note Note
studied byStudied by 41 people
... ago
5.0(1)
note Note
studied byStudied by 56 people
... ago
5.0(1)
note Note
studied byStudied by 1 person
... ago
5.0(1)
note Note
studied byStudied by 18 people
... ago
5.0(1)
note Note
studied byStudied by 16 people
... ago
5.0(1)
note Note
studied byStudied by 19 people
... ago
5.0(1)
note Note
studied byStudied by 37 people
... ago
5.0(1)

Explore top flashcards

flashcards Flashcard (42)
studied byStudied by 2 people
... ago
5.0(1)
flashcards Flashcard (113)
studied byStudied by 27 people
... ago
5.0(1)
flashcards Flashcard (40)
studied byStudied by 14 people
... ago
5.0(1)
flashcards Flashcard (32)
studied byStudied by 47 people
... ago
5.0(1)
flashcards Flashcard (66)
studied byStudied by 1 person
... ago
5.0(1)
flashcards Flashcard (206)
studied byStudied by 27 people
... ago
5.0(1)
flashcards Flashcard (20)
studied byStudied by 3 people
... ago
5.0(1)
flashcards Flashcard (27)
studied byStudied by 116 people
... ago
5.0(1)
robot