OCR A Level Computer Science 1.3 Exchanging Data Study Notes

Compression Methods and Applications

Compression is the fundamental process of reducing the size of a file, which serves two primary purposes: minimizing the required storage space on a medium and increasing the speed at which the file can be transferred across a network. When data is sent over a network, smaller files consume less bandwidth and necessitate less time for uploading and downloading.

Lossy compression functions by permanently discarding some data from the original file to reduce its size. This method is most suitable for media types such as images, audio, and video, where a slight loss in quality is acceptable for the sake of efficiency, such as in social media or streaming services. The primary advantage of lossy compression is its ability to produce significantly smaller file sizes compared to lossless methods. However, its main drawback is that the original data can never be fully restored once the information is discarded.

Lossless compression reduces file size without any permanent loss of data, ensuring that the original file can be recreated exactly. This is essential for text files, program files, databases, and legal or medical records where absolute data integrity is required. While the advantage is that the decompressed file is identical to the original, the drawback is that the resulting file sizes are typically larger than those achieved through lossy compression.

Run Length Encoding (RLERLE) is a specific lossless compression technique that identifies repeated consecutive values and stores them as a single value accompanied by a count. For example, the string "AAAAABBCC" would be encoded as 5A2B2C5A2B2C. RLERLE is most effective when data contains long runs of repeated values, such as simple bitmap images with large monochromatic areas. Conversely, it performs poorly when there are few repeated consecutive values, as the encoded file may not actually decrease in size.

Dictionary coding is another lossless method where repeated patterns, words, or sequences of bytes are replaced with shorter references stored in a dictionary. It is highly effective for compressing repeated phrases. A critical requirement for this method is that the dictionary itself must be stored or transmitted alongside the compressed data, as the receiver requires it to map the codes back to the original patterns.

Encryption and Hashing Principles

Encryption is the process of scrambling data using an algorithm and a key to ensure it cannot be understood without decryption, thereby protecting the confidentiality of data during storage or transmission. Plaintext refers to the original readable data, while ciphertext refers to the unreadable, scrambled output. A key is a specific value used by the encryption algorithm to perform these transformations.

Symmetric encryption involves the use of a single secret key for both encryption and decryption. The advantage of this method is its speed and efficiency when processing large volumes of data. However, it presents a security challenge because the secret key must be shared between the sender and receiver; if this key is intercepted, the security of the data is compromised.

Asymmetric encryption utilizes a pair of mathematically related keys: a public key and a private key. The public key is shared openly and is used by others to encrypt data intended for the owner. The private key is kept strictly secret and is the only key capable of decrypting data encrypted with the matching public key. This system can also be used for authentication; a sender can sign data with their private key, which others can then verify using the sender's public key. Although highly secure, asymmetric encryption is slower and more computationally expensive than symmetric encryption.

Hashing involves applying a hash function to data to produce a fixed-length output known as a hash value or digest. Hashing is deterministic, meaning the same input will always produce the same hash value. A robust hash function must be one-way, making it infeasible to reverse-engineer the original input from the hash value. While hash functions aim to produce unique outputs, a collision occurs if two different inputs produce the same hash value. Collisions should be extremely rare to prevent security weaknesses or incorrect matches.

Hashing is fundamentally different from encryption because it is intended to be non-reversible. It is commonly used for secure password storage, where the system stores the hash of a password rather than the password itself. It is also used for checking data integrity; if a file is tampered with, its hash value will change. Additionally, hashing is used in hash tables where a key is hashed to determine the storage location of a record. Digital signatures utilize both hashing and asymmetric encryption to verify the authenticity and integrity of a message.

Database Fundamentals and Relational Structures

A database is an organized collection of data designed for efficient storage, searching, updating, and management. This is typically controlled by a Database Management System (DBMSDBMS), which is the software used to query and manage access to the data.

Flat file databases store all data in a single table or file. While they are simple to create and easy to understand for small datasets, they often lead to data redundancy, inconsistency, and inefficient storage. In contrast, relational databases store data across multiple related tables linked through keys. This structure reduces data duplication and improves consistency.

Core database components include entities (the items about which data is stored, such as a Customer), attributes (properties of an entity, such as a price), tables (collections of records), records (individual rows representing a data entry), and fields (specific items of data in a record, usually a column).

Keys play a vital role in maintaining the structure of a relational database. A primary key is a field that uniquely identifies each record. A composite or compound primary key is formed when two or more fields are combined to create a unique identifier. A foreign key is a field in one table that refers to the primary key of another table, establishing a relationship between them. A secondary key is an indexed field used to speed up searches, though it does not have to be unique.

Entity Relationship (ERER) modeling involves representing entities and their interactions, often via ERER diagrams. These relationships can be one-to-one (1:11:1), one-to-many (1:M1:M), or many-to-many (M:MM:M). Many-to-many relationships are typically implemented using a linking or junction table containing foreign keys from both related tables.

Database Normalization and Integrity

Normalization is the process of organizing a database to reduce data redundancy and improve data integrity and maintainability. Data redundancy is the unnecessary duplication of data, which can lead to data inconsistency, where the same data differs across different locations.

First Normal Form (1NF1NF) requires that every field contain atomic values (single, indivisible values), that there are no repeating groups, and that every row has a unique identifier.

Second Normal Form (2NF2NF) requires the table to be in 1NF1NF and ensures that every non-key attribute depends on the entire primary key. It eliminates partial dependencies, which occur when an attribute depends only on a portion of a composite primary key.

Third Normal Form (3NF3NF) requires the table to be in 2NF2NF and ensures there are no transitive dependencies. A transitive dependency occurs when a non-key attribute depends on another non-key attribute rather than directly on the primary key.

Indexing involves creating a data structure that stores the location of records ordered by a specific field. This significantly speeds up data retrieval and searches. However, indexing requires additional storage space and can slow down data modification operations such as inserts, updates, and deletes.

Referential integrity ensures that relationships between tables remain valid. This means that a foreign key must always refer to an existing record in the related table. A common integrity problem occurs if a record is deleted while other tables still point to it. This can be enforced through foreign key constraints, restricted deletes, and cascaded updates or deletes.

SQL and Transaction Processing

Structured Query Language (SQLSQL) is the standard language for managing relational databases. Key commands include:

  • SELECTSELECT: Retrieves data from tables.
  • FROMFROM: Specifies the source tables.
  • WHEREWHERE: Filters records based on conditions.
  • ORDERBYORDER\,BY: Sorts the results.
  • INSERTINSERT: Adds new records.
  • UPDATEUPDATE: Modifies existing records.
  • DELETEDELETE: Removes records.

Transaction processing treats a sequence of database operations as a single logical unit of work called a transaction. A transaction must either complete entirely or be rolled back to its initial state. This is governed by the ACIDACID properties:

  • Atomicity: The "all-or-nothing" rule ensures every operation in a transaction succeeds or none are applied.
  • Consistency: The transaction must transition the database from one valid state to another, following all predefined rules and constraints.
  • Isolation: Concurrent transactions must be executed in a way that they do not interfere with each other.
  • Durability: Once a transaction is committed, the changes are permanent, even in the event of a system failure.

Record locking is used to prevent multiple users from modifying the same record simultaneously, which avoids lost updates and maintains consistency. However, this can lead to a deadlock, where two or more transactions are permanently waiting for each other to release locks.

Network Architectures and Protocols

A network consists of two or more connected devices that communicate to share resources, data, and centralized services. Networks are categorized as Local Area Networks (LANLAN), covering small areas like a home or office, or Wide Area Networks (WANWAN), covering large geographical distances, often using third-party infrastructure. The internet is the most prominent example of a WANWAN.

A protocol is a set of rules that devices must follow to communicate reliably. Standards are agreed specifications that ensure compatibility across different manufacturers. Common protocols include:

  • HTTPHTTP: For transferring web resources.
  • HTTPSHTTPS: Secure, encrypted HTTPHTTP.
  • FTPFTP: For file transfers.
  • SMTPSMTP: For sending emails.
  • POP3POP3 and IMAPIMAP: For accessing emails from a server.

The TCP/IPTCP/IP stack is a layered suite of protocols for internet communication. Protocol layering provides modularity, makes troubleshooting easier, and allows one layer to be updated without affecting others. The four layers are:

  1. Application Layer: Provides services for applications (HTTPHTTP, FTPFTP, SMTPSMTP, DNSDNS).
  2. Transport Layer: Manages end-to-end communication, splits data into packets, and adds port numbers. TCPTCP provides reliable, ordered delivery, while UDPUDP offers fast, connectionless communication without guarantees.
  3. Internet Layer: Routes packets across networks and adds source and destination IPIP addresses.
  4. Link Layer: Handles physical transmission and uses MACMAC addresses for local delivery.

Encapsulation is the process of adding headers and trailers to data as it moves down the stack, while de-encapsulation is the removal of these as the data moves up the stack at the destination.

Network Security and Hardware

Key networking addresses include IPIP addresses (logical addresses for routing), MACMAC addresses (unique hardware addresses for network interface cards), and port numbers (identifying specific applications/services). A socket address refers to the combination of an IPIP address and a port number. The Domain Name System (DNSDNS) translates human-readable domain names into IPIP addresses.

Data can be moved via packet switching or circuit switching. Packet switching divides data into independent packets that may take different routes and arrive out of order, using resources efficiently. Circuit switching establishes a dedicated, consistent path for the duration of the communication, which provides predictable bandwidth but can waste resources when no data is sent.

Network threats include malware (malicious software), phishing (social engineering to steal data), and Denial of Service (DoSDoS) or Distributed Denial of Service (DDoSDDoS) attacks (flooding services with traffic). Brute force attacks involve attempting many passwords until one works.

Security measures include firewalls (monitoring and filtering traffic based on rules), proxy servers (acting as an intermediary to hide IPIP addresses and cache content), and encryption. Hardware includes Network Interface Cards (NICNIC), switches (forwarding frames within a LANLAN using MACMAC addresses), routers (forwarding packets between networks using IPIP addresses), wireless access points, and modems (converting signals for transmission media like copper or fiber optic cable).

Networking models include client-server, where central servers provide resources to clients (allowing centralized management but creating a single point of failure), and peer-to-peer (P2PP2P), where devices have equal status (simple and cheap but harder to secure and manage).

Web Technologies and Document Structure

HyperText Markup Language (HTMLHTML) defines the structure of web pages. It uses tags in angle brackets to describe elements. The document is contained in <html> tags, with a <head> section for metadata (like <title>) and a <body> section for visible content (such as <h1> to <h3> for headings, <p> for paragraphs, <a> for hyperlinks, and <img> for images).

Cascading Style Sheets (CSSCSS) are used to separate presentation from structure, ensuring styling consistency. CSSCSS consists of selectors identifying elements and declarations (property-value pairs like color: blue;). CSSCSS can be inline (within the element), internal (within a <style> tag), or external (in a separate .css file).

JavaScript is a scripting language used for interactivity, such as form validation or updating content dynamically. It uses variables, constants, selection (ifif statements), iteration (loopsloops), and functions. The Document Object Model (DOMDOM) is the representation of the webpage that JavaScript interacts with.

Search Engine Indexing and PageRank

Search engines discovery pages through crawling (using bots or spiders to follow links) and indexing (storing page information in a searchable database). Crawlers extract text, metadata, and keywords to facilitate fast retrieval. Ranking determines the order of search results.

The PageRank algorithm estimates page importance based on the quantity and quality of links pointing to it. A link acts as a "vote"; links from more important pages carry more weight. A damping factor is included to model the probability of a user jumping to a new page, which avoids infinite loops. Modern search engines also factor in relevance, freshness, and mobile-friendliness. The robots.txt file is used by websites to instruct crawlers on which areas should not be indexed.

Server-Side vs. Client-Side Processing

Client-side processing occurs on the user's device. It provides fast interaction and reduces server load, but depends on the client's browser and can be disabled by the user. Common tasks include form field checks and menu displays.

Server-side processing occurs on the web server before the response is sent. It is better for sensitive data, database access, and authentication. While more secure and consistent, it increases server load and can be slower due to transmission time. Tasks include logging in, processing payments, and generating dynamic content.

Exam Techniques and Common Misconceptions

When answering exam questions on these topics, specific focuses should be maintained:

  • Compression: Justify choices based on file size, quality, and the necessity of exact recovery.
  • Encryption: Contrast symmetric and asymmetric methods based on key exchange, speed, and standard use cases.
  • Hashing: Emphasize fixed-length, one-way, and deterministic properties.
  • Database Design: Identify entities, relationships, and the role of normalization in reducing redundancy.
  • SQL: Ensure correct table/field names, conditions, and sorting logic.
  • Hardware: Name devices and specify their exact role (e.g., routing by IPIP or switching by MACMAC).
  • Networking Models: Compare central control versus cost and scalability.
  • Web Processing: Link the location of processing to speed, security, and database access.

Common pitfalls to avoid include stating that DNSDNS stores websites (it only translates names), claiming PageRank only counts the number of links (quality matters), or suggesting normalization only reduces file size (its main goal is consistency and integrity).