Professional Documents
Culture Documents
Class XII
Term2 (Quick Revision)
STACK :
• A stack is a linear data structure in python in which addition and deletion of
elements can be done at one end only.
• A stack is known as LIFO (Last – In, First – Out) data structure in python.
• LIFO means the elements which are added in the last would be the first one
to remove.
• Examples of stack are pile of books, pile of plates or stack of carom coins.
Operations on Stack:
There are two main operations on Stack:
1. Addition of element on the Top of the Stack is called PUSH.
2. Removal of element on the Top of the Stack is called POP.
Unit II: Computer Networks
A computer network is an interconnection of two or more computers or computing
devices. A network allows computers to share data and resources among each
other.
Node :In a communication network, each device that is a part of a network and that
can receive, create, store or send data to different network routes is called a node.
Server :It is a special computer which provide services to other computer/devices
in a called clients.
Client :A computer/device connected in a network sending request to server is
called client.
Types of Network
Based on the geographical area covered and data transfer rate, computer networks
are broadly categorised as:
1. PAN (Personal Area Network)
2. LAN (Local Area Network)
3. MAN (Metropolitan Area Network)
4. WAN (Wide Area Network)
2. Baud: The number of changes in a signal per second is known as baud. It is the
measuring unit of the data transfer rate. Technically, baud refers to a number of
discrete signal elements transmitted per second. 1 baud represents only 1 signal
change per second and is equivalent to 1 bit per second.
4. Data and Signals: Information that is stored within computer systems and
transferred over a computer network can be divided into two categories—data and
signals. Data are entities that are stored in the form of 0’s and 1’s, which convey
some special meaning to the computer system. When this data is transmitted from
one place to another, it is converted into signal. Signals are the electric or
electromagnetic encoding of data and are used to transmit data.
5. Communication/Transmission Media: It is a means of communication or
access (lines of communication) set up between two organizations to exchange
data/information. Communication media is the way of transmitting the signal from
one place to another. Communication media is also known as transmission media.
It plays an important role in sending and receiving of data to and from the sender
and receiver.
6. Data Transfer Rate: It is the amount of data transferred in one direction over a
link divided by the time taken to transfer it in bits per second (bps). The various
measuring units are bits per second (bps) and bytes per second (Bps) or baud,
kilobits per second (kbps), megabits per second (mbps), gigabits per second (gbps),
terabits per second (tbps.)
Switching Techniques
The main goal of networking is the reliable exchange of data or information among
several interconnected nodes. For the delivery of data with accuracy, various types
of switching techniques are used, namely:
1. Circuit Switching
2. Packet Switching
3. Message Switching
Transmission media
Network Devices
Those devices which are used to connect computer, laptop, printer etc. to create a
network are called networking device. for example Modem, Hub, Switch, Router
etc
2. Ethernet Card : also known as Network Interface Card (NIC card in short) is a
network adaptor used to set up a wired network. It acts as an interface between
computer and the network. It is a circuit board mounted on the motherboard of a
computer. Each NIC has a MAC address, which helps in uniquely identifying the
computer on the network.
3. Repeater : Data are carried in the form of signals over the cable. These signals
can travel a specified distance (usually about 100 m). Signals lose their strength
beyond this limit and become weak. A repeater is an analog device that works with
signals on the cables to which it is connected. The weakenedsignal appearing on
the cable is regenerated and put back on the cable by a repeater.
4. Hub : An Ethernet hub is a network device used to connect different devices
through wires. Data arriving on any of the lines are sent out on all the others. The
limitation of hub is that if data from two devices come at the same time, they will
collide.
6. Router : A router is a network device that can receive the data, analyse it and
transmit it to other networks. A router connects a local area network to the internet.
A router can be wired or wireless. A wireless router can provide Wi-Fi access to
smartphones and other devices.
7. Gateway : As the term “Gateway” suggests, it is a key access point that acts as a
“gate” between an organisation’s network and the outside world of the Internet.
Gateway serves as the entry and exit point of a network, as all data coming in or
going out of a network must first pass through the gateway in order to use routing
paths. A gateway can be implemented as software, hardware, or a combination of
both. This is because a network gateway is placed at the edge of a network and the
firewall is usually integrated with it.
Networking Topologies
The arrangement of computers and other peripherals in a network is called its
topology. Common network topologies are mesh, ring, bus, star and tree.
Network Protocol
It is set of rules or standard that governs communication.
Types of Protocol
(a) TCP (Transmission Control Protocol)
(b) IP (Internet Protocol)
(c) FTP (File Transfer Protocol)
(d) PPP (Point-to-Point Protocol)
(e) SMTP (Simple Mail Transfer Protocol)
(f) POP3 (Post Office Protocol)
(g) TELNET (Remote Login)
• WWW : : WWW is a set of programs and protocols that allows the user to
create and display multimedia web pages and is linked to the internet.
• Hyper Text Markup Language (HTML) : HTML is a Markup language that
enables users to create web pages and format them using predefined tags.
Tags are called coded elements.
• Extensible Markup Language (XML) : XML is a Markup Language for
creating documents in a structured format. Users can create their own tags
along with predefined tags already defined by HTML.
• web browser : A web browser is a WWW client that navigates through the
WWW and displays web pages.
• Domain names
o A domain name is a website's address on the Internet.
o Domain names are used in URLs to identify to which server belong a
specific webpage.
o The domain name consists of a hierarchical sequence of names
(labels) separated by periods (dots) and ending with an extension.
• URL :- URL stands for Uniform Resource Locator. A URL is nothing more
than the address of a given unique resource on the Web or address of a
website. The URL is an address that matches users to a specific resource
online, such as webpage.
• Website:- a website is a group of web pages, containing text, images and all
types of multi-media files.
• Web Server: - A web server is a computer that stores web server software
and a website's component files (e.g. HTML documents, images, CSS style
sheets, and JavaScript files).
• Web Hosting:- Web hosting is an online service that enables you to publish
your website or web application on the internet. When you sign up for a
hosting service, you basically rent some space on a server on which you can
store all the files and data necessary for your website to work properly.
Unit III: Database Management
RDBMS Terminology:
a. Relation: Tables in Relational Database
b. Attributes: Columns in a Relation
c. Tuples: Records/Rows in a relation
d. Degree: No. of attributes in a relation
e. Cardinality: No. of Tuples/records in a relation
f. Domain: Set of values taken for an attribute
g. Primary key: Key attribute that uniquely identifies a tuple
• Only one primary key in a relation
• No null values in primary key column
• No values can be repeated in a primary key column
h. Candidate keys: Set of attributes have the ability to become primary key
i. Alternate keys: All the candidate keys except primary key
Candidate key = primary key + alternate key
Alternate key = candidate key - primary key
j. Foreign key: A non-key attribute which is used to set relationship between 2
tables .The values of the foreign key are derived from the primary key of
another table.
Foreign key is also known as Referential Integrity constraint
Aggregate Functions
Aggregate Functions is used to perform calculation on group of rows and return the
calculated summary.
1. SUM()
2. AVG()
3. MAX()
4 .MIN()
5. COUNT()
Cross Join (Cartesian Product) The SQL CROSS JOIN produces a result set
which is the number of rows in the first table multiplied by the number of rows in
the second table if no WHERE clause is used along with CROSS JOIN.This kind
of result is called as Cartesian Product.
SQL EQUI JOIN performs a JOIN against equality or matching column(s) values
of the associated tables. An equal sign (=) is used as comparison operator in the
where clause to refer equality.
NATURAL JOIN is a type of EQUI JOIN and is structured in such a way that,
columns with the same name of associated tables will appear once only.
Basically the process of transfer data between python programs and MySQL
database is known as Python Database Connectivity. To connect python program
with any database like MySQL we need to create an interface / connection between
Python and MySQL.
To interfacing Python with MySQL we need a connector called “mysql
connector”.
Once the connector is installed, we are ready to connect our Python program to
MySQL Database.
These are the 5 steps we should follow to connect the Python program to
MySQL.
STEP 1 :- Open Python.
STEP 2:- Import the required package using following command – import
mysql.connector
STEP 3:- Use connect( ) function to establish the connection.
The syntax of connect( ) method is – connect(host=,user=, passwd=[,database=])
• Server_name :- Name of database server, generally it is given as
“localhost”
• User_name :- Name of the database user by which we connect with mysql
generally it is given as “root”
• Password :- It is the password of user “root” or associated with the
username.
• Database:- It is the name of database to which we want to connect with.
STEP 4:- Execute SQL Commands and fetch Rows. The next step after the
successful connection is to write SQL command and fetch rows. You have to
create a cursor object for executing SQL command and fetch rows. Cursor object is
a special kind of structure that processes the data row by row in database. You can
create cursor object in the following manner.
To perform the DML operations like insert, update or delete follow these steps:
• Create a cursor object.
• Write command as parameters for execute() function
• Use commit() function to save the changes and reflect the data in the table.
For Select Command :- As we know the select command is used to retrieve
records from the database. The result is available in the resultset or dataset. You
can store the select the command in cursor object in python. Then for resultset you
can use any of the the fetch…() functions. These are:
• fetchall(): It will retrieve all data from a database table in form of record or
tuple or a row.
• fetchone(): It will retrieve one record from the resultset as a tuple or a list. It
returns the records in a specific order like first record, the next time next
record and so on. If records are not available then it will return None.
• fetchmany(): It will retrieve a number of records from the database. If
records are not available then it will return an empty tuple.
• rowcount: It is one of the properties of cursor object that return number of
rows fetched from the cursor object.
STEP 5 :- To close the connection. The last step for Python MySQL connectivity
is closing the connection. Finally, we have to close the established connect using
close() function. It will help to clean up the memory. Syntax code: mycon.close()