Data Transmission: Key Concepts
1. Structure of a Data Packet
● Packets are small units of data transmitted over a network.
● Packet Header: Contains control information (e.g., Destination
address, packet number and originator’s address).
● Payload: The actual data being transmitted.
● Trailer: Includes the error-checking information and indicates
the end of the packet. (e.g., checksum).
2. Packet Switching
● Definition: Data is broken into packets, transmitted across a
network, with the help of a router, and reassembled at the
destination.
● Key Points:
○ Efficient use of bandwidth.
○ Packets can take different routes to reach the destination.
○ Reduces latency in network congestion.
3. Methods of Data Transmission
● Serial Transmission: Bits are sent in a single direction over a
single wire.
○ Examples: USB, Ethernet.
○ Efficient for long-distance communication.
● Parallel Transmission: Multiple bits sent in a single direction
across several wires.
○ Example: Older printers.
○ Faster, but prone to data being skewed over long
distances.
3.1 Half-Duplex and Full-Duplex Transmission
● Half-Duplex: Data can travel in both directions, but not at the
same time (e.g., walkie-talkies).
○ Pro: Simple and cost-effective.
○ Con: Slower because data transmission must alternate
between directions.
● Full-Duplex: Data travels in both directions simultaneously
(e.g., telephones, Ethernet).
○ Pro: Faster communication as there’s no waiting for the
other side to stop transmitting.
○ Con: Requires more complex hardware to handle
simultaneous transmission.
4. USB Interface
● Universal Serial Bus (USB): A standard for connecting devices
to a computer.
5. Detecting Errors in Data Transmission
● Parity Check: Adds a parity bit to make the number of 1s either
even or odd.
● Checksum: Summation of data is sent alongside the data, and
re-calculated at the destination.
● Echo-check : An echo check is a way to find mistakes when
sending data. One device sends data, and the other device sends
it back. If the data matches, it’s correct. If it doesn’t match,
there was a mistake.
● Automatic repeat request : When data is sent, it might need to
be sent again if there’s an error. Automatic Repeat Request
(ARQ) helps with this by using acknowledgments and timeouts.
Here’s how positive acknowledgment works:
1. The sender sends a data packet.
2. The receiver checks for errors.
3. If there’s no error, the receiver sends a positive acknowledgement.
4. If the sender gets this acknowledgment, it sends the next packet.
If the sender doesn’t get an acknowledgment within a set time (a timeout), it
resends the packet. This repeats until an acknowledgment is received or a limit (like
20 tries) is reached.
the negative acknowledgment method of ARQ:
1. The sender sends a data packet.
2. The receiver checks it for errors.
3. If there are no errors, everything is fine, and it moves on.
4. If there are errors, the receiver sends a negative acknowledgement back to the
sender.
5. When the sender gets this negative acknowledgment, it knows the data was
wrong and resends the packet.
The sender also sets a timeout. If it doesn’t get a negative acknowledgement at that
time, it can go ahead and send the next packet without waiting.
● Check digit - A method is necessary to check for errors with data
entry and this method is called a check digit.
6. Encryption
● Definition: The process of converting data into a coded form to
prevent unauthorised access.
● Key Concepts:
○ Symmetric Encryption: Same key for encryption and
decryption.
○ Asymmetric Encryption: Uses a public key to encrypt and a
private key to decrypt.
○ Protects data from being intercepted during transmission.
Parallel Data Transmission: Advantages & Disadvantages
Advantages:
● Faster transmission speed: Since multiple bits are sent
simultaneously, large amounts of data can be transferred
quickly.
● Used for short-distance communication: Great for connections
like internal components of a computer (e.g., CPU to memory).
Disadvantages:
● Signal degradation: Over long distances, the signals travelling
on separate wires can become unsynchronized, causing data
errors.
● More expensive: Requires multiple physical channels/wires.
● Crosstalk: Interference between the channels can lead to
distortion and errors.
Databases
9.1. Structure of a Database
A database is an organised collection of data, typically stored and accessed
electronically. It is structured into tables that allow efficient storage,
retrieval, and manipulation of data. Each table consists of:
● Fields (also called columns) – These represent the attributes or
properties of the data.
● Records (also called rows) – Each record is a unique instance that
contains data for each field in the table.
● Primary Key – A unique identifier for each record in the table (e.g.,
Student_ID, ISBN number).
Example: Book List in a Library Database
Consider a library system where we maintain a table of books.
Book_ID Title Author Genre Published Availabil
(Primary Key) Year ity
001 Pride and Jane Fiction 1813 Available
Prejudice Austen
002 1984 George Dystopi 1949 Issued
Orwell an
003 Moby Dick Herman Fiction 1851 Available
Melville
Data Types
Integer
● Definition: Whole numbers, either positive or negative, with no decimal places.
● Examples: -10, 0, 25, 1024.
● Uses: Counting items, scores, ages.
Text ( there are always speech mark around them )
● Definition: A sequence of characters, often used for words and sentences.
● Examples: "Hello", "123 Main St.", "Grade 8".
● Uses: Names, addresses, descriptions.
Character ( there are always speech mark around them )
● Definition: A single letter, number, or symbol.
● Examples: 'A', '5', '%'.
● Uses: Initials, single-letter codes, symbols.
Boolean
● Definition: Represents one of two values: True or False.
● Examples: Yes/No, On/Off, 1/0.
● Uses: Conditions, decision-making in programs.
Real
● Definition: Numbers that include decimal points.
● Examples: 3.14, -7.5, 0.001.
● Uses: Measurements, prices, scientific data.
Date/Time
● Definition: Represents dates and times in a standardised format.
● Examples: "2024-01-01", "12:30 PM", "31/12/2023".
● Uses: Birthdates, event schedules, timestamps.
9.2. SQL (Structured Query Language)
SQL stands for Structured Query Language. It is a standardised language
used to manage and manipulate relational databases.
SQL is used to perform various actions, including:
● Define tables
● Change tables
● Add data to tables
● Search for data from tables (query)
● Perform calculations using data from tables
9.3. SELECT FROM Clause
The SELECT FROM clause is used to retrieve data from a database. It
specifies the fields (columns) you want to retrieve and the table(s) from
which to retrieve the data. (Refer to Example: Book List in a Library
Database)
Format:
SELECT fieldname
FROM tablename
Example:
Retrieve the title and author of all books from the Books table. (Refer to
Example: Book List in a Library Database)
SELECT Title, Author
FROM Books
Tip:
Names of the titles and the authors (text)
4. SELECT FROM WHERE Clause
The SELECT FROM WHERE clause retrieves data from a table based on
specific conditions.
Format:
SELECT field
FROM table
WHERE condition;
Example:
Retrieve all books where the genre is ‘Fiction’.
SELECT Title, Author
FROM Books
WHERE Genre = 'Fiction';
Tip :
NAme of the title and the author, where the book’s genre is fiction
Logical Operators in SQL ( more than one condition )
Logical operators are used to filter records based on multiple conditions in
the WHERE clause.
Operator Description Example (WHERE Clause)
= Equal to WHERE Author = 'George Orwell'
<> Not equal to WHERE Author <> 'Jane Austen'
> Greater than WHERE Published_Year > 2000
< Less than WHERE Published_Year < 2000
>= Greater than or equal WHERE Published_Year >= 1990
to
<= Less than or equal to WHERE Published_Year <= 1990
Boolean Operators
AND Combines two conditions WHERE Genre = 'Fiction' AND
(both true) Availability = 'Available'
OR Combines two conditions WHERE Genre = 'Fiction' OR
(either true) Genre = 'Dystopian'
9.6. ORDER BY Clause
The ORDER BY clause is used to sort the result set in either ascending
(ASC) or descending (DESC) order based on one or more columns. If none
of the options are given, the order is automatically set to ascending .
Format:
SELECT field
FROM table
ORDER BY column 1 [ASC|DESC],
Example:
Retrieve all books and sort them by Published_Year in descending order.
SELECT Title, Author, Published_Year
FROM Books
ORDER BY Published_Year DESC;
Title Author Name Published_Yea
r
George 1949
1984 Orwell
Moby Dick Herman 1851
Melville
Pride and Jane Austen 1813
Prejudice
7. SUM
The SUM function returns the total sum of a numeric column.
Format:
SELECT SUM(column_name)
FROM table_name
WHERE condition;
Example:
Find the total number of available books in the library:
SELECT SUM(Availability)
FROM Books
WHERE Availability = 'Available';
Tip : The answer will be an integer.
8. COUNT
The COUNT function returns the number of rows that match a specified
condition.
Format:
SELECT COUNT(field_name)
FROM table_name
WHERE condition;
Example:
Count the total number of books in the library:
SELECT COUNT(Book_ID)
FROM Books;
Tip : The answer will be an integer
Data representation
1.1 Binary and Hexadecimal
● Binary System: A base-2 numbering system that uses only 0s and
1s. Computers use binary as they operate through electronic signals
with two states (on/off).
● Hexadecimal System: A base-16 system used for more compact
representation of binary data. It includes numbers 0-9 and letters
A-F (where A = 10 and F = 15).
● Conversions:
○ Binary to Decimal: Sum the binary digits where each digit is
multiplied by 2 raised to the power of its position (starting
from 0 on the right).
○ Binary to Hexadecimal: Group binary digits in sets of four,
then convert each group to its hexadecimal equivalent.
○ Hexadecimal to Binary: Convert each hex digit to a 4-bit
binary equivalent.
1.2 Binary Manipulation and Negative Numbers
● Binary Addition: Similar to decimal addition but with two rules: 0+0
= 0, 1+0 = 1, 1+1 = 10 (carry 1), and 1+1+1 = 11 (carry 1).
● Subtraction with 2’s Complement:
○ 2’s Complement: A method for representing negative numbers
in binary. Invert all bits (1’s complement) and add 1 to get
the 2’s complement.
○ Used for subtraction, as it simplifies operations by allowing
the same addition circuitry for both addition and subtraction.
● Shifting:
○ Left Shift: Moves all bits left, adding a 0 at the right end.
Each shift left by one doubles the number.
○ Right Shift: Moves all bits right, discarding the rightmost bit.
Each shift right by one halves the number, rounding down.
1.3 How Computers Represent Text, Sound, and Images
● Text Representation:
○ ASCII (American Standard Code for Information Interchange):
Represents 128 characters using 8 bits.
○ Unicode: An extended character set that supports characters
from various languages and symbols, using up to 32 bits.
● Sound Representation:
○ Sampling: Sound is captured by measuring the amplitude at
regular intervals (samples). The sample rate (samples per
second) and bit depth (bits per sample) determine quality.
○ Digital Audio Formats: WAV (lossless) and MP3 (compressed).
● Image Representation:
○ Bitmap (Raster): Images are divided into pixels, each pixel
representing a colour value. Higher resolution images have
more pixels, making the image clearer but larger in size.
○ Vector Graphics: Images represented through mathematical
formulas for shapes, which are resolution-independent and
smaller in size.
○ All image file types use different encoding methods to store
image data as binary.
Calculating File size:
Key points needed: No.of.Images, Resolution=_____ x _____, Bit depth or
colour depth.
Process:
1. Multiply the resolution first, then multiply it with the no.of.images
and last, multiply it with the bit depth.
2. Convert it to the necessary unit ( The automatic unit is byte ).
Example:
The students have 20 images to store, that have a resolution of 150x250
and colour depth of 16-bit.Calculate the size of the file that stores the
images in MiB.
Solution:
No.of.images=20, Resolution= 150x250, Colour/bit depth = 16.
Calculation:
➗ ➗1024 =
1. 150x250=37500,37500x20=750000x16=12000000
➗
2. 12000000 bits 8= 1500000 bytes, 1500000 bytes
1464.8 Kib 1024, = 1.4 MiB
Final Answer : 1.4 MiB
1.4 Measuring Data Storage
● Units of Data:
○ Bit: Smallest unit, a binary digit (0 or 1).
○ Byte: 8 bits.
○ Kilobyte (KB): 1,024 bytes.
○ Megabyte (MB): 1,024 KB.
○ Gigabyte (GB): 1,024 MB.
○ Terabyte (TB): 1,024 GB.
● Storage Devices:
○ Primary Storage: Includes RAM (volatile memory) and ROM
(non-volatile).
○ Secondary Storage: Hard drives, SSDs, and external storage for
long-term data.
1.5 Data Compression
● Purpose: Reduces file sizes for efficient storage and faster
transmission.
● Types of Compression:
○ Lossy Compression: Reduces file size by removing less
important data, often used for images (JPEG) and audio
(MP3). Some quality is lost, but this may be acceptable for
multimedia files.
○ Lossless Compression: Compresses data without losing any
information, suitable for text and data files where accuracy is
critical (e.g., ZIP files).
Errors in chapter 1:
Overflow error : Error from attempting to represent a number that is too
long to represent.
Round-off error : Error from attempting to represent a number that is too
precise. The value is rounded.