Set 4 Flashcards

Hardware SQL

1
Q

What is a barcode?

A
  • A barcode is a sequence of parallel black and white bars that encodes binary information
  • Sometimes a check digit is added to the end of the barcode for validation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Operation of a barcode reader

A
  1. Light from a laser illuminates the barcodes
  2. More light is reflected from the white areas than from the black bars
  3. The reflected light is captured by photoelectric cells
  4. The photoelectric cells generate a set of electrical pulses that correspond to the black and white stripes in the barcode.
  5. These pulses are processed and converted to a binary number that represents the code
  6. Most barcode readers indicate that the barcode has been read successfully, for example by sounding a beep or showing a green light
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are QR codes? How are they different from regular barcodes?

A
  • Two-dimensional barcodes
  • They have a higher storage capacity
  • QR codes are read using images, not lasers
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Operation of a digital camera

A
  1. The shutter opens, allowing light to enter the camera through the lens
  2. The lens focuses the light onto an image sensor
    • An image sensor is an array of millions of photosites (light-sensitive elements)
    • Each photosite produces an electrical signal and each signal represents a current
  3. The photosites only measure the intensity of the light. To determine the colour of each pixel, a ‘Bayer filter’ is used
  4. The Bayer filter provides an array of red, green and blue filters
  5. The final value for each pixel is derived from its own colour intensity and those of its immediate neighbours through the application of a demosaicing algorithm
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Operation of a laser printer

A
  1. The print drum is coated in a positive static charge
  2. A laser beam is directed at the print drum
  3. The laser is modulated (turned on & off)
  4. The laser reverses electric charge on drum, where image should be dark / black
  5. The toner is given a positive charge
  6. The charged drum picks up toner
  7. There are four different toner cartridges, one for each colour (cyan, magenta etc)
  8. The toner is transferred from drum to paper
  9. Toner is fused to paper by heated rollers
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does RFID stand for and what is its purpose?

A

RFID (radio frequency identification) allows data to be transmitted wirelessly over radio waves.

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

What are the two parts to an RFID system?

A

Tag
Reader

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

What is in a passive RFID tag?

A
  • chip, which contains a small amount of memory
  • antenna
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How does an RFID reader work?

A
  1. The reader emits radio waves which are picked up by the tag’s antenna
  2. The power induced in the tag’s antenna from these waves is enough to power the chip
  3. The chip uses its antenna to emit its own radio wave which contains the information held on the chip
  4. This wave is picked up by the reader which decodes the information and returns the information to a computer
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Advantage of RFID over barcodes or digital cameras

A

The use of radio signals means that the system does not require a line of sight between the tag and the reader

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

What is a passive RFID tag? Range?

A
  • An RFID tag that doesn’t contain a power supply
  • The device is powered by radio energy transmitted by the reader
  • Range of up to 1m
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is an active RFID tag? Range?

A
  • An RFID tag that has a small battery within the tag
  • The tag will transmit its identifier at regular intervals
  • Range of up to 200m
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Give four reasons secondary storage is needed:

A
  • Main memory is volatile, so secondary storage needed to store files that are needed multiple times
  • Secondary storage can be used to store larger files, as it usually has a much higher capacity than main memory
  • Secondary storage can be used for virtual memory
  • Main memory is expensive
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What type of storage are Hard Disk Drives?

A

Magnetic storage

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

What are the parts of a HDD?

A
  • at least one metal platter
  • a spindle which spins the platter
  • a read-write head on an actuator arm
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Describe the operation of a HDD:

A
  • The read-write head is used to store and retrieve data on the metal platters
  • Each platter is made up of concentric tracks which have many polarised dots
  • Binary data is represented on the surface of the metal platters with magnetised dots
  • Magnetised/Unmagnetised represent 0s/1s
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Give four pros of a HDD:

A
  1. High read-write access speed (but slower than SSD)
  2. Greater Capacity than SSD
  3. … at a lower cost per Gb than SSD
  4. Reliable and don’t degrade over time
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Give four cons of HDDs:

A
  1. Not as portable as CD/DVD/USB memory sticks
  2. HDDs are more likely to fail as they are made up of lots of moving parts
  3. HDD’s are fragile (bumps and knocks damage disk)
  4. Slower access speeds that SSDs
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What type of storage are Solid State Drives?

A

solid state storage / NAND flash memory

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

Describe the operation of an SSD:

A
  • SSDs use floating gate transistors that allow an electrical charge to be trapped, representing a 0 or a 1
  • Transistors are organised into pages and blocks
  • Blocks are made of many pages
  • A whole block of data must be written at once
  • Cannot overwrite pages
  • Page must be erased before it can be written to
  • In actual fact, technology requires whole block to be erased
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Give four pros of SSDs:

A
  1. Faster data transfer (read-write) speeds than HDD
  2. No moving parts, so are more robust
  3. More portable than magnetic storage
  4. Smaller SSD devices available, e.g. SD cards and USBs
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

When is an SSD suitable?

A
  • When files need to be read or changed frequently (e.g. in a server)
  • Or when the system needs to be portable
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Give two cons of SSDs:

A
  • The number of times SSD devices can be written to is limited (hence unsuitable for long term archiving of data)
  • Higher cost per Gb than HDD
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What sort of storage are optical drives?

A

Optical storage

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

Name three optical discs (e.g. CD), in increasing capacity

A
  • Compact Disc (CD)
  • Digital Versatile Disc (DVD)
  • Blu-ray Disc
26
Q

Name the three types of optical drive (e.g. ROM):

A
  • ROM (read only)
  • R (recordable)
    • Can be written onto once. Good for archiving data
  • RW (rewritable)
    • Has a chemical dye layer on top of the reflective layer
    • The chemical dyes allow the burning process to be reversed
27
Q

How is an optical disc created? Operation of optical drive?

A

creation
- A special machine stamps pits and flats onto a reflective aluminium layer.
- The pits and flats represent binary values.
- Pits represent 0 and flats represent 1.
optical drive
1. The disc spins at constant linear velocity
2. Laser in disk drive is shone at disk
3. Light is reflected back from disk
4. The pits and lands reflect different amounts of light
5. Light sensor detects reflection and records 0s/1s

28
Q

Give three pros of optical discs:

A
  1. Extremely light and portable
    … so they are good for media distribution
  2. Relatively cheap (for lower storage capacities)
  3. Reliable (unless scratched)
29
Q

Give five cons of optical drive:

A
  1. Data can be ruined if disc is scratched
  2. Lower capacity than HDD and SSD
  3. Slow seek time
  4. Not all disks are rewritable
  5. Not compatible with very much anymore
30
Q

What is an entity?

A

An entity is the object / thing of interest about which data is to be recorded (a table in SQL).

31
Q

What is an attribute?

A

An attribute is property of an entity (a field in SQL).

32
Q

What is a relationship?

A

A relationship is the link or association between entities (primary keys ←→ foreign keys)

33
Q

What is a key (in a database)?

A
  • A key is the name given to a special field in a database where the values in the field can be used to identify particular records, e.g. CustomerID.
  • Sometimes a field that is already in the database can be used as the key field.
34
Q

What is a primary key?

A

A key which has a unique value for each record, and acts as a unique identifier for each record

35
Q

Give three problems with a flat file database:

A
  1. One small change can involve tediously changing many records
  2. Deleting the only instance of a record containing a particular category will also delete that category
  3. You can’t add a new category until you create a record that contains that particular category
36
Q

How do you solve the problems with flat file databases?

A
  • Relational databases that are made up of two or more linked tables.
  • Linked tables can be used to find records which are linked together by using the value of the shared key column. They are a feature of relational databases.
  • This shared key column acts as the primary key in the table in which its defined, and as a foreign key in the table it is used.
37
Q

What is a flat file database?

A

A simple store of information
- Columns are called fields
- Rows are called records
- A table is a group of records

38
Q

What is a composite key?

A

A key composed of two or more attributes that together uniquely identify a record.

39
Q

When is normalisation (database) achieved?

A
  • When there is no redundant data and all related data is stored together
  • (When each attribute depends on the key, the whole key and nothing but the key)
40
Q

What is the saying for database normalisation?

A

“Each attribute must depend on the key, the whole key, and nothing but the key”

41
Q

What are the requirements for 1st normal form?

A
  1. Every record has a primary key
  2. No repeating groups → must include a copy of the primary key in the new table (creating a composite key)
  3. The data in each field must be atomic (i.e. data cannot be sensibly subdivided e.g. name → fname & sname)
42
Q

What is a repeating group?

A

A set of attributes whose structure repeats between rows

43
Q

Requirements for 2nd normal form

A

No partial dependencies
this means…
- Do all nonkey attributes depend on all parts of the composite key?
- If not, take them out and create a new entity.
(So check all tables with composite keys)

44
Q

Requirements for 3rd normal form

A

No non-key dependencies
- All non-key attributes are checked to see if they are only dependent on the primary key.

45
Q

How do you identify the key in an entity relationship diagram?

A

Underlining

46
Q

Give the SQL instruction to: Create a database called school

A

CREATE DATABASE school

47
Q

What does DDL stand for (in SQL)?

A

Data Definition Language

48
Q

Give the SQL instruction to: Create a table called students
(StudentNumber as primary key, forename, surname, and date of birth)

A

CREATE TABLE students
(
StudentNumber INT PRIMARY KEY,
forename TEXT,
surname TEXT,
DateOfBirth DATE
)

49
Q

SQL: What is the keyword for deleting a database/table?

A

DROP …

50
Q

What are the SQL data types

A

CHAR(size) // → fixed length string
VARCHAR(size) // → string (with a maximum length)
‘TEXT’ // → string
ENUM // → string object that has to be chosen from a list of possible values
BOOL / BOOLEAN
INT(size) // → size is the number of digits
FLOAT(size,d) // → size is the number of digits , with d digits after the decimal point
DATE
TIME
DATETIME

51
Q

What does DML stand for (in SQL)?

A

Data manipulation language

52
Q

Give the SQL WHERE command for: all strings beginning with ‘bor’

A

LIKE ‘bor%’

53
Q

Give the SQL WHERE command for: any strings at least five characters long

A

LIKE ‘_____%’

54
Q

Give the SQL WHERE command for: a studentID between 10 an d100 numbers

A

… WHERE StudentID BETWEEN 10 AND 100

55
Q

Give the SQL command for: Selecting from two tables

A

SELECT table1.attributeX , table2.attributeY
FROM table1 , table2
WHERE table1.primarykey = table2.foreignkey
AND …

56
Q

Give the SQL command for: ordering results by surname

A

ORDER BY surname

ORDER BY surname ASC

ORDER BY surname DESC

57
Q

Give the SQL command for: Inserting data into the student table
Assume it’s of the form: Students(StudentID, Forename, Surname, House)

A

INSERT INTO students VALUES(__,__),(__,__),(__,__)

INSERT INTO students (surname , forename) VALUES (__…
//if you can’t remember what order you’re supposed to do it in)

58
Q

Give the SQL command for: update a forename to ‘Harry’ where…:

A

UPDATE students SET forename = ‘Harry’ WHERE…

59
Q

Give the SQL command for: Delete a record from the students table

A

DELETE FROM students WHERE …

60
Q

What is a foreign key?

A

An attribute in one table that is the primary key field of another table.
It exists to make a link between the tables.
The name is misleading as it doesn’t have to be a key in the foreign table!