Exception handling in python
Sectio Topic / Description / Syntax Example
n Concept Details
I. Syntax Violates the Not a statement; if x > 5 print(x)←
Errors Error rules of the appears when code is missing colon causes
and language and written incorrectly. a syntax error.
Except is detected
ions before
Define execution;
d program will
not run until
corrected.
I. Exception Runtime error Raised automatically x = 10 /
Errors that can be or withraise 0raisesZeroDivisionErr
and handled to ExceptionType("mess or.
Except avoid a crash age").
ions and allow
Define controlled
d termination or
continuation.
II. Built-in Ready-made Use in handler:except int("abc")raisesValueE
Types Exceptions exception ValueError:or rror.
of classes in raise:raise
Except Python for ValueError("msg").
ions common error
situations.
II. ValueError Wrong or raise int("xyz")→ValueError.
Types inappropriate ValueError("Invalid
of value for a value")
Except valid data
ions type.
II. ZeroDivisio Denominator raise 10 /
Types nError is zero in a ZeroDivisionError("De 0→ZeroDivisionError.
of division nominator cannot be
Except operation. zero")
ions
II. IOError / Error in file or raise OSError("File open("[Link]")when
Types OSError input/output error") the file does not exist
of operation raisesOSError.
Except (e.g., file not
ions
found, cannot
open).
II. IndexError Index used for raise lst = [1, 2]; lst
Types a sequence IndexError("Index out →IndexError.
of (list, tuple, of range")
Except string) does
ions not exist.
II. TypeError Operation or raise "5" + 3→TypeError.
Types function TypeError("Wrong
of applied to type")
Except incompatible
ions data types.
II. NameError Use of a raise print(a)whenais not
Types variable or NameError("Unknown defined →NameError.
of function name name")
Except that is not
ions defined.
II. User-define Custom class class
Types d exception MyError(Exception): AgeError(Exception):
of Exceptions classes passthenraise passthenraise
Except created by the MyError("msg") AgeError("Invalid
ions programmer age").
for specific
conditions.
III. Raising When an error Automatic or raise
Raisin mechanism is detected, an explicitraise RuntimeError("Someth
g exception ExceptionType("mess ing went wrong").
Except object is age").
ions created and
normal flow
stops; control
goes to a
handler.
III. raise Explicitly raise if b == 0:\n raise
Raisin statement throws an ExceptionTypeorraise ZeroDivisionError("De
g exception. ExceptionType("mess nominator cannot be
Except age") zero").
ions
III. assert Tests a assert assert y != 0, "Divide
Raisin statement condition; if it conditionorassert by zero"beforex / y.
g is false, condition, "message"
Except raisesAssertio
ions nError, usually
for debugging
or validations.
IV. Catching Runtime Usetryfollowed by one try:\n x =
Handli process searches the or moreexceptblocks. int("a")\nexcept
ng and call stack for a ValueError:\n
Catchi matching print("Invalid").
ng handler; if
none is found,
the program
stops.
IV. try block Wraps code try:\n risky_code() try:\n x =
Handli that might int(input("Enter a
ng and raise number: ")).
Catchi exceptions;
ng execution
inside stops at
the point
where an
exception
occurs.
IV. except Contains code except ExceptionType except ValueError:\n
Handli block to handle as e:\n handler_code print("Invalid number").
ng and specific
Catchi exceptions;
ng multiple
except blocks
handle
different types.
IV. else clause Runs only if try:\n ...\nexcept ...:\n Useelseto print “All
Handli no exception ...\nelse:\n ... good” only when try
ng and occurs in the succeeds.
Catchi try block.
ng
IV. finally Always runs, try:\n ...\nexcept ...:\n Close a file
Handli clause whether an ...\nfinally:\n ... infinallyeven if an error
ng and exception was occurs during
Catchi raised or not; processing.
ng used for
cleanup work.
File handling in python
This is a minimized summary of the notes on File Handling in Python, focusing on essential
definitions, operations, and modules.
Minimized Notes on File Handling in Python
I. File Definition and Types
● A File is a named location for permanent data storage on secondary media.
● The io module contains functions for handling files.
● Types of Files:
1. Text File: Consists of human-readable characters (alphabets, numbers,
symbols). Examples include .txt, .py, .csv. Each line is terminated by an
End of Line (EOL) character.
2. Binary File: Stored as bytes (0s and 1s), representing non-human readable
characters (e.g., image, audio, executables). Requires specific software to
access its contents.
II. File Operations: Opening and Closing
● Opening: Files must be opened using the open() function.
○ Syntax: file_object = open("file_name", "access_mode").
○ Default mode is read mode (<r>) and text mode (for strings). Use binary
mode (b) for non-textual data.
● Closing: Use the close() function (file_object.close()) after operations.
Closing frees memory and ensures unwritten data is flushed to the file.
● with Clause: An alternative structure that automatically closes the file after
execution, removing the need for an explicit close() statement.
III. Writing and Reading Text Files
Method Mod Purpose Details Source(
e s)
Write w Used for writing. Erases previous data if the file
Mode exists.
Append a Used for writing. Adds new data to the end of the
Mode previous data.
write() w or Writes a single string Returns the number of
a to the file. characters written. Requires a
newline character (\n) to mark
the end of the line.
writeli w or Writes a sequence of Does not return the number of
nes() a strings (iterable, e.g., characters written.
list/tuple).
read(n) r Reads a specified Reads the entire file content if
number (n) of bytes. no argument or a negative
number is specified.
readlin r Reads one complete Returns a string.
e() line (up to \n).
readlin r Reads all lines and Lines become members of the
es() returns them as a list list.
of strings (including
\n).
IV. Random Access (Offsets)
● tell(): Returns an integer specifying the current byte position of the file object
from the beginning of the file.
○ Syntax: file_object.tell().
● seek(): Used to position the file object at a specific location.
○ Syntax: file_object.seek(offset [, reference_point]).
○ reference_point values: 0 (beginning, default), 1 (current position), 2 (end
of file).
V. Binary File Handling (pickle Module)
● The pickle module handles binary files, where data is dumped (not written) and
loaded (not read). It must be imported.
● Serialization (Pickling): Converts a Python object in memory to a stream of bytes.
○ Method: dump(data_object, file_object).
○ Requires opening the file in binary write mode (wb).
● De-serialization (Unpickling): The inverse process, converting a byte stream back
to a Python object.
○ Method: load(file_object).
○ Requires opening the file in binary read mode (rb).
Mechanism Purpose / Action Syntax / Details Sourc
e
tell() Used for accessing data in a Syntax:
Method random fashion15. Returns file_object.tell()15.15
an integer specifying the
current byte position of the
file object from the beginning
of the file15.
seek() Used to position the file Syntax:
Method object at a particular file_object.seek(offset [,
position in a file16. reference_point])16.
reference_point values: 0
(beginning, default), 1 (current
position), 2 (end of file)1617.1617
pickle Deals with binary files18. Data is dumped (not written) and
Module Must be imported to load loaded (not read)18.18
and dump data18.
Serialization The process of transforming Byte streams can be stored in a
(Pickling) data or an object in memory binary file, disk, database, or sent
(RAM) to a stream of bytes through a network19.19
(byte streams)19.
De-serializati The inverse of pickling, Also called unpickling19.19
on where a byte stream is
(Unpickling) converted back to a Python
object19.
dump() Used for pickling Python File must be opened in binary write
Method objects for writing data in a mode (wb)20. Syntax:
binary file19. dump(data_object,
file_object)20.1920
load() Used to unpickle (load) File must be opened in binary read
Method data from a binary file20. mode (rb)21. Syntax:
Store_object =
load(file_object)21.2021
Stack
The following minimized notes cover all the points regarding
the Stack data structure available in the sources.
Minimized Notes on Stack Data Structure
I. Definition and Core Principles
Conc Description Principle/Rule Sour
ept ce(s)
Data A specialized format for Allows for
Struct organizing, storing, and efficient access,
ure accessing data. Stacks manipulation, and
are fundamental data processing of
structures. data.
Stack An ordered collection Follows the LIFO
of elements. (Last-In
First-Out)
principle.
TOP The single end where Also known as
all additions the top of the
(insertions) and stack.
removals (deletions)
take place.
II. Stack Operations and Exceptions
Opera Action Exception Sour
tion Condition ce(s)
PUSH The insertion If an element is
operation; adds a new added to a full
element at the TOP of stack, it results
the stack. in an ‘overflow’
exception.
POP The deletion operation; If an element is
removes the top-most deleted from an
element of the stack. empty stack, it
results in an
‘underflow’
exception.
Other Functions can be The len()
Functi written to check if the function can be
ons stack is empty, find the used to find the
number of elements size of the Stack.
(size), and read the
value of the topmost
element.
III. Python Implementation
Implemen Mechanism Outcome/Feature Sour
tation ce(s)
Detail
Method The simplest Implementation uses
way to built-in list methods.
implement a
stack in
Python is
using the
built-in list
data type.
PUSH in Uses the Because Python lists
Python list’s have no fixed size limit,
append() the stack implemented
method to this way is dynamic
insert an and will typically never
element at face 'overflow' unless
the rightmost system memory runs
end (TOP). out.
POP in Uses the The pop() method is
Python list’s pop() used to remove the
method to topmost element.
remove the
element from
the end of the
list.
IV. Applications
Applicati Stack Role Example/Detail Sour
on Area ce(s)
String Used to traverse Characters of the
Manipulat and reverse a string are put into
ion string. the stack.
Editing/Hi Used for The system uses
story redo/undo a stack to keep
mechanism in track of changes
editors. made.
Web Used for The history of
Browsing backtracking browsed pages is
functions. maintained as a
stack when using
the back button.
Puzzles Used to solve the Involves moving a
Tower of Hanoi stack of disks
mathematical following specific
puzzle. rules.
Expressi Used to check for If parentheses are
on matched mismatched, the
Evaluatio parentheses compiler needs to
n when the compiler throw an error.
executes an
arithmetic
expression.
V. Expression Notation
Notatio Description Stack Role in Sour
n Conversion/Evalu ce(s)
ation
Infix Standard arithmetic Stacks are used to
expression convert
representation expressions from
(operators between Infix to Postfix
operands, e.g., x + notation.
y). Evaluation
follows the
BODMAS rule.
Postfix A different way of Stacks can be used
(Polish representing to evaluate an
Notatio arithmetic expression in
n) expressions, Postfix notation
introduced by Jan (assuming binary
Lukasiewicz. operators).
Evaluat If a character is an If the stack has a
ion operand, PUSH it single element at
Algorit onto the stack. If the end, that is the
hm the character is an net result;
(Postfix operator, POP two otherwise, the
) elements, apply the expression is
operator, and PUSH invalid.
the computed value
back onto the stack.
Queue
The query requests the minimized tabular format for Chapter 4 (Queue and Deque).
Minimized Notes on Queue Data Structure
I. Queue Definition and Core Principles
Concept Description Principle/Rule End Points Source(
s)
Queue An ordered linear Follows the FIFO New items are
list of elements. (First-In First-Out) added at the REAR
principle, also known as (or TAIL). Items are
FCFS (First Come First removed from the
Served). FRONT (or HEAD).
Data Specialized Queues are fundamental N/A
Structur format for data structures, widely
e organizing, used in algorithms.
storing, and
accessing data.
II. Queue Operations and Exceptions
Operation Action Exception Condition Usag Source(
e s)
ENQUEU Used to insert a new Overflow exception results if N/A
E element at the REAR insertion is attempted beyond
end of the queue. the capacity of a fixed-size
queue.
DEQUEU Used to remove one Underflow exception results if N/A
E element at a time from deletion is attempted from an
the FRONT of the empty queue.
queue.
PEEK Used to view the The element is viewed without
element at the FRONT removing it from the queue.
of the queue.
IS EMPTY Checks whether the Used to avoid the Underflow
queue has any element. exception.
IS FULL Checks whether any Used to avoid the Overflow
more elements can be exception.
added.
III. Python Implementation (Using list)
Feature Mechanism Details Source(
s)
Queue Uses the Python list data One way to implement queues
Creation type (Queue = list()). in a computer program.
ENQUEUE Uses the list’s append() Element is always added at the
function end of the list, which serves as
([Link](element)). the REAR.
Dynamic No implementation for IS Python lists are dynamic
Nature FULL is required. structures; the queue will
never face an explicit
overflow situation.
DEQUEUE Uses the list’s pop(0) Deletes the element from the
function. beginning (index ``) of the list,
which serves as the FRONT.
PEEK Reads the element at index ``. Returns the value at the
FRONT if the queue is not
empty.
Size/Length Uses the len() function. Returns the number of
elements in the queue.
IV. Applications of Queue
Application Role of Queue Source(s)
Area
Customer IVRS puts calls into a queue of customers
Service waiting to be serviced.
Real-life People waiting at an ATM or vehicles at a
Queues service station.
Printing Printer queues manage multiple user Service is based on
requests. FIFO order.
Web Servers Used to manage incoming requests from
clients.
Scheduling Used for task scheduling based on priority or
order of receipt.
Resource Manages and allocates resources like printers
Allocation or CPU processing time.
Operating Used to manage processes and resources.
System
Minimized Notes on Deque (Double Ended Queue)
V. Deque Definition and Operations
Concept Description Operations Allowed Source(
s)
Deque Also known as a Permits both insertion and
Double Ended Queue deletion operations from any
(“deck”). end (head/front or tail/rear).
Python Implemented using the N/A
Implementation list data type.
insertFront() Inserts an element at Uses list’s insert(0,
the front of the deque. element) method.
insertRear() Inserts a new element Implementation is the same as
at the rear of the queue's enqueue().
deque.
deletionFront Deletes an element Implementation is the same as
() from the front of the queue's dequeue() (pop(0)).
deque.
deletionRear( Deletes an element Uses list’s pop() method
) from the rear of the (without parameters).
deque.
getFront() / Reads the value from Returns a copy of the value at
getRear() the front/rear without the respective end (`` or
removing it. [len-1]).
VI. Applications of Deque
Application Detail Source(
Area s)
History Storing a web browser's history.
Editing Used for the Undo/Redo option in any text editor.
Palindrome Used to check whether a given string is a palindrome.
Check
Palindrome Characters are inserted using INSERTREAR. Matched
Algorithm characters are removed using DELETIONFRONT and
DELETIONREAR. If all match, the string is a palindrome.
Sorting
This response provides the minimized notes for Chapter 5 (Sorting) in a tabular format,
covering the definition of sorting, the three specified algorithms (Bubble, Selection,
Insertion), and Time Complexity analysis.
Minimized Notes on Chapter 5: Sorting and Time
Complexity
I. Sorting Fundamentals
Concept Definition Order/Applicability Source(
s)
Sorting The process of arranging Can be ascending (increasing),
an element in a specific descending (decreasing), or
order. alphabetical order (a-z or z-a) if the
collection is of strings.
Time Analysis performed to Allows estimating the number of
Complexity explain how an algorithm instructions executed relative to
will perform when the data size.
input size ($n$) grows
larger.
II. Sorting Algorithms
Algorith Mechanism and Definition How it Works (Steps Minimized) Source(
m s)
Bubble The simplest sorting 1. Start with the first element and
Sort algorithm. Works by compare it with the next element. 2.
repeatedly swapping If the current element is greater,
adjacent elements if they swap them; otherwise, move to the
are unordered. next element. 3. Repeat until the list
is sorted. Works in $n-1$ passes.
Selection Makes $(n-1)$ passes 1. Find the smallest element in the
Sort through the list. unsorted list and swap it with the
Conceptually divides the list first element of the unsorted list. 2.
into a sorted (left) list and Repeat this process (finding the
an unsorted (right) list. next smallest element) until all
elements are moved to their correct
position.
Insertion A simple algorithm that 1. Start with the second element
Sort works by iteratively (the first is assumed sorted). 2.
inserting each element of Compare the element with the
the unsorted list into its elements in the sorted portion and
correct position within the shift/swap them until the element is
sorted portion of the list. placed in its correct position. 3.
Repeat until the entire array is
sorted.
III. Time Complexity Rules
Structure / Time Complexity Classification Source(
Algorithm Type Estimate s)
No Loop 1 (Constant) Constant time algorithms (number
of instructions is constant,
regardless of data size).
Single Loop (1 $n$ Linear time algorithms (loop
to $n$) executes $n$ times).
Nested Loop $n^2$ Quadratic time algorithms.
(Loop within a
loop)
Rule for Mixed Estimated based on N/A
Loops the nested loop
only ($n^2$).
Complexity of $n^2$ Bubble Sort, Selection Sort, and
Sorting Insertion Sort all have a time
Algorithms complexity of $n^2$ according to the
rules.
Searching
The query asks for a minimized tabular summary of the Revision Notes for Class 12
Computer Science Chapter (Chapter 6: Searching), based on the new source material
provided.
Minimized Notes on Chapter 6: Searching Techniques
I. Searching Fundamentals
Concept Definition / Purpose Key Requirements Source(
s)
Searchin A key technique used to find Essential for retrieving data ,
g whether a particular value, efficiently from storage. The most
called the key, is present in a suitable algorithm depends on
collection and to determine its whether the data is sorted or not.
position.
II. Searching Algorithms
Algorithm Mechanism / Suitability / Time Source(
Principle Requirement Efficiency s)
Linear Search Simplest method; Does not Slow for large ,,
(Sequential/Serial checks each element require the list data; requires
) one-after-another to be in any at least 1 and
until the key is found particular order at most $n$
or the list is (suitable for comparisons.
exhausted. small and
unsorted
lists).
Binary Search Much faster technique; Only works Extremely ,,
cuts the search when the list efficient;
space in half with is sorted completes in
every step by (ascending or approximately
checking the middle descending $\log_2 n$
element. order). If the list steps on
is not sorted, average.
results will be
incorrect.
Hashing Computes an index Used for quick Fastest for ,,
(slot) directly from the lookups (e.g., single items
key using a hash dictionaries, (can be found
function (e.g., database in just one
$h(\text{element}) = indexing). operation if no
\text{element} % collision
\text{table_size}$) to occurs).
allow direct access in
a hash table.
Collision Occurs when two or Requires ,
more keys map to the collision
same hash index. resolution
techniques to
handle the
situation. A
perfect hash
function avoids
collisions.
III. Comparison and Application
Comparison Linear Search Binary Search Hashing Source(
Point s)
Prerequisite None (works on Must be sorted. Requires a hash ,,
unsorted data). function and table
structure.
Speed Slow for large lists. Very fast for Fastest for quick ,
large, sorted lists. lookups (can be
instant).
Applications Finding values in Searching phone Quick lookups ,
random/unordered directories, (e.g.,
lists. database country-capital
indexing, looking pairs),
up names in a dictionaries.
dictionary.
Implementatio Uses a simple loop Repeatedly Applies the hash ,
n to traverse the list. updates start/end function to find
positions and finds the location
the middle index. immediately.
Note problems in the test book for both 5 and 6
Understanding of data
The following minimized notes cover all the essential points from Chapter 7: Understanding
Data, presented in a tabular format.
Minimized Notes on Chapter 7: Understanding Data
I. Data Fundamentals and Storage
Concept Description / Definition Key Details Source(
s)
Data A collection of characters, Data is plural; the singular is ,,
numbers, and symbols that “datum”. Data must be gathered,
represents values of some processed, and analysed for
situation or variables. Data is conclusions.
crucial for decision
making.
Data Includes name, age, gender, Businesses use data to monitor ,
Sources banking transactions, market behavior and identify
images, web pages, online customer demands.
posts/messages, signals
from sensors, and satellite
data.
Data The process of storing data Common devices: Hard Disk ,,
Storage permanently on devices for Drive (HDD), Solid State Drive
later retrieval. (SSD), CD/DVD, Pen Drive,
Memory Card. Limitations of file
processing are overcome by
Database Management
Systems (DBMS).
Data Basic steps required to get Steps: Input (Collection, ,
Processin meaningful output from raw Preparation, Entry) $\rightarrow$
g Cycle data. Processing (Store, Retrieve,
Classify, Update) $\rightarrow$
Output (Reports, Results,
Information).
II. Types of Data
Type Structure / Format Examples Source(
s)
Structured Organized in a well-defined Marking attendance, filling ,,,,
Data format, usually tabular (rows and an application form online,
columns). Each column is an inventory lists, customer
attribute/variable. account records.
Unstructure Data lacking a predefined Recording a video, writing ,,,
d Data format or fixed structure (not tweets (text, images,
traditional rows/columns). emojis), web pages, text
documents, audio/video
files.
Metadata Data that describes data (data Image size/type; email
about data). subject, main body,
recipient.
III. Statistical Techniques for Data Summarisation
Statistical techniques help provide a preliminary understanding of the data.
Measure Classificatio Definition / Sensitivity / Purpose Source(
n Calculation s)
Mean Central Average of numeric Not suitable if outliers ,,,,
(Average) Tendency values. Calculated (exceptionally large or
as $\sum x_i / n$. small values) are present.
Used to find average
performance over time.
Median Central The middle value Represents the actual ,,
Tendency when data are central value dividing the
sorted. If an even data into two equal parts.
number of values
exist, it is the
average of the two
middle values.
Mode Central The value that Can be used for numeric ,,,
Tendency appears the most and non-numeric data. A
number of times dataset may have multiple
(highest frequency). modes or no mode. Used
for counting frequency.
Range Variability / The difference Tells about the ,,,
Dispersion between the coverage/spread of data
Maximum and values. Calculated only
Minimum values (M for numerical data; easily
– S). influenced by outliers.
Standard Variability / Measures the Used to compare ,,,,,
Deviation Dispersion spread or variation performance variation
($\sigma$) of values around the between groups or
mean. Considers all measure variation in age.
data values. Smaller $\sigma$ means
data are less spread.
IV. Data Collection and Application
Application / Data Required / Technique Used Source(
Goal Processing Step s)
Declare Exam Student name, roll number, Filtering and summarization.
Results class, grades, certificate
template.
Issue Name, age, contact, N/A
Biometric ID organization detail,
Cards biometric data
(fingerprint/photo).
Identify Collect marks (2 years) and Filtering students scoring $>
Scholarship family income data. 75%$ for 2 years AND income
Beneficiaries $< 5$ lakh.
Anchor Singing skill, writing skill, Direct observation and ,,
Selection monitoring skill. evaluation (auditions). Skills
represented as structured
data rated on a fixed scale.
Canteen Sales Purchase price, sale price, Mean (for profit calculation); ,,
Analysis units sold. Counting (for sales volume);
Range (for price variation).
Database concept
The query requests the minimized tabular format for Chapter 8 (Database Concepts).
Minimized Notes on Chapter 8: Database Concepts
I. File System Limitations vs. DBMS Need
System Limitation / Concept Description Source(
s)
File System File System Organizes files into
groups/folders; provides
media for reading, writing,
and deleting data. Requires
separate software to
access data within a file.
Limitation: Accessing data in a required
Difficulty in format is difficult; requires
Access writing an application program.
Limitation: The same data is duplicated
Data in different places (files).
Redundancy
Limitation: Occurs when the same data
Data maintained in different places
Inconsistency do not match.
Limitation: There is no link or mapping
Data Isolation between the data present in
files.
Limitation: If the structure/format of data
Data storage changes, all
Dependence application programs
accessing the file must also be
changed.
Limitation: Difficult to enforce specific
Controlled access controls when
Data Sharing accessing files through
application programs.
DBMS Database Management Application software used
System (DBMS) to create and manage
databases efficiently.
Overcomes the limitations
of file processing.
DBMS Allows users/applications to
Capabilities create, store, update, delete,
search, and retrieve specific
records from the database.
Ensures only valid and
accurate data is stored.
DBMS MySQL, Oracle, SQL Server,
Examples Microsoft Access, PostgreSQL,
MongoDB.
II. Key Concepts in DBMS
Concept Definition / Role Source(
s)
Database The design of a database (skeleton). Represents the
Schema structure, data types, constraints, and relationships
between tables.
Data Constraints Restrictions put on a table defining what type of data can
be stored in one or more columns. Defined during table
creation.
Data Dictionary Data about the data (database schema along with
(Metadata) constraints). Stored by the DBMS in the dictionary.
Database Defines the complete database environment and its
Instance components (set of memory structures and background
processes used to access files).
Query Used by users to access, retrieve, or manipulate data
from the database.
Data Operations used to easily manipulate data: Insertion,
Manipulation Deletion, and Updation.
Data Engine Underlying component used to create and manage
various database queries.
III. Relational Data Model (RDM)
RDM Definition / Analogy Example (Based Source(
Concept on a STUDENT s)
table)
Data Model Describes the structure of the database The Relational
(data definition, representation, Data Model is the
relationships, and constraints). most commonly
used model.
Relation A table in the relational model; stores The STUDENT
data across multiple columns. table itself.
Attribute A property defining an entity; the Regno, Name,
columns of a relation (also called fields). DOB, Gender are
Must have unique names. attributes.
Tuple A row in a relation; contains a set of (101, Rama,
attribute values describing a particular 2000-12-24, F) is a
entity. Must be distinct and their tuple.
sequence is immaterial.
Degree The number of attributes in a relation. STUDENT table
has a degree of 4.
Cardinality The number of tuples (rows) in a If STUDENT table
relation. has 6 rows, its
cardinality is 6.
Domain A unique set of permitted values for an The domain of the
attribute (defined by a data type). Regno attribute is a
set of integer
values.
Data Value All data values in an attribute must be
Properties from the same domain. Each data value
must be atomic (cannot be divisible).
NULL is used for unknown/non-applicable
values.
IV. Keys in Relational Database
Key Type Role / Purpose Constraint / Definition Source(
s)
Candidate One or more attributes Each is a candidate for the primary
Key that take distinct values key.
and can uniquely
identify the tuples in the
relation.
Primary The attribute chosen by Uniquely identifies a row in a table.
Key the database designer Remaining candidate keys are
(from candidate keys) to Alternate Keys.
uniquely identify the
tuples (rows).
Composite Used when no single Consists of more than one
Primary attribute can uniquely attribute taken together to serve as
Key distinguish tuples. the primary key.
Foreign Represents the An attribute whose value is derived
Key relationship between from the primary key of another
two relations (tables). relation (the master/primary
Used to refer contents relation). Can take NULL value if not
from another (referenced) part of the primary key of the foreign
relation. table.
Sql
This minimized summary covers all the key aspects of Structured Query Language (SQL)
detailed in the sources, presented in a single tabular format.
Minimized Notes on Chapter 9: Structured Query
Language (SQL)
Category Concept Description / Key Mechanism / Source(
Purpose Usage s)
(Minimized)
I. SQL The most popular Not case sensitive.
FUNDAMENTALS query language Used to define
for Relational structure, manage
Database data, and retrieve
Management data.
Systems
(RDBMS, e.g.,
MySQL, Oracle).
Data Types Indicates the type Determines the
of data an operations
attribute can hold. performable on the
data.,
Constraints Restrictions Not mandatory for
imposed on data every attribute.,,
values to ensure
correctness (e.g.,
Primary Key,
Unique).
SQL Commands DDL (Data
Categories categorized for Definition), DML
effective database (Data Manipulation),
management. DQL (Data Query),
TCL, DCL.
II. DATA CREATE Creates a new Must use USE
DEFINITION DATABASE database databasename
LANGUAGE instance. afterwards to select
(DDL) it.,
CREATE Defines the The number of
TABLE structure columns defines the
(schema/relation) degree of the
by specifying relation (N).,
attributes, data
types, and
constraints.
DESCRIBE/DE Used to view the Syntax: DESC
SC structure of an tablename;.
existing table.
ALTER TABLE Used to change Operations include
the structure ADD
(schema) of an (column/constraint
existing table. like PK, FK,
UNIQUE), DROP
(column/PK), or
MODIFY
(datatype).,,,,
DROP Permanently DROP DATABASE
Statement removes a table removes all tables
or database. within it.,
(Caution: Cannot
be recovered.)
III. DATA INSERT INTO Inserts new Text/date values
MANIPULATION records/rows into must be enclosed in
(DML) a table. single quotes (' ').,
UPDATE Modifies existing Requires SET
Statement records/values in attribute =
one or more value and a WHERE
columns.
clause to specify
rows.,
DELETE Removes one or Requires a WHERE
Statement more records from clause to prevent
a table. deleting all records.
When deleting
related tables,
delete the Foreign
Key (child) table
first.
IV. DATA QUERY SELECT Retrieves data Uses FROM clause to
LANGUAGE Statement from tables; also specify the table and
(DQL) known as a query optional WHERE
statement. clause for
conditions. * selects
all columns.,
AS Clause Used to rename a SELECT Ename AS
column while Name....,
displaying the
output (aliasing).
DISTINCT Used with
Clause SELECT to return
unique records,
without
repetition.,
WHERE Clause Filters data based Uses relational
on specified operators (=, <, >)
conditions. and logical
operators (AND, OR,
NOT).,
IN Operator Checks if a value Can be used as an
is present within a alternative to
set of values. multiple OR
conditions.
BETWEEN Selects records
Operator where the column
value falls within a
specified range
(inclusive).
ORDER BY Displays retrieved
Clause data in ascending
(default) or
descending
(DESC) order
based on a
column.,
LIKE Used for Wildcards: % (zero,
Operator substring one, or multiple
pattern matching characters) and _
in the WHERE (exactly one single
clause. character).,
NULL Values Represents a Arithmetic
missing or operations with
unknown value NULL return NULL.
(not zero). Use IS NULL
operator for
checking.
V. FUNCTIONS Single Row Applied to a single Types include
AND ADVANCED Functions value and return a Numeric (POWER(),
QUERYING single value ROUND(), MOD()),
(Scalar functions). String (case
change, length), and
Date/Time
functions.,
Multiple Row Work on a set of Examples: MAX(),
Functions records and MIN(), AVG(),
return a single SUM(), COUNT(),
summarized
COUNT(*).
value (Aggregate
functions).
GROUP BY Arranges identical
Clause data into groups,
often used with
aggregate
functions (e.g.,
calculating
average salary
per age group).,
Set Combine results UNION (combines
Operations of two relations distinct rows);
(tables). INTERSECT (gets
common rows);
MINUS (rows in 1st
table but not 2nd).
Requires relations to
have the same
number of
attributes and data
types.,,
Cartesian Combines tuples The resulting degree
Product (X) from two relations is the sum of
to produce all degrees, and
possible pairs of cardinality is the
rows. product of
cardinalities.,
JOIN Combines tuples $N-1$ joins are
Operation from two tables needed to combine
based on $N$ tables on
specified equality condition.,,
conditions
(usually PK-FK
equality).
NATURAL An extension of
JOIN JOIN that
automatically
removes the
redundant
common
attribute from the
result set.,
Computer network
This minimized tabular summary covers all essential points from Chapter 10: Computer
Networks, drawing only on the provided sources [217–262].
Minimized Notes on Chapter 10: Computer Networks
I. Fundamentals and Evolution
Concept Definition / Principle Key Details Source(
s)
Computer An interconnection among Allows sharing of data and
Network two or more computers or resources. Data is transmitted in
computing devices. smaller chunks called packets.
Devices can be wired or wireless.
Node / Any device that is part of a Examples: computer, server,
Host network and can receive, modem, hub, switch, router, printer.
create, store, or send data
to different network routes.
Evolution Network conceptualized in Key milestones include E-mail
1961 (ARPANET). The first (Roy Tomlinson, 1971), TCP/IP
message was (1974), the term Internet was
communicated between coined (1982), and WWW was
UCLA and SRI. developed by Berners-Lee (1990).
Internet Internet: The huge global WWW (World Wide Web): An
vs. WWW network of interconnected ocean of information stored as
computing devices (the trillions of interlinked web pages
largest WAN). and resources, accessible over the
Internet. Invented by Sir Tim
Berners-Lee in 1990.
II. Types of Networks (Geographical Scope)
Type Geographical Area Data Transfer Rate / Examples Source(
Covered s)
PAN (Personal Network formed by a Range is approximately 10 metres.
Area Network) few personal devices Can be wired (USB) or wireless
(e.g., phones, (Bluetooth).
laptops).
LAN (Local Limited distance, Provides high speed, short-range
Area Network) typically a single communication (10 Mbps to 1000
room, floor, office, Mbps). Secured for authentic users.
school, or campus. Can extend up to 1 km.
MAN Extended form of Data transfer rate is lower than LAN
(Metropolitan LAN, covers a larger but measured in Mbps. Examples:
Area Network) area like a city or Cable TV networks, cable
town. broadband internet services. Can
extend up to 30–40 km.
WAN (Wide Connects Large business/government
Area Network) LANs/MANs across organizations use WAN. The
different Internet is the largest WAN.
geographical
locations,
countries, or
continents.
III. Network Devices
Device Role / Function Key Detail Source(
s)
Modem MOdulator DEModulator. Connects both source and
Converts digital data (0s/1s) to destination nodes.
analog signals for transmission
and back.
NIC / Network Interface Card; acts Supports data transfer between
Ethernet as the interface between the 10 Mbps and 1 Gbps. Each NIC
Card computer and the wired has a unique MAC address.
network.
Repeater Regenerates weakened An analog device that works
signals that have travelled with signals on cables.
beyond their specified distance
(e.g., 100 m).
Hub Used to connect different Limitation: Data from two
devices; data arriving on one devices arriving simultaneously
line is sent out on all others. will collide.
Switch Connects multiple devices; Does not forward
sends signals only to selected noisy/corrupted signals; drops
devices based on the them and asks the sender to
resend.
destination address in the
packet.
Router Receives, analyzes, and Can analyze data, decide/alter
transmits data to other how it is packaged (e.g.,
networks (connects LAN to repackaging big packets into
the Internet). smaller ones).
Gateway Key access point that acts as a All data must pass through the
"gate" between an gateway. Often configured using
organization's network and the a router; firewall is usually
outside world (Internet). integrated with it.
IV. Node Identification and Protocols
Concept Description / Purpose Key Differences Source(
s)
MAC Media Access Control A 12-digit hexadecimal
Address (Physical/Hardware number (48 bits). The first six
address). A unique, digits are the manufacturer’s ID
permanent value associated (OUI). Cannot be changed.
with the NIC.
IP Address Internet Protocol address. Can change if a node is
A unique address used to moved to a different network.
identify each node in a IPV4 is 32-bit; IPV6 is 128-bit.
network that uses the
Internet Protocol.
Domain Maps human-readable Domain Name Resolution is
Name Domain Names the conversion process,
System (hostnames) to numerical IP performed by a DNS server
(DNS) Addresses. (which maintains a database of
these mappings).
WWW Fundamental technologies HTML: Used to design
Technologies invented for the World Wide standardized web pages.
Web. URI/URL: Unique address/path
for web resources. HTTP: Set
of rules used to retrieve linked
web pages (HTTPS is the
secure version).
V. Networking Topologies (Arrangement)
Topology Arrangement Mechanism Advantages / Disadvantages Source(
(Minimized) s)
Mesh Each device is connected Pro: Handles large traffic; reliable (if
with every other device in one node fails, transmission
the network. continues); secure. Con: High
cabling cost; complex wiring;
redundant connections.
Ring Each node is connected to Link is unidirectional (data
two other devices (one on transmitted in one direction only).
either side) forming a ring. Less secure and less reliable.
Bus Each device connects to a Pro: Cheaper and easier to
single backbone wire maintain. Con: Less secure and
known as the bus. less reliable.
Star Each device is connected to Pro: Effective, efficient, fast.
a central networking Disturbance in one device doesn't
device (hub or switch). affect the rest. Con: Failure of the
central device leads to complete
network failure.
Tree / A hierarchical topology Typically realized in WANs where
Hybrid combining multiple multiple LANs are connected.
branches, which may
include Star, Ring, or Bus
topologies.
Data communication
This minimized summary covers all the key aspects of Data Communication (Chapter 11)
detailed in the sources, presented in a single tabular format.
Minimized Notes on Chapter 11: Data Communication
Category Concept Description / Key Details / Source(
Principle Mechanism s)
(Minimized)
I. Data Exchange of Requires five ,,,,
FUNDAMENTALS Communicatio data (text, components:
n image, audio, Sender, Receiver
video) between (nodes), Message,
two or more Communication
connected Medium
devices. (channel/link), and
Protocols.
Protocols A set of Necessary for flow ,,,,,
standard rules control (handling
followed by speed mismatch),
communicating access control
parties for (preventing packet
successful and collision), and
reliable data defining data
exchange. format.
Bandwidth The range of Measured in Hertz ,
frequencies (Hz). Higher
available for bandwidth means
data higher data transfer
transmission rate.
(channel
capacity).
Data Transfer The number of Measured in bits ,
Rate bits per second (bps)
transmitted (Kbps, Mbps, Gbps,
per second (bit Tbps are higher
rate). units).
II. Simplex One-way Example: Data ,
COMMUNICATION (unidirectional) input via keyboard,
MODES communication. IoT appliance
control.
Half-duplex Two-way Transmission ,
(bidirectional) direction can be
communication, switched. Example:
but not Walkie-talkie.
simultaneousl
y.
Full-duplex Two-way Link capacity is ,
(bidirectional) shared. Example:
communication Mobile phones,
simultaneousl landline phones.
y.
III. SWITCHING Circuit Dedicated All packets follow ,
TECHNIQUES Switching path the same path.
established Example: Earlier
between telephone calls.
sender/receiver
before
communication
starts.
Packet Messages Packets may take ,
Switching broken into different routes.
small, Channel is
independently occupied only
routed packets during transmission
(header + of the packet.
message part).
IV. Guided (Wired) Uses a Examples: Twisted ,,
TRANSMISSION physical link Pair, Coaxial Cable,
MEDIA (wire/cable) for Fiber Optic Cable.
signal
propagation.
Unguided Data travels in Signals weaken ,,
(Wireless) the air as over distance;
electromagnet repeaters are
ic waves using installed to
an antenna. regenerate them.
Optical Fibre Carries data as High bandwidth, ,,
light signals long distance,
(uses immune to
refraction). electromagnetic
noise.
Unidirectional
(requires two
cables for full
duplex).
Electromagneti Spectrum Includes Radio ,,,,
c Waves ranges from 3 Waves
KHz to 900 (omnidirectional,
THz. penetrates walls),
Microwaves
(unidirectional,
line-of-sight), and
Infrared Waves
(high frequency,
short distance).
V. WIRELESS Bluetooth Short-range Uses 2.4 GHz ,,
TECHNOLOGIES wireless band. Devices form
technology (up a piconet in
to 10 meters). master-slave
configuration
(master handles up
to 7 active slaves).
Wireless LAN Local Area Uses Access ,
(Wi-Fi) Network based Points (APs)
on the IEEE connected to a
802.11 wired network to
standard. create the wireless
LAN.
Mobile Evolution of 1G (Voice only, ,,,,
Generations mobile analog); 2G (Digital
architecture voice, SMS/MMS);
based on data 3G (Digital voice +
type and data, faster speed);
speed. 4G (Broadband,
interactive
multimedia); 5G
(Expected Gbps
speed, designed for
IoT and M2M),,,,.
VI. PROTOCOL HTTP Primary Works as a ,
TYPES (HyperText protocol for client-server
Transfer accessing the (request-response)
Protocol) World Wide protocol over TCP.
Web (WWW). HTTPS is the
secure version.
FTP (File Used for Works on a ,,
Transfer transferring client-server model;
Protocol) files between handles issues like
two machines. different file naming
conventions or data
representation
formats.
PPP (Point to Establishes a Defines ,,
Point Protocol) dedicated, authentication and
direct link maintains data
between two integrity (intimates
communicating sender about
devices (e.g., damaged/lost
two routers). packets).
SMTP (Simple Used for email Uses header ,
Mail Transfer services information to route
Protocol) (transmission mail to the
of outgoing recipient’s mailbox
mail). queue.
TCP/IP Standardized IP assigns unique ,,,
(Transmission rules using a IP address to each
Control client-server node. TCP breaks
Protocol/Internet model. messages into IP
Protocol) packets, ensures
delivery and
sequential
ordering/reassembl
y at destination.
Security concept
This minimized summary covers all the key points regarding Chapter 12: Security Aspects,
presented in a single tabular format.
Minimized Notes on Chapter 12: Security Aspects
I. Malware Types and Definitions
Concept Definition / Purpose Key Mechanism / Distinction Source(
s)
Malware Malicious software Incurs financial damages globally.
intended to damage
hardware, steal data, or
cause user trouble.
Virus Malicious code created Spreads via contact (copying code)
to infect programs and remains dormant until the
(executable files) and infected file is executed/opened by a
hamper resources. user (human triggering).
Worm Malware causing Standalone programs that
unexpected or damaging self-replicate and spread through
behavior. the network without human
triggering or needing a host
program.
Ransomwa Malware that targets Encrypts or blocks access to data
re user data. and demands ransom payment
(e.g., Bitcoin) for recovery or to
prevent publishing data online.
Trojan Malware disguised as Does not self-replicate. Spreads
legitimate software. via user interaction
(attachments/downloads). Can
create backdoors for malicious
access.
Spyware Malware that spies by Used to track internet usage data
gathering information and capture sensitive information.
(credentials, usage data)
without user
knowledge or consent
and sends it externally.
Keylogger Software or hardware Used to leak sensitive information
that records all keys like passwords. Mitigated by using a
pressed on the Virtual Keyboard (which
keyboard. randomizes key layout).
II. Security Mechanisms and Countermeasures
Mechanis Description / Role Key Detail Source(
m s)
Antivirus Detects and removes a Requires regular updates of its
Software wide range of malware; Virus Definition File (VDF).
provides prevention and Methods include Signature-based
detection. detection, Sandbox detection
(virtual environment), and
Heuristics (pattern comparison).
Firewall Network security system Acts as a network filter based on
protecting a trusted predefined security rules. Types:
network from Network Firewall (between
unauthorised access or networks) and Host-based
traffic from untrusted Firewall (on a single computer).
external networks.
HTTP vs Protocols for transmitting HTTP sends data unencrypted
HTTPS data over the WWW. (vulnerable). HTTPS (Secure)
encrypts data before transmission
and requires an SSL Digital
Certificate.
Spam Unwanted data, typically in Email services use automatic
the form of unsolicited spam detection algorithms to filter
emails (advertisements, emails.
junk).
Cookie Small data packet stored Used to store browsing information
by a website on the (login credentials, cart items) to
client’s computer. enhance user experience.
Third-party cookies may
track/share data without consent.
Prevention General measures against Use antivirus, avoid pirated
malware. software, take regular data
backups, enforce firewall
protection, and avoid clicking
links/attachments in unsolicited
emails.
III. Threat Actors and Network Security Threats
Threat Description / Action Distinction / Impact Source(
s)
White Hat Uses knowledge ethically to Security experts hired by
Hacker find and fix security flaws. organizations.
Black Hat Uses knowledge unethically Acts with malicious intent.
Hacker to break the law and disrupt
(Cracker) security.
Grey Hat Neutral; hacks systems for the
Hacker challenge/fun without
monetary or political gain.
Denial of Limits authorized user access
Service (DoS) by overloading a resource
with illegitimate requests/traffic,
making the resource appear
busy.
Distributed A DoS variant where requests Difficult to resolve due to
DoS (DDoS) come from multiple multiple distributed attack
compromised computers sources.
(Zombies) globally, controlled
via a Bot-Net.
Snooping Secret capture and analysis Can be used by network
(Sniffing) of network traffic; listens to a administrators for
channel and copies packets. troubleshooting. Not
always real-time analysis.
Eavesdropping Unauthorised real-time Happens in real-time,
interception or monitoring of unlike snooping.
private communication (e.g.,
VoIP calls, instant messages).
Network Any unauthorised activity on Includes attacks like DoS,
Intrusion a computer network, Worms, Trojans, and
threatening security or Buffer Overflow Attacks.
misusing resources.