Data Types / Binary Flashcards

1
Q

primitive data type

A

a basic data type provided by the programming language as a basic building block

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

types of primitive data types (5)

A
  • integer
  • real/float
  • boolean
  • character
  • string
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

denary

A

base 10 number. uses the combination of ten symbols to represent any number

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

binary

A

base 2 number. uses the combination of 2 symbols (0 or 1) to represent every number

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

hexadecimal

A

based 16 number. uses the combination of 16 symbols (10 numbers and 6 letters) to represent every number

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

why use hexadecimal?

A
  • easier to read/ remember
  • quicker to write/type
  • less chance of making an error
  • easy to convert
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

uses of hex

A
  • define colours
  • in MAC addresses
  • in assembly language and machine code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

integer

A

any positive or negative whole number e.g. 3, 0, -14

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

real (floating point)

A

a positive or negative number with a fractional component e.g. 0.002 or -1.98

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

character

A

Any single letter, symbol, number, character or control character

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

string

A

any combination of letters, symbols, numbers, characters or control characters e.g. Hello, £4.56

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Boolean

A

Any true/ false data types which often represent logical situations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Sign magnitude most significant bit

A

represents + or -
+ = negative
- = positive

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

0.1

A

positive

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

1.0

A

negative

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

fixed point binary

A

positive of the binary point is fixed on the number line

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

by changing the position of the binary point you can…

A

increase the size of the number

increase the accuracy of the number

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

mantissa

A

the actual number you want to store

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

exponent

A

positive of the binary point is fixed on the number line

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

how to convert floating point binary to denary

A

1) First work out the denary number in the exponent which tells us that the binary point moves ‘n’ places to the right
2) Write out a new binary weighting line with the point in the right place and then convert into denary

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Binary -> denary positive exponent

A

right

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Binary -> denary negative exponent

A

left

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

in two’s complement the sign is stored in

A

the most significant bit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

normalising a number

A

means that there is only one way to represent the number

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

advantage of normalisation

A

it stores the most accurate version of that number.

26
Q

Bitwise manipulation

A

bitwise shifts and masks

27
Q

Bitwise shifts can be used …

A

to change numbers quickly

28
Q

Masks can be used …

A

to set and toggle specific bits in a larger sequence.

29
Q

toggle

A

swap to the opposite

30
Q

What is bitwise manipulation useful for?

A
  • Compression Algorithms
  • networks (protocols. routing packets)
  • multiplication and division
31
Q

What does a bitwise left shift do?

A

multiplies the number by 2.

32
Q

What happens to bits falling off the end on a bitwise left shift?

A

If any bits fall off the end it is just lost and the empty place on the left is replaced with a 0

33
Q

What does a bitwise right shift do?

A

divides the number by 2.

34
Q

What happens to bits hat fall off the end with a bitwise right shift

A

If any bits fall off the end it is just lost and you back fill with 1s

35
Q

how does arithmetic (signed) right shift work?

A

shift everything to the right and backfill the space with 1s

36
Q

how does circular shifting work?

A

you shift either way and the left over bit circles back around to the beginning.

37
Q

What is a mask?

A

A mask allows you to isolate, extract, toggle and set bit values in a sequence of bits.

38
Q

Bitwise ANDing …

A

extracts a subset of the bits in a value

when the mask is a 1 it retains the value however when the mask is a 0 it outputs just 0s meaning only certain values are extracted.

39
Q

Bitwise ORing …

A

sets a subset of the bits in the value

you use 1s where you want to set values and 0s when you want to leave them alone

40
Q

Bitwise XORing…

A

toggles a subset of the bits in the value

when you use a 1 the bianry is toggled/ switched around and 0s there is no impact

41
Q

When is Bitwise ANDing useful?

A

useful for TCP/IP and routing

42
Q

toggle a subset of bits

A

Bitwise XORing

43
Q

set a subset of bits

A

Bitwise ORing

44
Q

extract a subset of bits

A

Bitwise ANDing

45
Q

What does ASCII stand for

A

American Standard Code for Information Interchange

46
Q

What are the two most common character sets?

A

ASCII and Unicode

47
Q

What are character sets needed for?

A

needed so that a document which is made on one computer is still readable on another computer. Computers can have more than one character set installed.

48
Q

What is a more complex data type called?

A

composite types

49
Q

array

A

allows you to store multiple items of the same data type under a shared common name

50
Q

subtract binary numbers

A

two complement one and then add

51
Q

how to twos complement a number

A

from right to left move until you hit a 1. all the subsequent bits should be swapped.

52
Q

How are character sets used to represent text?

A

When character in the set has a corresponding binary value which is a set number of bits. These are stored in a sequence that represents a word etc.

53
Q

more bits in the mantissa…

A

improves the accuracy but reduces the range

54
Q

more bits in the exponent…

A

improves the range but reduces accuracy

55
Q

how to normalise a number:

A
  1. see how many places the binary point has to move so the number starts 01 or 10
  2. store this number in the exponent and then new format of the number in the exponent
56
Q

normalising a negative binary number

A

back fill with 1s at the high end and 0s at the low end

57
Q

normalising a positive binary number

A

back fill with 0s

58
Q

normalising:

moving the point to the right

A
  • exponent
59
Q

normalising:

moving the point to the left

A

+ exponent

60
Q

why is twos complement better than sign magnitude

A

it easy to complete calculations with twos complement

61
Q

How does the size of the mantissa and exponent effect the number

A

the larger the mantissa the more accurate

the large the exponent the larger the range of numbers that can be represented