Exchanging data Flashcards
Why is compression important for sharing files?
Compression is the process of reducing the amount of storage required by a file.
The bigger the file = the more time it takes to get transferred
So compressing files increases the number of files that you can transfer in a given time
Downloading the full version of a file is faster than downloading the compressed file over the internet
TRUE OR FALSE
FALSE
Downloading the compressed file over the Internet is faster than downloading the full version of a file
Give categories of compression
Lossy and Lossless
Lossy compression
Reduces file size while REMOVING SOME INFORMATION
So compressed image is more pixelated/sound is less clearer
Compressed file cant be turned back into original
Lossless compression
Reduces file size WITHOUT REMOVING INFORMATION
So compressed file can be turned back to the original without loss of quality
How would you compress audio files? Which compression category would you use?
Using LOSSY
Removing very high or very low frequences which are less noticeable to the ear
However, there is no way to go back to the original as there is no record of these high or low frequences and how high and low they were
Run Length Encoding is a type of….
Lossless compression
Run Length Encoding
LOSSLESS COMPRESSION
Repeated values are rempved and replaced with one occurence of the data followed by the number of times its repeated
When would Run Length Encoding not be suitable?
When there is not much redundant data so it wouldnt offer a large reduction in file size
What is Dictionary encoding?
LOSSLESS COMPRESSION
Frequently occuring pieces of data are replaced with an index
Compressed data is stored alongside a dictionary which matches the frequently occuring data to an index
Dictionary encoding is an example of….
Lossless compression
Give a disadvantage of Dictionary encoding
The compressed data has to be stored alongside the dictionary which will increase the file size of the compressed data.
Without the dictionary the original data cant be restored.
What is meant by encryption?
The process of scrambling data do that it can only be understood by the sender and intended recipient
What is symmetric encryption?
Both the sender and receiver share the same private key
So SAME KEY IS USED FOR ENCRYPTING AND DECRYPTING DATA
This private key is distributed in a process called key exchange
In Symmetric encryption both the sender and receiver share the same private key
This private key is distributed in a process called…
Key exchange
What is Asymmetric encryption?
2 keys are used
The 2 public keys can be published anywhere but the 2 private keys are to be kept secret
Message is encrypted with senders private key and recipients public key and decrypted using receivers private key and senders public key
Explain the process of hashing (simple)
An input called a key is turned into a fixed size value called a hash using a hashing function (algorithm)
The output of a hash function can be reversed to form the key
TRUE OR FALSE
FALSE
The output of a hash function CAN’T be reversed to form the key
The output of a hash function CAN’T be reversed to form the key
What would this fact make hashing useful for?
Storing passwords as the password entered by the user can be hashed and checked against a key to see if it is correct.
But a hacker would only get accessed to the key which can’t be reversed to gain passwords
What would be the time complexity for looking up data in an array?
O(1) Constant
What is meant by a collision in hash tables?
Give methods to deal with these?
When 2 pieces of data produce the same hash
-Making a new/bigger hash table
-Storing items with same hash in a list under same hash value
-Use a second hash function to generate a new hash
A good hash function should…..
-Have a low chance of collisions
-Provide an output/hash that is smaller than the input/key ==> because otherwise it would take longer to search for the hash than just searching for the key
What is a hash table?
A data structure which holds key-value pairs
A relational database is a d….
database that recognises the differences between entities by creating different tables for each entity
What is an attribute in databases?
A characteristic of an entity
What is meant by a primary key?
A unique identifier for each record in the table
(shown by underlining)
What is meant by a foreign key?
An attribute which links two tables together
-It will be the primary key in a table and then the foreign in another
(denoted using asterisk *)
What is meant by a secondary key?
A key which allows a database to be searched quicker
eg. patientID is primary key but a patient may not know this. So a secondary key could be their surname
-So you can search and order by surname to find specific patients
Give examples of entity relationship modelling
ONE TO ONE
ONE TO MANY
MANY TO MANY
ONE TO ONE
MANY TO ONE
MANY TO MANY
Are examples of entity relationship modelling?
FALSE
ONE TO ONE
ONE TO MANY (NOT MANY TO ONE)
MANY TO MANY
MANY TO ONE DOESNT EXIST
What does database normalisation try to accomplish?
-No redundancy (unnecessary duplicates)
-Complex queries can be carried out
-Records can be added and removed without issues
-Consistent data throughout linked tables
What happens in first normal form?
No attribute contains more than a single value
(No repeated attributes)
What happens in second normal form?
No partial dependencies meaning that no attributes can depend on part of a composite key
What happens in third normal form?
Nonkey dependencies which means the attribute only depends on the value of the primary key and nothing else
What is meant by indexing in databases?
A method used to store the position of each record ordered by a certain attribute (called secondary key).(eg.surname instead of patientID)
Even though the primary key is automatically indexed it is almost never used as its hard to remember
-So we use secondary keys instead
How would you capture the data when people pay cheques?
Pay cheque = ordering bank to get money from your account and give it to the person that is on the cheque.
Bank scans cheque using MICR Magnetic Ink Character Recognition.
-All the details excluding the amount which is to be entered manually are printed in a special magnetic ink which can be recognised by a computer
How would you capture data from multiple choice questions?
Using Optical Mark Recognition (OMR)
Exchanging data
The process of transferring the collected data.
Can use Electronic Data Interchange (EDI) which doesnt require human interaction and enables data transfer from one computer to another
Structured query language (SQL) is an example of a…
Declarative language used to manipulate databases
SQL SELECT statement structure
SELECT attribute
FROM table
WHERE conditions
ORDER BY
ASC = ascending
DESC= descending
If you say:
ORDER BY DatePublished
it wil automatically order in ascending
Also can do:
ORDER BY DatePublished ASC
so ORDER BY DatePublished ASC = ORDER BY DatePublished
X JOIN in databases
Combines rows from multiple tables based on a common field between them
What is the difference between VARCHAR and CHAR in databases?
VARCHAR(n) is a string of variable length with upper limit n (max length is n)
CHAR(n) is a string of fixed length n