3.3 Fundamentals Of Data Representation Flashcards

1
Q

What is a bit (b)?

A

A single binary digit (1/0) in a binary code

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

What is a byte (B)?

A

A group of 8 bits

- big enough to store 1 character

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

Order of byte sizes ( /1000 each time)

A
Byte (B)
Kilobyte (kB) (files)
Megabyte (MB)
Gigabyte (GB) (videos, storage)
Terabyte (TB)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the different number bases?

A
  • decimal (base 10)
    (Standard number system, base-10 = 10 different digits (0-9))
  • binary (base 2)
    (Used by computers to represent data/instructions, base-2 = 2 different digits (0/1)
  • hexadecimal (base 16)
    (Used regularly in programming, base-16 = uses combination of digits & letters to represent a number (0-9 & A-F)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Why must all data be converted into binary to be processed by a computer?

A

As computers only understand 1s and 0s

A bit pattern could represent different types of data (text, image, sound, integer)

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

Why do programmers often use hexadecimal when coding?

A
  • simpler to remember large numbers (shorter than binary numbers)
  • therefore less chance of input errors
  • easier to convert between binary & hex, then binary & decimal
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Draw an 8 bit table:

A

128 64 32 16 8 4 2 1

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

How do we convert from binary to decimal? Or read binary?

A
  • place values from right to left increase by powers of 2 eg:
    128 64 32 16 8 4 2 1
    0 0 1 1 0 1 0 1 = 53
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How do we convert from hexadecimal to decimal?

A
  • place values increase from right to left by powers of 16
    16 1
    8 D = (8x16=128) + (13x1=13) = 141
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What do hexadecimal digits represent?

A
0-9 = 0-9
A-F = 10-15
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How do we convert from decimal to binary?

A
  • draw table of binary place values then subtract from largest to smallest
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How do we convert from decimal to hexadecimal?

A

Draw table, and then divide with remainders from left to right Eg.
Decimal number = 106 / 16 = 6 r 10, 10 / 1 = 10 = A so
16 1
6 A
So 106 = 6A

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

How do we convert from binary to hexadecimal?

A
  1. Split binary numbers into nibbles (4 bits)
  2. Draw table with columns 1, 2, 4, 8 from right to left then repeat for amount of nibbles
  3. For each nibble, add up numbers with binary value 1 and convert value to hex
  4. Put hex values together
    Eg.
    8 4 2 1 8 4 2 1
    1 0 1 1 1 0 0 1
    8+2+1=11, 8+1=9
    11 = B, 9 = 9
    So 10111001 = B9
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How do we convert from hexadecimal to binary?

A
  1. Find decimal value for each hexadecimal character
  2. Find binary value of each decimal number in nibbles
  3. Put nibbles together
    Eg.
    8C 8 = 8, C = 12
    8 4 2 1 8 4 2 1
    1 0 0 0 1 1 0 0
    So 8C = 10001100
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How do we add together binary numbers?

A
1. Use column addition 
0+0=0, 0+1=1, 1+1=1 0 (write 0 then carry 1 into next column), 1+1+1=1 1 (write 1 then carry 1 into next column)
Eg.
     0 1 0 0 1 0 1 1
\+  1 0 0 0 1 0 0 1
\+  0 0 1 0 0 1 0 1
=  1  1 1  1 1  0 0 1
                1 1  1  1
Add 0 INFRONT of binary numbers if they have different number of bits
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are binary shifts used for?

A
For simple:
- multiplications (left shift)
- divisions (right shift)
By powers of 2:
‘a’ place left/right shift = multiply/divide by 2ª
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Binary shit can cause 1s to ‘drop off’ the end
What is the effect of losing 1s in a left shift?
What is the effect of losing 1s in a right shift?

A

Left shift = very different answer (check using decimal)

Right shift = inaccurate answer (rounded to nearest whole number, remainders and decimals not considered)

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

What is a character set?

A

Collection of characters a computer recognises from their binary representation
Including:
- alphanumeric characters (uppercase/lowercase letters, digits 0-9, symbols
- special characters (commands eg. delete)

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

What are the 2 character encoding methods?

A
  • 7-bit ASCII

- unicode

20
Q

Describe 7-bit ASCII

A
  • most commonly-used character set in english-speaking world
  • each ASCII character given 7-bit binary code (extra bit, 0, added at start to fit into 1 byte)
  • so can represent 128 different characters
21
Q

Describe Unicode:

A
  • comes in several different forms, tries to cover every possible letter/symbol
  • uses multiple bytes for each character
  • covers all major languages
22
Q

What are the advantages of Unicode over ASCII?

A
  • first 127 codes in Unicode are same as ASCII
    But Unicode:
  • comes in several different forms
  • tries to cover every possible letter/symbol written
  • uses multiple bytes for each character
  • covers all major languages (even those with different alphabets like Chinese)
    All allows for a far greater range fo characters
23
Q

How to interpret a character encoding table:

A

Character Binary Hex Decimal
Space 00001000 8 8
0 00110000 30 48
= 00111101 3D 61
A 01000001 41 65

Character codes are grouped and run in sequence so:
In ASCII ‘A’ is coded as 65 in decimal so B is 66 and so on
In ASCII ‘0’ is coded for 00110000 in binary so 2 is 00110010

24
Q

What is a pixel? What does it stand for?

A

Stands for Picture Element
= a single point in a graphical image

Type of image most often used = bitmap
Bitmap images made up of lots of pixels

25
Q

How are images displayed?

A

Visual Display Units (VDUs) display pictures by dividing the display screen into millions of pixels, arranged into rows & columns

26
Q

What is the size of an image(bitmap) in pixels?

Also known as image resolution, higher resolution = better quality of image

A

Width of image in pixels x height of image in pixels

27
Q

What is the colour depth of an image(bitmap)?

A

= number of bits used for each pixel

Total number of colours = 2ª (a = colour depth)

28
Q

Describe how a bitmap represents an image using pixels and colour depth:

A

bitmap images made up of lots of tiny dots, pixels
- colour of each pixel represented by a binary code
Then processed by computer through table

29
Q

How do we calculate bitmap image file sizes?

A
File size (in bits) = image width in pixels x image height in pixels x colour depth in bits
File size (in bytes) = /8

Higher no. of pixels & colour depth = more bits in image = higher-quality image but increases file size

30
Q

How do we convert binary data black and white image

A
  • black and white images only use 2 colours so only need 1 bit to represent each pixel (white=0, black=1)
    Put into table
31
Q

Why must sound be converted from analogue to digital form?

A

For storage and processing sound files in a computer

32
Q

What is a sampling rate In terms of the digital representation of sound?

A

= Number of samples taken in a second (usually measured in Hertz, Hz, 1hz = 1 sample per second)

33
Q

What is sample resolution in terms of the digital representation of sound?

A

= number of bits per sample

34
Q

How do we calculate sound file sizes?

A

File size (bits) = sample rate (Hz) x sample resolution x length (seconds)

35
Q

Sound waves are sampled to create a digital version of sound. How?
What is a sample?

A

Sample = measure of amplitude at a point in time

  • sample analogues wave at regular intervals and create curve digitally
  • digital data is roughly same shape as analogue but it is in blocks(like bar chart) so isn’t continuous and lots of data lost
  • can be improved by taking samples more regularly (every few milliseconds)
36
Q

What is data compression?

A

= when we make file sizes smaller (while trying to keep compressed file as true to original file as possible)

37
Q

Why may date be compressed?

A
  • smaller files take up less storage space on device
  • streaming/downloading files from internet quicker as files take up less bandwidth
  • web pages load quicker in web browsers
  • email services have restrictions on size of attachment that can be sent (compressing file = can send same content)
38
Q

What are the two types of compression?

A
  • lossy compression
    (Permanently removes data from file to limit no. of bits & reduce size)
  • lossless compression
    (Temporarily removes data to store file then restores it to original state when opened to reduce size)
39
Q

Pros and cons of lossy compression?

A

+

  • greatly reduced file size = more files can be stored
  • takes up less bandwidth = can be downloaded/streamed quicker
  • commonly used, can be read by lots of software

  • loses data, file can’t be returned to original
  • can’t be used on software/text files as they need to retain all original info
  • worse quality than original (but normally unnoticeable)

Eg. MP3(audio), JPEG(image)

40
Q

Pros and cons of lossless compression:

A

+

  • no reduction in quality, same as original as data only removed temporarily
  • can be decompressed (back to original)
  • can be used on text/software files


- only slight reduction in files size so still take up quite a bit of space on device

Eg. FLAC(audio), PNG(image)

41
Q

How do we create Huffman trees?

A
  1. Count the frequency of each character
  2. Put characters into ordered list (start with least frequency character, each one represented as a node eg. 2(a))
  3. Combine first 2 nodes to make a new node, adding frequencies together
  4. Put combined node back into ordered list and repeat this process until 1 node
  5. On final Huffman tree, label each left branch with 0 & each right branch with 1
  6. Read Huffman code for each character by following path from final node to each character node
  7. Use Huffman codes to encode the string
42
Q

Explain how data can be compressed using run length encoding (RLE)

A

= form of lossless compression

  1. Looks for consecutive repeating data in a file (run)
  2. It stores the number of times the data repeats and one copy of the data (instead of storing each piece of repeated data separately)
  3. Stores this info as data pairs which can be represented in the format (number of pixels, colour)

(Not perfect as file size will not be significantly decreased if data doesn’t have many runs of repeated data)

43
Q

How do we represent data in RLE frequency/data pairs?

A
  1. Count number of times the same data is retreated in each run & store this eg. WWWWWYY = 52
  2. Store this info as data pairs, represented as (number of pixels, colour) eg. (5,W)
  3. No. of data pairs x no. of bits per data pair = no. of bits in final compressed image
44
Q

Explain how data can be compressed using Huffman coding:

A

Each data value in a file takes up the same amount of space = inefficient
Huffman coding:
- gives each data value a unique binary code which vary in length, gives shorter binary codes to data values that appear more frequently

45
Q

Calculate no. of bits required to store piece of data compressed using Huffman coding:

A

Use huffman codes to encode string and count no. of 1s and 0s

46
Q

Calculate no. of bits required to store piece of uncompressed data in ASCII

A

8 x no. of characters (including spaces)