0% found this document useful (0 votes)
39 views36 pages

ZNote For Theory A Level

The document covers various aspects of data representation, including number systems, binary and floating-point representations, and error checking methods. It explains how different number bases (decimal, binary, hexadecimal) work, the significance of bits and bytes, and the differences between fixed and floating-point numbers. Additionally, it discusses character encoding systems like ASCII and Unicode, as well as the digital representation of images and sound.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
39 views36 pages

ZNote For Theory A Level

The document covers various aspects of data representation, including number systems, binary and floating-point representations, and error checking methods. It explains how different number bases (decimal, binary, hexadecimal) work, the significance of bits and bytes, and the differences between fixed and floating-point numbers. Additionally, it discusses character encoding systems like ASCII and Unicode, as well as the digital representation of images and sound.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 36
AQAA LEVEL Prepared for Adenekan fer persnal Use or ces er 1, Data Representation 1.1. Number Systems + Natural Numbers: base 10 numbers used for everyday counting, Postve integers for Dto= * Uses: counter n processor, identi location of data ina structure, score variables, counting N= (0,1,2,34...) + Integer Numbers: whole numbers (no fractional part) that can be posite or negative Z=(...-3,-%—1)0)1,2,3,4...) + Rational Numbers: canbe expressed fractionally, as quotients). Quotient can equal 1 (5/5=1 soll integers are rational + Denominator cannot be 0 Q = (1/3,1/2,3/4...) + rational Numbers values after decimal place do not repeat. Cannot be represented as 2 ratio between two integers. "Programmer needs to decide how many decimal places to use + Egv2orm + Real Numbers: any postve or negative number, with or withouta factional part. Fractional part canbe any length, allowing any level of precsion/accuraty + Refines possible reaorld quantities + Usesi measurements, CNC, time, robotics, data control systems + Ordinal Numbers: number used to identily postion telatve to other numbers + Cardinal Numbers: a number that defines the sizeof something + Well Ordered Set: group of related numbers with 8 defined order 1.2. Number Bases “Number base! defines how many digits are used to represent a number. + Decimal: uses 10 digi (0 + ) and increases by powers of 10 ‘Uses: humans for counting + Base 10: + Binary: uses 2 digs (0 and 1) ‘+ Uses: computers, because electronic gates can only be open or closed + Base2:# + Hexadecimal: used 16 digits (0+ F) ‘+ Why: shorthand for binary, as 2 hex digits can represent a byte. Requires less digits than binary, takes up less screen space, easier for humans to Understand than binary strings ‘Uses: HTML hex colour codes, MAC addresses, ‘memory dumps, error messages Base 16: ft. + Binary -> Decimal using binary columns, add up all values that have a1 underneath. + Decimal —- Binary using binary columns, see if value will fit under most significant colurnn, then repeat with remainder and next colurnn. Or, start with the least significant column and divide by 2 each time. If remainder is 0, then 0 is placed inthe column. + Decimal -> Hex convert to binary, split into nibbles, then tur each nibble into hex, and push values together. ‘+ Hex — Decimal take each hex value, turnit into binary, then push the nibbles of binary together. Turn binary into decimal 1.3. Units of Information + Bit: the fundamental unit of information, that is either 0 ort + Oisoff, and 1 is on inary Digit + Byte: a group of 8 bits ‘+ 2n values represented with n bits: where nis the umber of bits used, 2n is the number of possible ‘combinations ‘+ Eg. 2°=B, so with 3 bts, there are 8 combinations ‘Units: binary increments in 102, Decimal units Increment in 1000 ‘+ Inthe past, kilobyte has been used to mean kiblbyte (1024 bits) W/\W/\W/ZNOTES.ORG ces er 1.4. Binary Number System Unsigned Binary ‘+ Binary that only represents positive whole numbers ‘+ Minimum value (for n bits) = 0 ‘+ Maximum value (for n bits) = 2n-1 + eg. maximum number in 8 bits = (241) = 255 igned binary: binary that represents a positive or negative whole number ‘+ Adding unsigned binary: add the two numbers together inbinary + Carrying a t: where the answer of 1+1 = 10, or 14141 1 ‘+ Multiplying unsigned binary: multiply the binary by the first digit ofthe second number. Repeat forthe next ligt, shifting the answer along by 1. Then add che resultant numbers together for the answer. ‘Two's Complement (Signed Binary) ‘+ Amethod that can be used to represent negative Integers, where the most significant bits negative. Converting to denary ‘+ An B-bittwo's complement number has -128 as the most significant bit, + Write out denary equivalents (with sufficient columns (Goubles each time) for the length ofthe binary string) + Enter binary string in eg. 10071700) + Add up values (eg. = 100) Converting from denary W/\W/\W/ZNOTES.ORG + Flipthe bits and add 1 ‘+ Write out the positive binary equivalent + eg, +102 = 01100110 pall bits ‘+ Perform binary addktion with 1 to get the answer ‘+ Computers can only add binary, soto perform the calculation 20-13 = 20 + (-13) + 20=a0010100 213211110011 + The answer can be checked by converting the final answer into denary ‘+ Inthis case there is an overflow bit. tis handled separately to the calculation + Calculate range: using bts, 256 numbers can be represented (-128 to 127) + Arbitrary number of represented + Unsigned binary: 2n- (as 0is representable) + Two's complement range “+ Minimum representable value = (-2n-1), ‘+ Maximum representable value (2n-1-1) 2n numbers can be Fractional Parts Fixed point ‘+ Representing a fractional part using a fixed decimal point. After the point, aigits become fractions ‘= Smallest representable number using 8-it fixed point is 0900.0001 = 1/16 = 0.0625, 256 combinations ‘an be produced ‘+ Negative numbers can be made by making the MSB. negative + eg (8) +4424 H+ O15 Floating point ces er ‘+ Representation of number where the decimalbinary point moves, Uses two's complement ‘+ Mantissa: represents the significant digits (actual value) + Exponent: represents the power to which a number is raised to (how many places the points to move) ‘+ Floating point to decimal: 00001100 0011 + Work out the exponent. Ifitis negative, the point in the mantissa moves to the left. f positive, move to the right. + 0011 = 43 |0}*+J0-]0-101111]0/0] lolololojelti11ojoy © Add colurnn headings to the mantissa and work out the value. Any columns after the point are fractional. 005+0.25=0.75 + Decimal to floating point: -10.5 + Write out positive fixed point representation oFlip the its and add 1 to get number into two's complement ‘© Normalise the number by moving the point so that it starts in 10 (fora positive number: 01) Itfeloltsolti1 10104 O Fillin mantissa and exponent (number of places the point moved) It fort foiss4 ojo} [1poyoy 1.5. Binary Errors W/\W/\W/ZNOTES.ORG + Rounding errors: it's not possible to represent every decimal number, because fractions are being used -the representation of some numbers may be inaccurate. + eg, 0.95 = 19/20, The binary progression of fractions. allows us to get close, but never exact. ‘+ Some numbers (0.110) can never be accurately represented. ‘+ Absolute rounding errors: the difference between the value intended to be stored, and the actual value that can be stores + Eg, 6.95 (target value) - 6.9375 (actual) = 0.0125 + Relative rounding errors: percentage difference between actual result and the expected result ‘relative error= (absolute valuey/(number intended to be stored) + Ee, 0.0125/6.95 *1 Underftow and Overftow 18% + Will use erroneous results or a program crash. Can be dealt with using flags + Underflow: when a number is too small o be represented with the number of bits alocated ‘+ Example: representing 1/32 s impossible using &-bit fixed point numbers - smallest that can be represented is 1/16 + Overflow: when a number is too bi with the number of bits allocated to be represented ‘+ Example: adding 00000001 (1) and 01171111 (127), would praduce 10000000 (128), but in two's complement, the answer would be 128 1.6. Floating Point vs. Fixed Point ces er + Range + Floating point can represent a wider range of numbers with same number of bits as fixed point + Precision + Fixed point’s absolute error does not change between numbers, so retains precision + Precision can vary wit floating point, asthe binary point does not have a fixed position + Speed of calculation + Fixed point quicker to process, asthe binary point does not need to be moved for each number Normalisation of Floating Point ‘+ Normalisation adjusts numbers onto a common scale that represents them as accurately as possible relative to the number of bits available Ensures that there is only one way to represent a number + Positive normalised: must start with 0.1 ‘+ Negative normalised: must start wi 1,7. Coding Systems Character Form of Decimal ch character has a character code, which is its representation in binary ‘+ Decimal numbers can be represented either with a character code or in pure binary ‘+ Character Code: used just to represent a number, where the actual value is nat crucial lke ina phone umber ‘+ Pure Binary: used to represent a number when ns need to be performed, and the decimal ‘number will equal the binary value ASCII and Unicode + ASCII: American Standard Code far Information Incerchange. Introduced as a standard binary coding system for characters and numbers ‘Standard: 7-bit code gives 128 permutations + Extended: #-bit code gives 256 permutations ‘+ Umitations: 256 characters not enough, no multi- lingual support, web use requires universal coding system, new programs need wider character range + Unicode: standard binary coding system that has surpassed ASCII since it allows for more permutations land hence more characters/languages. ASCII was ‘absorbed into Unicode, so all original codes remain the same ‘+ UTF-16: 16-bit code allows characters for 20+ countries, special characters and emojs ‘Vitalin the age of international communication so that data does not arive corrupted 1.8. Error Checking and Correction + Parity Bits: an adaltional bie added onto a binary string ‘to make total number of 1s/9s even or odd. Ina byte, 7 bits are sent + the adcitional parity bit ‘+ Even Parity: parity bit added to make total number of 1s an even number. Checked on receiving end + Odd Parity: party bit added to make total number of ‘1s an odd number. Checked on receiving end ‘+ Majority Voting: each bit in a binary code Is sent a set number of times, and then checking i the binary digit is the same each time. ‘+ 10 sent as [4] = 11110000 + Aninvalid transmission of 10 as [4] could be: soro001 + Checksums: isthe result ofa cryptographic hash function ran on a piece of data to return a value. If the value returned is equal to the value provided by the ‘source data, then transmission was successful + Check Digits: digit is added on the end of binary data to check itis accurate, Modulo-11 is a common way to calculate a check digit ‘Eg, 23045 is sent as 230456, so check digit is added, and then ‘modded’ until the value reaches 0. If calculation performed on receiving end does not match, and error message is created W/\W/\W/ZNOTES.ORG ces er 1.9, Encoding with Bit Patterns ‘+ Abit pattern can represent + Binary digit/signed binary digit + Character code + Phxel ofa picture + Note in a sound field + Length of a tine + Volume of a note ‘+ Astring of binary represents an electrical signal that is ether high or ow. The electrical signal fist needs to be turned into a digital signal, which can then be interpreted into the appropriate form of data Analogue and Digital + Analogue: uses continuously values which produces @ continuously changing waveform ‘+ Digital discrete (discontinuous) values to represent values ‘+ ADC: an analogue to digital converter turns real world continuously changing waveforms into a digital signals for computers + Samples analogue signals at set time values and records amplitude + Quantization rounds amplitude up or down so value fits in bit resolution + Required so that computers can interpret the analogue signals that sensors produce ‘+ DAC: turns a digital signal into an analogue waveform real world devices can use ‘+ Required to turn a digital audio signal into an analogue signal for speakers 1.10, Images W/\W/\W/ZNOTES.ORG Bitmapped Graphics + Pixel: the smallest picture element of an image + Pixel Grid: a bitmap image 's made up of a grid of many pixels. Each pixel is assigned a binary value that controls its colour ‘+ Resolution: an image's size. Can be represented by Phxels/Dots Per Inch, which Is how many plxels/dats there are in each square inch resolution — width x height(inpizele) pizelsnumber = width x height x dotsperinch + Colour Depth: depends on the numberof bts/bytes assigned to represent a pixels colour. Representing a pixel with a byte (8 bts) gives 256 possible colours (2°= 256) + Storage * resolution x colour depth ‘+ Metadata: bitmap graphic contains file information in a header such as; width, height, colour depth, camera, location, date and time. + Storage requirement pixels olour depth x number of Vector Graphics. + Representation: made up of objects and coordinates so graphic is mathematcally controlled ‘© The properties for each object in the graphic are stored in a lst + Wicth of ine + start/end coordinate points + Colour + Allows the graphic to be recreated at any size and editing ofthe file + Object Properties: objects such as shapes and lines, hhave x and y starting coordinates and a direction of path, Each path chen has values for stroke colour, shape, curve, thickness, fill olour, 1.11. Sound Digital Representation of Sound ces er ‘+ Analogue sound waves must be sampled to turn them Inco digital waves, Since analogue signals vary continuously, readings must be taken at fixed intervals ‘+ Sample resolution: how many intervals of amplitude are recorded ‘+ Sampling rate: number of samples taken per second ‘+ Nyquist’s Theorem: sampling rate should be at least double the highest frequency desired ' Ensures complete coverage of peaks and troughs in the analogue signal - allowing faithful sound reproduction + Since the upper frequency for humans is 20,000H, the analogue frequency must be sampled at 40,0002 filesize = frequency x bitdepth x duration ‘+ Frequency is the frequency ofthe sample rate MIDI W/\W/\W/ZNOTES.ORG + Purpose: protocol for recording and playing back music, ‘or controling devices. Instead of direct sound representation, i transmits data to control how sounds are produced + Event messages: control the properties ofa sound in a file - recorded in binary to communicate between a MIDI device and the processor + When to play/stop arnote + Note lengthvvalume/velocity/pitch ‘+ Effects to apply to notes + Timing notes to play with other sounds/notes or with other MIDI devices + Advantages ‘Smaller file size than a pure sound fle - load faster Fully editable - each note/instrument can be changed Supports a huge range of instruments High quality and authentic sound/instrument reproduction 1.12, Data Compression ces er + Data compression reduces the number of bits required to represent data, so the fle takes up less space ‘+ Images and video are often compressed as they take up a lot of storage, but text files can also be ‘+ Lossless: data can be accurately and exactly reproduced. No data s lost ‘+ Run Length Encoding: sequences of the same repeated data are stored as a single data value and a count ‘+ Works on binary, pixel and character levels + Eg BBBBAAC = BA A2C1 + Dictionary Encoding: stores language patterns and ‘commonly used phrases in a dictionary, that are then referenced + Tokens are assigned to common text snippets, and then included in the compressed data + Needed far program code, text files, where data loss's disastrous + Lossy: data degradation occurs. Produces smaller file than lossless, but data is lost, quality normally OK + Sound: percept ing removes frequencies Which are less audible to humans, and less crucial + Pictures: grouping of lke colours together in blocks, so less colour data must be stored + Video: interframe compression keeps stationary pbxels the same, just continues to show them, while only refreshing pixels that have moved, Temporal/Spatial redundancy keeps blocks of pixels. that are the same betweeniwithin a frame + Used on pictures, video and sound where data retention is nat crucial. Cannot return to original 1.13. Encryption W/\W/\W/ZNOTES.ORG 2. Fundamentals of Computer Systems 2.1, Hardware and Software Relationship ‘+ Hardware and software work together to create a ‘computer system. Without either, they would be useless ‘+ Hardware: physical components of a computer system + Software: any executable program (set of instructions) ‘on a computer system Classification of Software ++ Application Software: programs to perform user specific tasks that are not related to the computer's ‘operation + Email, word processing, calculations etc. ‘+ System Software: programs to set up and run the ‘computer. Many aspects are invisible to the user. Supports the application software ‘System Software + Operating Systems: a collection of software that links together the hardware and applications to hide the true complexity of a computer system from the user and other software ina virtual machine Hardware ces er + Utility Programs: maintain or enhance the computer's ‘operation, computer can however run without them + eg: Anti-Virus, Defragmentation, Back-Up software “+ Libraries: a collection of frequently used routines that can be called by other programs. in Windows, DLL files are used and loaded as required ‘+ Contain functions such as saving and displaying text + Translators: convert programs into executable machine code that the computer can understand ‘Assembler, Compiler and Interpreter 2.2. Programming Languages W/\W/\W/ZNOTES.ORG + Low level languages ‘+ Machine Code + Lowest level of code, 0s and 15. Written in binary, based on CPUs instruction set Every language is translated to Machine Code ‘+ Characteristics: high risk of input errors, hard to find errors, not portable co different architectures, long, + Uses: where fast execution or direct processor access s needed + Assembly Code: one-to-one relationship with ‘machine code, uses abbreviated codes for Instructions + Characteristics: not portable, one-to-one relationship, quick execution, compact due to ‘optimisation, high level manipulation of processor registers + Uses: realtime applications (vital fast response), device drivers, embedded systems (direct hardware manipulation) ‘+ High level languages ‘+ Procedural (Imperative): computer follows a list of Instructions, every time + Characteristics: process focussed, subroutines, fopen data sharing + Uses: fist HLLs, CLis, basic programs ‘+ Object-Orientated: instructions held in objects, runs once object has been interacted with + Characteristics: encapsulates data, uses classes, bottom up design, functions + Uses: all modern GUI programs ‘+ Event Driven: program flow is determined by events (user input, sensors, messages.) + Characteristics: ime driven, event/trigger functions, subroutines + Uses: GUls, user-input based action ‘+ Declarative: describes what the program should ‘accomplish, rather than how + Characteristics: non-destructive assignment, rnon- Ser eciver MAC acreses ‘Senderecive adresses Protea are ‘Packet and sequence numbers p{ Bosriee2 bes Data or parodies Seneca rer ang ratio ‘+ Router: network device that forwards data packers between computer networks to the correct destination based on an address + Uses the Network Translation Table + Gateway: a piece of hardware that can convert between ‘wo protocols when data Is passed between networks that use different protocols by stripping off packet header data and replacing it with new header Information for the new format ‘+ Routing: finds the optimum route between sender and receiver, where there are many possible routes. Router is sed to send data to next network node - it knows where to send data from header info ‘At each stage, data packets are sent to next router in the path, with reference to routing table + Routing table: stores information on possible routes the data packet may take to next node. Identifies next step + Uniform Resource Locator: full address used to find files on the Internet omen “San ES men https:/Awen.exampleurl.com/infofaboutus. htm! ili iliac aia aa = onanare U\WIWZNOTES.ORG + Fully Qualified Domain Name: when the domain name ‘and host server indication are combined ‘wu, + bbc.co.uk = www. bbe.co.uk ‘+ Domain name: identifies organisations or groups on the Internet. Eg. bbc.co.uk ‘+ bbe: organisation name + co: ncicated itis a company. gov, org are others. + suk: UK registered, .es is Spain, .nzis New Zealand + Organisation: hierarchical system. Roat zone ‘managed by IANA, with oversight from ICANN. ICANN ‘manages registration and assignment of TLOs 1, DNS root zone 2.Top Level Domain 3, Second Level Domain 4, Third Level Domain ‘+ IP address: unique 32-bit number that identifies network devices + Domain service: when a domainname is assigned, itis mapped to an IP address. A Domain Name Server (DNS) stores the link ‘= User's device requests IP address from DNS server, and itis returned, Then browser establishes connection with P address ‘+ Hundreds of DNS servers around the world are connected, so that if one doesn't have the mapping, it routes the request to another that might have ‘+ Humans type in domain names because they are easier to remember chan IP addresses + Internet registries: are organisations that manage and allocate domain names and IP addresses. Internet Corporation for Assigned Names and Numbers has department called Internet Assigned Numbers Authority, ‘who manage 5 Regional internet Registries ces er 6.4. TCP/IP 6.5. Wireless Networking + Asuite of protocols for sending information around the Internet or a network e} ec ees OMI @ Deena es anya 9 225 nes Fdctan oun Ah etre Th ures ‘Sitotueatarsesna necro enon are steties nea ce as el Ce 6.6. Security ce ‘+ RTS/CTS: overcomes problem of hidden nodes that CSMA/CA cannot find. If idle channel, ‘Request To Send” ‘message sent. I server idle, ‘Clear To Send’ message is sent, If CTS not received, data not sent ‘+ [SSID: Service Set Identifier I a locally unique 32- character code that acts as a network identifier allowing a data frame to be transmitted, Included in the header of each data packet Is required for security, But doesnt affect security Standard method of ensuring right device connects to right network ISSID: Service Set Identifier isa locally Unique 32-character code that acts as a network identifier alowing 2 data frame to be transmitted. Included in the header of each data packet Is required for security, But doesn’t affect security Standard method of ensuring right device connects to right network YWWZNOTES.ORG ‘Siotectr sean ne baybyccnsan arg ssesiaaon oa ces er ‘+ Asymmetric encryption: uses two related keys per session, Both a sender and a receiver have both keys. ‘Mathematically related keys, but near impossible to work ‘out private key from public key, due to 1024-bits used + Computer A has private and public key. Public key ‘an be seen by anyone Computer B also has both keys A encrypts data using B's public key Data sent to B B decrypts the data using B's private key, that only B knows Bb UWI ZNOTES.ORG + Digital certificates: a way of proving encrypted message is from a trusted source. Used to authenticate a service is genuine ‘+ Important for sharing public keys in asymmet encryption ‘+ Contain organisation name, domain name, server name, and a Certification Authority serial number + Certification Authority: trusted organisation that issues digital certificates and signatures + Digital signatures: uses mathematical functions and public/private key method to ensure sender authenticity ‘+ Hash created from message by applying public hashing algorithm Hash encrypted using private key A Hash added to message as igital signature’ B uses public key Ato decrypthash Hash put through the same publicly known algorithm and result is compared to orginal ‘+ Iftwo hashes are the same; authenticated. Else, it cannot be authenticated 6.7. Malware: ce as el 6.8, Standard Application Protocols W/\W/\W/ZNOTES.ORG 6.9. IP Addresses + Aunique number, split into a network identifier and host identifier, that identifies devices on a network + Domain name (IP proxy): transferred to a domain name server, which converts ito an IP address. Ifthe DNS. cannot find the IP address, itis transferred to another server with the same top-level domain + Subnet masking: splits the IP address into a subnet identifier and specific computer identifier. Performs an AND operation between IP and masks: + 255.000 (Class A) + 255,255.00 (Class 8) + 255.255.2550 (Class C) IF the two computers are on the sare subné the result of the subnet mask should be equal ‘+ Remaining parts of the address define how many devices can be on the network. In this case, 255 then ‘IP standards: original vé does not provide enough permutations for each device on the Internet, so v6 was Introduces with vastly more combinations and uses hex. allowing fora greater range withing each group of numbers. AllIP concepts apply to both + IPva: xy.z.n~ each letter is @ number 0 to 255, 32-bit address, 4 groups of 8 bits “IPG: FEFF.FFFF-FFEF.FEFP-FEFE:FFPE-EFFESFFEF, 128-bit address, with 8 groups of 16 bits ‘+ Non-routable: only for internal use + 172A6xxt0 172.31.xx + 192,168xx ‘+ Endings: 0 Network Identifiers Address, 255 Network Broadcast Address, 1 Gateway ‘+ Routable: all others are public ‘+ Must be unique and registered (ata cost) ‘+ Routers know the difference; non-routable addresses are directed internally 6.10. DHCP ces er ‘+ Dynamic Host Configuration Protocol: a set of rules that issues unique IP addresses on a LAN, as devices connect to it ‘+ Stati: IP address remains the same ‘+ Dynamic: IP address is automaticaly allocated for the session (by 2 program upon logging on), but might be reserved/reused for later use + Very effcient for busy networks as an admin doesn't have to manually assign IP addresses to each device + Dedicated server: manages alist of assignable IP addresses and gives them to devices. A device may receive the next item in thelist, or thelr last used one 6.11. Network Address Translation (NAT) ‘+ Matches up private IP addresses with public ones. + Allows duplicate IP addresses across Internet + Increases security as private IP is not transmitted across Internet ‘+ Works by logging connections and mappings between Private IPs and port numbers, and corresponding public IPs, Entries are added toa translation table, where look Ups are performed + Process + Device on internal network sends request packet to server with internal IP and port number + Router replaces private IP with public IP and adds Its ‘own port number (unique only for a certain amount of time) + Router adds mapping data into translation table + Data sent back from server is received by router - looks up port number in translation table to work out Which device sent original request + If there is no match between port number and translation table, packet is dropped asit may be a hacking attempt (or nota valid response) + Public P replaced by private P and port numbers for device who requested data + Reply packet delivered to request device. Internal IP land port numbers are never made public on the ‘external network 6.12. Port Forwarding W/\W/\W/ZNOTES.ORG + Application of NAT that allows computers on the internet to connect to a service within a private network (with rnon-routable IP), by routing data through additional ports + Port: logical connection that uniquely identifies programs and services, used by them to exchange information + Process: client uses router's public IP address to initiate Routers programmed so requests and packets sent to specific ports are then forwarded to the device with the correct IP address on the neswork ‘+ Applications: remote desktop connections 6.13. Client-Server Model + Client sends request message to server, and server responds to request by replying with a response message to client ‘+ Websocket protocol: an API establishing full-duplex ‘socket connection between browser and server over ‘TCP. Persistent connection that allows both parties to send data atthe same time ‘Routed through port 80 + Sent in packets called messages, with very litle header data, so data transfer Is fast ‘+ API: subroutines that allow one program to interface with another + Enables accessing data from 3rd party + Hides system complexity from program + Extends functionality + Adds security by acting as a gate keeper ‘+ CRUD: acronym to describe the 4 main processes with databases. Without these, a database will ot be complete. Have a one-to-one SQL relationship ces er ‘+ REST (Representational State Transfer): methodology for implementing networked database, uses HTTP to carry out CRUD functions. + Client requests from server + Service requested isthe database defined in the URL, Which contains the query + APLrun from server and accessed by bowser to coordinate + HTML files used to ensure data is displayed in correct format on client side + Requests and data are transferred using HTTP + JSON or XML used to return query. ‘+ RESTful principles + Database connected to browser using REST relies on HTTP request methods + REST allows JavaScript to talkto server through HTTP ‘+ REST API created and run on server, browser JavaScript calls APL ++ JSON or XML can be used to transmit data + JavaScript references by HTML file + JSON vs XML ro ie Panna , 6.14. Thin vs. Thick Client Computing UWI ZNOTES.ORG + Thin: a powerful server with lots of resources is accessed by 2 lower-performance computer. The server runs the software and the machine acts asa terminal ‘+ Terminal: low-powered device with no hard-disk that displays the software running on the server + Thick: individual computers have more resources and Performance, so software is ran from the client end, The server doesn't need to be as powerful, and performs roles such as: authentication, file storage, backups and antivirus esbitpdne pn ener a aap: Fat RATT Ore oe iagepcireisvapene —_——_ ee 7. Fundamentals of Databases 7.1. Conceptual Data Models ‘+ Entities in a database can have relationships: * Oneto-one + One-to-many ‘+ Many-to-many (should be avoided) Cone Ae associated wth one & a 8 ne As associated wth one or more 8's eo Oe Cone or more A's ae abzocisted with ane or more Be a 8 7.2. Relational Databases ce as el ‘+The concept of database creation that uses tables of related data with relationships between the data. Data in different tables is inked together to express relationships that exist between data in ables ‘+ Entity: an object about which data willbe stored ‘+ Attribute: a piece of data or characteristic stored about each instance of an entity + Primary Key: an attribute that can be used to uniquely Identify each record within the table + Composite Primary Key: combination of two attributes to produce a primary key ‘+ Foreign Key: an attribute that links to the primary key in another tab, used to link tables together 73. Database Design and Normalisation + Use of normalisation + Remove data duplication + Eliminate data inconsistency ‘+ Ist Normal Form: atomic data test ‘+ 2nd Normal Form: no partial key dependencies ‘+ 3rd Normal Form: no non-key dependencies + Alldata must be atomic: no repeating groups/attibutes + Nopartial dependencies, where a non-key atribute depends on part, but not all of the primary key + Norion-key dependencies where a non-key attribute depends on another non-key atribute 7.4, Structured Query Language (SQL) ‘+ Data types in SQL in epee Date Do Mont erm + SQL operators + Define a table WWW.ZNOTES.ORG CREATE ATEASE CREATE TABE ‘ CColumnNane DATATYPE NULL/NOT NULL, ) + Define keys PRIMARY KEY (Field) FOREIGN KEY (Feld) REFERENCES (field) + Alter table ALTER TABLE oD <éata-type> ALTER TABLE DROP COLUM ALTER TABLE RENAME TO RENAME TO + Delete a table DROP TABLE + Update data UPDATE SET = WHERE + Insert data INSERT INTO (field1, field2 VALUES (valuet, value2...) + Delete data DELETE FROM WHERE DELETE * FROM DELETE FROM TRUNCATE TABLE + Retrieve data SELECT FROM WHERE setect * FROM WHERE + Order query results ces er SELECT FROM ORDER BY ASC/OESC + Group query results SELECT FROM (GROUP BY <#ield-nane> HAVING + Access multiple tables SELECT FROM SELECT FROM INER JOIN ON LEFT JOIN ON RIGHT JOIN ON ROSS JOIN ctable-nane2> 75. Client Server Databases WWW.ZNOTES.ORG + Database implementation where database is put onto a server and various users can access it + Issue: information can be shared by multiple users using different software at the same time + Maintain database integrity ‘+ Atomicity: any change must be fully completed or data returns to original state + Consistency: values in database should not change between devices + Isolation: each operation must occur in isola with no interruptions + Durability: any changes must be maintained, with no data loss + DBMS responsibilities ‘= Controls where data is stored, ‘The database structure, + Access permissions, + Data integrity, ‘+ What data programs can see. ‘+ Managing concurrent access: reading Is OX, issues ‘come from attempts to write at the same time ‘Record locks: if record is opened by a user with edit access, other users willbe told itis locked until that record is closed - prevents simultaneous edting + Serialisation: data sent one-after-another. OBMS tracks edits and updates data in order of edits 0 ensure data integrity ‘+ Time stamp ordering: each transaction is timestamped, that is used to sequence them, and DBMS uses this info to decide whether to process the transaction or not ‘+ Commitment ordering: looks at timestamp and also the change itself to decide if transaction is higher priority. Depends on nature of command and its impact on the database ‘+ Transaction processing: each database update should be a discrete operation, that should either succeed or fail Should occur in some sort of logical 8. Big Data ces er ‘+ Acateh-all term to describe data that doesnt fit in normal containers (eg. databases) + Description + Volume: too much data to fit into a single server + Velocity: high rate of data throughput to and from servers, with responses expected in miliseconds + Variety: not constrained into structured data types ‘+ Structured data: can be defined using traditional databases (fields and records) + Unstructured data: does not easily fit into a standard database structure, but stil has a‘standard’ structure 8.1. Challenges + Lack of structure: data analyssis significantly difficult and relational databases cannot be used (data wil not fit Into felds/records) ‘+ Machine learning: required to decipher patterns in qualitative data in order to extract any useful information ‘+ Pattern recognition: ina review system; looks for positive/negative words to reach conclusion ‘+ Artificial intelligence: computer learns for itself given large amounts of data - predictive analysis ‘Size: relative to all applications, impact is most significant when muliple servers are required to store data (eg. relational databases do not scale well across multiple servers and are therefore not appropriate) ‘+ Constant data streaming and change: sensors, clicks, keyboard inputs, personal data etc ‘+ Power demands: intense processing and storage + Correlations: do not always mean a results found 8.2, Distributive Processing W/\W/\W/ZNOTES.ORG + Required when data size and processing demands are so big that they cannot be handled by a single server ‘+ Main computer(s) allocate tasks to others; could be client-server or peer-to-peer ‘+ Distributed program: specifically written to be used ina distributed processing environment (deals with concurrent access and data integrity) ‘+ Functional programming: 3 solution to distributed processing ‘+ Features make it easier to write: + Correct cade * Distributed code + Supports: + Immutable data structures: data isnt deletes + Statelessness: no knowledge of what came before, or after ‘+ Higher-order functions: takes a function as @ parameter, produces a function as an output, or both 8,3, Modelling Big Data + Fact based model: each fact represents a single piece of information te ae 5 . ASS ‘enna erie Tribes ie on rogenn cA) + Graph schema for dataset structure ‘+ Nodes: data entities in the data structure ‘+ Edges: relationships between data entities ‘+ Properties: facts about data entities, ce as el Sy g. Functional Programming Paradigm Function Type ‘+ Function: a rule that for each element in set A's input, an output value is assigned, chosen from set B; without necessarily using every member of 8 Domain: a set from which input values are chosen, + Co-domain: a set from which the functions output values are chosen. Not all need to be outputs Function type: variable or parameter to which a function has or can be assigned, or an argument or result type of a higher-order function taking or returning a function + AB +f function type + A= argument type + B= result ype First Class Object ‘+ Afunction isa firstlass object + Inmany programming languages, they may be integers, characters, strings ete ‘+ FCO: can be an argument to another function, as well as the result of a function call. May: '+ Appear in expressions + Be assigned toa variable + Be assigned as argument + Be returned as function calls Function Application W/\W/\W/ZNOTES.ORG + Function applied to its single argument ‘© square: Int Int + square x= x% + Asingle argument could be a pair add: int Int + add (34)=344=7 Partial Function Application + Passing through less than the full number of arguments toa funetion that takes multiple arguments + The function takes one argument after another in order to produce aresult ‘+ Example: add takes two integers and produces an integer resuk ‘+ ‘Add 4’ produces a function ‘+ This function is then applied to another integer (3) + So4is added to 3 to produce an integer result of 7 add = Int — nt — Int + addxy=x+y + add4=4ey + add (4+ y)3=46357 Composition of Functions + Combining multiple functions to produce a new one + Composition of g and f (gf) + ga + GAB + gofisanew function * Domain: A + Co-damain: € + gefeuea? 9.1. Writing Functional Programs ce as el ‘+ Higher order function: takes a function as an argument, fr returns a function as a result, or both ‘+ Map: applies a given function to each element of a ist + Returns a list + map (*2){1, 2,3, 4,5.) + 511,4,9, 16,25.) ‘+ Filter: processes alist in an order to produce alist containing exactly the elements from the original list that ‘maten given conditions + Returns: a sublist + odd and even can be used in addition to numerical conditions. + filter 3) 1,2, 3,4, Sel 4,5.) ‘+ Fold (reduce): reduces alist of values toa single value by repeatedly applying a combining function to the values + Returns: a single value + Operator: (operator) ‘Start value: number between operator and list + fold (*)O[1, 2.3.4, 5] 5 92. Lists in Functional Programming W/\W/\W/ZNOTES.ORG + Usts are powerful data structures, where all the elements are homogeneous + Alistis always written in square brackets; + Identifier: the name of the lst ‘+ mylist=[1,2,3.4,5] or myList + Head: single frst element in a list ‘+ Tall: remainder lst once head has been removed 1.5) ‘+ Headttail sts can be represented as a combination of, the ist tall prepended onto the head + 12,345) + Empty lista ist can be empty, show by D + List operations + Return list head + head mytist = Return list tal + tall mylist= 2,3, 4,5) + Test for an empty list + null myList= false + Return length of Ist + length mylist = 5 + Construct an empty list + let ytis: + Prepend to list (must be element) + Smylist=(6,1,2,3,4,5] ‘+ Append to ist (must be list) 6,7,8)=(1,2.345,6.78) + mylist + AQAA Level Computer Science Cran Rone Soe oe ea) This version was created by Adenekan an Mon Feb 10 2025 for strictly personal use only. eee teeter een cast ee ‘The document contains images and excerpts of text from educational resources avalable on the internet and printed books. Iyou are the owner of such mecia, test or visual, utilized in this document and do not accept its usage then we urge you to contact us and we would immediately replace sald media. No part of this document may be copied or re-uploaded to another website, Under no conditions may this decument be distributed under the name of false author(s) or sold for financial gan, '2Notes" and the ZNotes logo are trademarks of ZNotes Education Limited (reg'stration UK00002478331),

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy