Data Types Flashcards

1
Q

What is meant by 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

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

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

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

what is a 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

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

What is a 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

what is a 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

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

What is ASCII?

A

American Standard Code. For Information Interchange

7 bit standard ASCII is able to represent 128 different characters

MSB is set to 0

128 unused code points

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

What is extended ASCII?

A

Makes use of remaining 128 codes

represents special characters

many different extended ASCII code sets

useful for representing different languages

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

What is Unicode?

A

ASCII uses 1 byte per character, so can only store 256 characters
some languages have > 12,000 characters
Unicode uses 2 bytes per character
This equates to 65,536 different characters
Eliminates the need for extended character sets
Extended Unicode uses 21 bits allowing us to represent dead languages

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

What are sound cards?

A
  • Translate analogue sound into digital signals for the computer to understand
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

How are sound waves converted so a computer can understand them?

A

Converted via equipment such as microphone into voltage changes

Changing voltage is sampled at intervals, sample rate

Sampled values converted into binary

Collection of binary values stored as a sound file

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

What is a digital analogue converter?

A

Stored sound data recreated using DAC

Binary numbers converted back into a varying voltage

When the voltage is fed to a speaker driver it results in vibrations which reproduce the sound

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

What is the sampling rate?

A

Number of samples taken per second (from analogue sound waves)

Measured in hertz (44.1 KHz for an audio CD)

Higher sample rates means the closer the match between the original analogue sound waves and digital version. However more processing power is required to manipulate data and the file size will be larger

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

What is the bit rate?

A

Number of memory bits used to store each sample per given time period

Higher bit rate = larger file

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

What is a bitmap image?

A

Groups of pixels

colour of each pixel stored as binary code

Becomes pixelated when enlarged. The pixels are larger and more visible

To store large or high res images a bitmap needs to store more information and the size of the file increases with size and resolution

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

What is the colour depth?

A

The number of bits used for each pixel

More bits per pixel means bigger size

More combinations of pixels means more colours possible

1 bit/pixel = 2 possible colours

24 bit / pixel = 16 million possible colours

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

What are vector graphics?

A

Stored as set of instructions
How to draw each shape
Geometric shapes, logos and text
When enlarged, entire image is redrawn
No pixelation occurs. Smooth rescaling
Usually smaller files sizes
Size of file it not affected by size of image as the definition for the primitive shapes and control points remain unchanged

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

What is metadata?

A

Information about the image that allows the computer to interpret the stored binary accurately to reproduce the image.
Contains width, height and colour depth

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

What is the resolution of an image?

A

-The number of pixels per unit (ppi)

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

What is hex?

A

Short form of binary that is easy to remember

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

How do you add FLPB?

A

1-convert exponent back to SF
2-Reverse the exponent
3-add like normal binary

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

How do you sub FLPB?

A

1-convert exponent back to SF
2-reverse the exponent
3-make both mantissas the same size
4-convert the negative using 2’s compliment
5-add one to the negative value
6-add like normal binary

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

What does shifting do?

A

logical shift moves each binary value left or right with any voids being filled with a 0
shift to the left by 2 = value*4
shift to right by 2 = value/4

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

What is a mask? (Bitwise manipulation)

A

-bits in the mask chosen to manipulate the bits in the operand, allowing them through or blocking them

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

What does the ALU use NOT operations for?

A

-NOT = creates a ones compliment value (all 1’s switch to 0’s and vise versa)

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

What does the ALU use AND operations for?

A

-AND = can be used to return bits by using a 1 in the mask or exclude bits by using a 0. Useful for checking conditions stored in a binary value

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

What does the ALU use OR operations for?

A

-OR = can be used to reset particular bits in the binary value. 1 will set the bit to 1, and using a 0 will return the matching bit in the original value

34
Q

What does the ALU use the XOR operation for?

A

-XOR = can be used to check if corresponding bits in two binary values are the same

35
Q

What do we use bitwise manipulation/shift operations for?

A

to manipulate binary values

To normalise the mantissa by moving the binary point in front of the first significant bit

If we employ a mask we can tell if this has happened. Masking with 01000000 using the AND operator will tell us if there is a 1 in the second bit from the left

36
Q

What is another use for bitshifting? Example?

A

can be used for multiplication as its faster. Dedicated processors would take full advantage of this

shift to the left to * and to the right to /.
to work out 3*17 we would shift 3 (in binary) four places to the left then add 3

this is because 17=16+1 and in base 2, 16=2^4 then add 3 (value we are multiplying * by remainder when multiplier is converted to base 2)

37
Q

What data type should be used for storing a phone number like 07777777333?

A

String

  • Numeric types would remove the leading 0
38
Q

Perform an AND mask on the Binary numbers

10101101
01011011

A

00001001

39
Q

Add the two binary numbers and give answer in decimal

01011011
00111010

A

10010101

=

149

40
Q

What is the decimal 45 in binary?

Give your answer as a byte

A

00101101

41
Q

What is the hexadecimal 2E in decimal?

A

(2x16) + (14x1) = 46

42
Q

What is the hexadecimal 45 in binary?
Give your answer as a byte

A

01000101

43
Q

What is -5 in sign magnitude binary?

Give your answer as a nibble

A

1101

44
Q

What does the binary 01101100 represent in hex?

A

6C

45
Q

What is the effect of a logical shift left by one place?

A

The value is doubled (x2^1)

46
Q

What is the two’s complement binary 10101101 in decimal?

A

-83

47
Q

The binary 0011010000110 is a floating point number with a single-bit sign, 8 but mantissa and 4 bit exponent

What is the number in decimal?

A

52

48
Q

Perform a logical shift right by two places on the binary number 01101010 and convert your result to decimal

A

26.5

49
Q

Perform an XOR mask on the binary numbers:

01010101
10111011

A

11101110

50
Q

The binary 1100110000011 is a floating point number with a single-bit sign, 8-bit mantissa and 4 but exponent

What is the number in decimal?

A

-9.5

51
Q

Sign magnitude most significant bit

A

represents + or -
+ = negative
- = positive

52
Q

0.1 (sign of magnitude)

A

positive

53
Q

1.0 (sign of magnitude)

A

negative

54
Q

fixed point binary

A

positive of the binary point is fixed on the number line

55
Q

fixed point binary

A

positive of the binary point is fixed on the number line

56
Q

by changing the position of the binary point you can…

A

increase the size of the number

increase the accuracy of the number

57
Q

mantissa

A

the actual number you want to store

58
Q

exponent

A

positive of the binary point is fixed on the number line

59
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

60
Q

Binary -> denary positive exponent

A

right

61
Q

Binary -> denary negative exponent

A

left

62
Q

in two’s complement the sign is stored in

A

the most significant bit

63
Q

normalising a number

A

means that there is only one way to represent the number

64
Q

advantage of normalisation

A

it stores the most accurate version of that number.

65
Q

What is bitwise manipulation useful for?

A

Compression Algorithms
networks (protocols. routing packets)
multiplication and division

66
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

67
Q

What does a bitwise right shift do?

A

divides the number by 2.

68
Q

What does a bitwise left shift do?

A

multiplies the number by 2

69
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

70
Q

how does arithmetic (signed) right shift work?

A

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

71
Q

how does circular shifting work?

A

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

72
Q

When is Bitwise ANDing useful?

A

useful for TCP/IP and routing

73
Q

toggle a subset of bits

A

Bitwise XORing

74
Q

set a subset of bits

A

Bitwise ORing

75
Q

extract a subset of bits

A

Bitwise ANDing

76
Q

why is twos complement better than sign magnitude

A

it easy to complete calculations with twos complement

77
Q

how to convert a denary number into normalised floating-point binary.

A

if a number is positive it should end up as 0.1…
if a number is negative it should end up as 1.0…

1.1101 011

1.) Split the mantissa and exponent up (work out exponent) (3)
2.)Move the decimal point, so it ends up with 1.0 and count the floats the decimal takes (2)
3.) The exponent is the original value - the amount of times the decimal had to float (3-2)
4.) Answer
1.0100 001

78
Q

how to convert a decimal number into normalised floating-point binary.

A

If the binary has a 1.1 or a 0.0 then shift the decimal inside and then times it by 2 to the power of “n” (amount of times shifted inside).

79
Q

Turn the denary number 1.625 into normalised floating point (mantissa 5, exponent 3)

A
  1. turn to binary
    01.101
  2. Move the decimal to the most significant point and count how many times it has to float.. (1)
    0.1101 x2^1
  3. Exponent will be the number of times the decimal had to float in binary form
    0.1101 001
    —————–
80
Q

Turn the denary number -12.75 into floating point binary (mantissa 10, exponent 6)

A
  1. Turn to binary
    100011.01
  2. Move the decimal to the most significant point and count how many times it has to float.. (5)
    1.001101 x2^4
  3. Exponent will be the number of times the decimal had to float in binary form (6 long)
    1.001101 000100
  4. Add zeros to the end of mantissa, so its 10 long
    1.001101000 000100