Python Notes
Python Notes
COMPUTER SCIENCE
Python
GUI Programming
Support
Literal Punctuator
Operator
Identifier triggers an action when applied to variables Keyword
name given to differnt parts of program
Reserved word with special
Numeric
meaning Boolean
literal
String literal eg.
literal {}
eg.
e.g []
True
"abc" @
Logical Floating False
Arithmetic Integer point :
operator
operator literal literal
eg. NOT Assignment #
eg. + , - , *, /, operator eg. 12 eg. 23.3
AND Relational ""
% etc. operator eg. eg. =
eg. variable, OR eg.
function > , < , <=, >=
break if else NOT
name, , ==
etc.
objects etc.
sequence of characters
String eg. - "abcd", "1234", "_xyz" , "A12"
Data Types
a group of comma seperated values of any datatype between square
Identify type of List brackets
data eg. - [ 1,'a',76.3]
None
Empty value
Mutable Immutable
(modifiable types) (non - modifiable types)
List Integers
Dictionaries Boolean
String
Tuple
Strings String slices Strings are sliced using eg. - word = " myclass"
stored as individual (part of the string or range of indices print( word[ 2:]
characters in string [n:m] output : class
continguous sub string)
locations
1. string. capitalize()
2. string.find( str , start, end)
3. string.isalnum()
String Functions 4. string. isdigit()
<string object> . <method name> () 5. string.upper()
6. string.lower()
ord( char) – returns ASCII value of a character
7. string.lstrip()
eg. - ord (‘A’) output: 65 8. string .rstrip()
chr (int) – returns character corresponding to 9. string.split()
ASCII value of passed integer value
eg. - chr (97) output : a
eeg
seq = L [start:stop:step]
List Slicing eg. - lst [0:10:2]
* it is similar to string slicing
1. list.index ( <item>)
2. list. append (<item>)
3. list.extend(<list>)
4. list.insert(<pos>, <item>)
List 5. list.pop(<index>)
Functions 6. list.remove( <value>)
7. list.clear()
8. list.count(<item>)
9. list.reverse()
Developed by - Meetu Singhal PGT (Computer Science)
Kendriya Vidyalaya No 3 Agra
10. list.sort()
Tuples are depicted by round seq= T [start:stop]
brackets. Some examples of eg. - tup = (10,12,15,20,30,32,50)
tuples are: Tuple Slicing
tup [3:4]
() # empty tuple output : (20, )
(7 ,) # tuple with one member
(1,2,3) Creating a tuple is known as packing
( 'a', 'b', 'c') eg. t= (1,2,'a','b')
('a', 1 , ' one', 3.8) Creating individual values from tuple
Tuples is known as unpacking.
Packing and
Immutable e.g. w,x,y,z=t
unpacking tuples
sequence print (w,x,y,z)
output : 1 2 a b
1. len(<tuple>)
2. max( <tuple>)
3. min (<tuple>)
Tuple Functions
4. <tuple>.index(<item>)
5. <tuple>.count(<item> )
6. tuple( <sequence>)
1. len ( <dictionary>)
2. <dictionary>.clear()
3. <dictionary>.get( <key>)
Dictionary
4. <dictionary>.items()
Functions
5. <dictionary>. keys()
Developed by: Meetu Singhal PGT (Computer Science)
6. <dictionary>. values()
Kendriya Vidyalaya No 3 Agra
7. <dictionary>. update (<other-dictionary>)
Sorting is arranging elements in
specific order either in ascending or
Sorting
descending Techniques
• Types of Functions
passing in Python.
defined in a function.
Why functions?
• Code reuse
We can import those module in any program and we can use the
functions.
Functions in modules
We can import a module with the help of import statement. The
import statement can be used in two forms:
a=int(input(“Enter a value”)
print(cal(a)) Function call
Function Header: First line of function definition begins with def and
ends with :
Parameters: Variables listed in the parenthesis of function header
Function Body: Indented statements below function header that
defines the action performed by function.
docstring: The first statement in this block is an explanatory string
which tells something about the functionality. it is optional.
Structures of Python Program
def function1():
:
:
def function2():
:
:
def function3():
:
:
#__main__ Python begins execution from
Statement 1 here i.e. #__main__
Statement 2
Flow of execution in a function call
• The FLOW OF EXECUTION refers to the order in which
statements are executed during a program.
return c
num1=int(input(“Enter value”))
1. Positional arguments
2. Defaults arguments
3. Keywords arguments
4. Variable Arguments
Positional Arguments
The function call statement must match the number and order of
arguments as defined in the function definition, this is called the
Positional argument matching.
In this no value can be skipped from function call or you can’t change the
order of arguments also
If a function definition header is like.
def check(a,b,c):
:
:
then possible function calls for this can be:
check(x,y,z) #a gets value x, b gets value y, c gets value z
Python offers a way of writing function calls where you can write any
argument in any order provided you name the arguments when
calling the function.
a. info(obj) a. Correct
b. info(spacing=20) b. Incorrect
c. info(obj2, 12) c. Correct
d. info (obj3,collapse=0) d. Correct
e. info() e. Incorrect
f. info(collapse=0,obj3) f. Incorrect
a. Correct obj is positional parameter for object, spacing gets value 10, collapse
gets value 1
b. Incorrect as required positional argument missing.
c. Correct as objects gets value obj2, spacing gets value 12, collapse gets default
value 1
d. Correct as required parameter object gets value obj3, collapse gets value 0,
skipped argument spacing gets default value 10
e. Incorrect as required parameter object’s value can’t be skipped.
f. Incorrect as Positional argument should be before keyword argument.
Returning Values From Functions
➢Functions returning some value(non void functions)
➢Functions not returning any value(void functions)
y=[5,2,4,7]
sum(y)
Question1
Find and write output of the following:
def check( n1=1,n2=2):
n1=n1+n2
n2+=1
print(n1,n2)
check()
check(2,1)
check(3)
Output is:
33
32
53
Q.1 Write a function that takes a number as a argument and calculates
cube for it. The function does not return a value. If there is no value
passed to the function in function call, function should calculate cube of
2.
File handling: Need for a data file, Types of file: Text files, Binary files
and CSV (Comma separated values) files.
● Text File: Basic operations on a text file: Open (filename – absolute
or relative path, mode) / Close a text file, Reading and Manipulation
of data from a text file, Appending data into a text file, standard input /
output and error streams, relative and absolute paths.
● Binary File: Basic operations on a binary file: Open (filename –
absolute or relative path, mode) / Close a binary file, Pickle Module –
methods load and dump; Read, Write/Create, Search, Append and
Update operations in a binary file.
● CSV File: Import csv module, functions – Open / Close a csv file,
Read from a csv file and Write into a csv file using csv.reader ( ) and
csv.writerow( ).
CONTENTS COVERAGE IN THIS PRESENTATION
File handling: Need for a data file, Types of file: Text files,
Binary files & CSV Files
● Text File: Basic operations on a text file: Open (filename –
absolute or relative path, mode) / Close a text file.
WHY DO WE NEED FILES
Till now whatever programs we have written, the standard input in coming from keyboard and output
is going to monitor i.e. no where data is stored permanent and entered data is present as long as
program is running . After that execution, the programmatically generated data is disappeared. And
when we again run those programs we start with a fresh data.
Why? This is because that data is entered in RAM which is temporary memory and its data is
volatile.
However, if we need to store the data, we may store it onto the permanent storage which is
not volatile and can be accessed every time.. Here, comes the need of file.
Files enables us to create, update, read, and delete the data stored through our python program.
And all these operations are managed through the file systems.
Program in RAM
(Random Access Hard
Memory) Disk
What is a file in python
A file (i.e. data file) is a named place on the disk where a
sequence of related data is stored.
In python files are simply stream of data, so the
structure of data is not stored in the file, along with data.
It contains data pertaining to a specific application, for
later use. The data files can be stored in two It It contains data
pertaining to a specific application, for later use.
2
TYPES OF FILES
1. TEXT FILE
2. BINARY FILE
3. CSV FILE
1. TEXT FILE
2. Text files only stores texts 2 Binary Files are used to store binary CSV are used to stores data such as a
data such as image, video, audio, text spreadsheet or database
3. There is a delimiter EOL (End of Line 3. There is no delimiter A comma-separated values file is a
i.e \n) delimited text file that uses a comma
to separate values
4. Due to delimiter text files takes 4. No presence of delimiter makes files CSV is faster to handle as these are
more time to process. while reading or to process fast while reading or writing smaller in size. Moreover CSV is easy
writing operations are performed on operations are performed on file. to generate
file.
5. Text files easy to understand 5. Binary files are difficult to understand. CSV is human readable and easy to
because these files are in human read manually
readable form
OPENING AND CLOSING FILES
OPENING AND CLOSING FILES
myfile = open(“story.txt”)
here disk file “story.txt”is loaded in the memory and
its reference is linked to “myfile” object, now python
program will access “story.txt” through “myfile”
object.
here “story.txt” is present in the same folder where
.py file is stored otherwise if disk file to work is in
another folder we have to give full path.
OPENING FILE
myfile = open(“d:\\mydata\\poem.txt”,”r”)
here we are accessing “poem.txt” file stored in
separate location i.e. d:\mydata folder.
at the time of giving path of file we must use double backslash(\\) in place of
single backslash because in python single slash is used for escape
character and it may cause problem like if the folder name is “nitin” and we
provide path as d:\nitin\poem.txt then in \nitin “\n” will become escape
character for new line, SO ALWAYS USE DOUBLE BACKSLASH IN
PATH
Another solution of double backslash is using “r” before the path making
the string as raw string i.e. no special meaning attached to any character
as:
myfile = open(r“d:\mydata\poem.txt”,”r”)
Absolute Vs Relative PATH
To understand PATH we must be familiar
with the terms: DRIVE,
FOLDER/DIRECTORY, FILES.
Our hard disk is logically divided into many
parts called DRIVES like C DRIVE, D DRIVE
etc.
Absolute Vs Relative PATH
The drive is the main container in which we put
everything to store.
The naming format is : DRIVE_LETTER:
For e.g. C: , D:
Drive is also known as ROOT DIRECTORY.
Drive contains Folder and Files.
Folder contains sub-folders or files
Files are the actual data container.
Absolute Vs Relative PATH
DRIVE
DRIVE
Folders/Subfolders
FOLDER
DRIVE/FOLDER/FILE HIERARCHY
C:\
DRIVE
SALES IT HR PROD
FOLDER FOLDER FOLDER FOLDER
SALES IT HR PROD
FOLDER FOLDER FOLDER FOLDER
.\2019\SHEET.XLS
Relative addressing
Current working
directory
C:\
DRIVE
SALES IT HR PROD
FOLDER FOLDER FOLDER FOLDER
For Ex:
f=open(“notes.txt”, ‘r’)
This is the default mode for
a file.
notes.txt is a text file and is
opened in read mode only.
FILE ACCESS MODES - EXAMPLE
For Ex:
f=open(“notes.txt”, ‘r+’)
For Ex:
f=open(“tests.dat ”, ‘rb’)
For Ex:
f=open(“tests.dat”, ‘rb+’)
For Ex:
f=open(“tests.dat”, ‘ab+’)
For example:
f.close()
THANK YOU &
HAVE A NICE DAY
UNDER THE GUIDANCE OF KVS RO AGRA
VEDIO LESSON PREPARED BY:
KIRTI GUPTA
PGT(CS)
KV NTPC DADRI
TEXT FILE READING & WRITING METHODS
FILE READING
PYTHON
PROGRA
M
1. readline() METHOD
2. readlines() METHOD
3. read() METHOD
readline() METHOD
For example
Contd…
read() METHOD EXAMPLE
read() METHOD EXAMPLE O/P
fileobject.read([size])
For Example:
f.read(1) will read single
byte or character from a file.
read(size) METHOD EXAMPLE
PYTHON
PROGRA
M
1. write () METHOD
2. writelines() METHOD
1. write () METHOD
Now we can observe that while writing data to file using “w” mode the previous
content of existing file will be overwritten and new content will be saved.
If we want to add new data without overwriting the previous content then we
should write using “a” mode i.e. append mode.
write() USING “a” MODE
New content is
added after
previous content
2. writelines() METHOD
fileobject.writelines(seq)
2. writelines() METHOD
Example:
f = open('test2.txt','w')
str = 'hello world.\n this is my first file
handling program.\n I am using python
language"
f.writelines(str)
f.close()
Example Programs
Writing String as a record to file
Example :To copy the content of one file to
another file
Removing whitespaces after reading
from file
read() and readline() reads data from file and
return it in the form of string and readlines()
returns data in the form of list.
All these read function also read leading and
trailing whitespaces, new line characters. If
you want to remove these characters you can
use functions
strip() : removes the given character from both
ends.
lstrip(): removes given character from left end
rstrip(): removes given character from right end
Example: strip(),lstrip(),
rstrip()
File Pointer
myfile = open(“ipl.txt”,”r”)
ch = myfile.read(1)
ch will store first character i.e. first character is consumed, and file pointer will
move to next character
File Modes and Opening position
of file pointer
FILE MODE OPENING POSITION
r, r+, rb, rb+, r+b Beginning of file
w, w+, wb, wb+, w+b Beginning of file (overwrites the file if
file already exists
a, ab, a+, ab+, a+b At the end of file if file exists otherwise
creates a new file
Set File offset in Python
Tell() Method
This method gives you the current offset of the file pointer in a file.
Syntax:
file.tell()
The tell() method doesn’t require any argument.
Seek() Method
This method can help you change the position of a file pointer in a file.
Syntax:
file.seek(offset[, from])
The <offset> argument represents the size of the displacement.
file.seek(offset[, from])
If from is 0, then the shift will start from the root level.
If from is 1, then the reference position will become the current position.
It from is 2, then the end of the file would serve as the reference position.
Example: Setting offsets in Python
with open('app.log', 'w', encoding = 'utf-8') as f:
#first line
f.write('It is my first file\n')
#second line
f.write('This file\n')
#third line
f.write('contains three lines\n')
#Open a file
Most programs make output to "standard out“,input from "standard in“, and error
messages go to standard error).standard output is to monitor and standard input is
from keyboard.
e.g.program
import sys
a = sys.stdin.readline()
sys.stdout.write(a)
a = sys.stdin.read(5)#entered 10 characters.a contains 5 characters.
#The remaining characters are waiting to be read. sys.stdout.write(a)
b = sys.stdin.read(5)
sys.stdout.write(b)
sys.stderr.write("\ncustom error message")
THANK YOU &
HAVE A NICE DAY
UNDER THE GUIDANCE OF KVS RO AGRA
VEDIO LESSON PREPARED BY:
KIRTI GUPTA
PGT(CS)
KV NTPC DADRI
KVS RO AGRA
BINARY FILES
&
CSV(COMMA SEPARATED VALUES) FILES
KVS RO AGRA
BINARY FILES
CREATING BINARY FILES
KVS RO AGRA
SEEING CONTENT OF BINARY FILE KVS RO AGRA
CONTENT OF BINARY
FILE
PICKELING AND UNPICKLING USING PICKLE MODULE
KVS RO AGRA
PICKELING AND UNPICKLING USING PICKEL
MODULE KVS RO AGRA
pickle.dump() Method
pickle.dump() Method KVS RO AGRA
dump(object ,fileobject)
pickle.dump() Method
# A program to write list sequence in a binary file KVS RO AGRA
KVS RO AGRA
pickle.load() Method
pickle.load() Method
KVS RO AGRA
pickle.load() method is used to read the binary file.
CONTENT OF BINARY
FILE
BINARY FILE R/W OPERATION USING PICKLE MODULE
import pickle
Wr_file = open(r"C:\Users\lenovo\Desktop\python files\bin1.bin", "wb") KVS RO AGRA
myint = 56
mylist = ["Python", "Java", "Oracle"]
mystring = "Binary File Operations"
mydict = { "ename": "John", "Desing": "Manager" }
pickle.dump(myint, Wr_file)
pickle.dump(mylist, Wr_file)
pickle.dump(mystring, Wr_file)
pickle.dump(mydict, Wr_file)
Wr_file.close()
f = open(r"C:\Users\lenovo\Desktop\python files\Emp.dat",'rb')
Found = False
eno=int(input("Enter Employee no to be searched"))
while True:
try:
dict1 = pickle.load(f)
if dict1['Empno'] == eno:
print('Employee Num:',dict1['Empno'])
print('Employee Name:',dict1['Name'])
print('Salary',dict1['Salary'])
Found = True
except EOFError:
break
if Found == False:
print('No Records found')
f.close()
UPDATE RECORD OF A BINARY FILE
import pickle
KVS RO AGRA
f = open(r"C:\Users\lenovo\Desktop\python files\Emp.dat",'rb')
rec_File = []
r=int(input("enter Employee no to be updated"))
m=int(input("enter new value for Salary"))
while True:
try:
onerec = pickle.load(f)
rec_File.append(onerec)
except EOFError:
break
f.close()
no_of_recs=len(rec_File)
for i in range (no_of_recs):
if rec_File[i]['Empno']==r:
rec_File[i]['Salary'] = m
f = open(r"C:\Users\lenovo\Desktop\python files\Emp.dat",'wb')
for i in rec_File:
pickle.dump(i,f)
f.close()
DELETE RECORD OF A BINARY FILE
import pickle KVS RO AGRA
f = open(r"C:\Users\lenovo\Desktop\python files\Emp.dat",'rb')
rec_File = []
e_req=int(input("enter Employee no to be deleted"))
while True:
try:
onerec = pickle.load(f)
rec_File.append(onerec)
except EOFError:
break
f.close()
f = open(r"C:\Users\lenovo\Desktop\python files\Emp.dat",'wb')
for i in rec_File:
if i['Empno']==e_req:
continue
pickle.dump(i,f)
f.close()
KVS RO AGRA
CSV Disadvantages
• No standard way to represent binary data
• There is no distinction between text and numeric values
• Poor support of special characters and control characters
• CSV allows to move most basic data only. Complex configurations cannot be imported and
exported this way
• Problems with importing CSV into SQL (no distinction between NULL and quotes)
CSV file handling in Python
KVS RO AGRA
import csv
with open(r'C:\Users\lenovo\Desktop\python files\new.csv','w') as wr:
a=csv.writer(wr,delimiter=",")
a.writerow(["Roll no","Name","Marks"])
a.writerow(["1","Rahul","85"])
a.writerow(["2","Priya","80"])
wr.close()
Content of CSV file
KVS RO AGRA
Reading from CSV file
KVS RO AGRA
RACHANA KATIYAR
PGT(COMPUTER SCIENCE)
K V NOIDA 2ND SHIFT
WHAT IS NETWORK ?
A network is a collection of computers, servers, mainframes, network
devices, peripherals, or other devices connected to one another to allow the
sharing of data. An example of a network is the Internet, which connects
millions of people all over the world. To the right is an example image of a
home network with multiple computers and other network devices all
connected.
ADVANTAGES OF NETWORK
RESOURCE SHARING
COST SAVING
COLLABORATIVE USER INTERACTION
TIME SAVINGS
INCREASED STORAGE
DISADVANTAGES OF NETWORK
If network are badly managed, services can become unusable and
productivity fails
If software and files held centrally, it may be impossible to carry out
any work if the central server fails.
File security is more important especially if connected to WAN e.g.
protection from viruses
To handle network of organization you may need specialist staff to
run the network
EOLUTION OF NETWORKS
• The MSB or LSB bit of an 8 bit word is used as parity bit and the remaining 7 bits are used
for data. The parity bit may be even parity or odd parity.
• Even parity means the number of 1’s in the message should be even (2,4,6…)
• Odd parity means the number of 1’s in the message should be odd (1,3,5…)
• Parity bit can be set to 0 or 1 depending on the type of parity used.
Two dimensional parity checking
Performance can be improved by using two-dimensional parity check, which organizes
the block of bits in the form of a table. Parity check bits are calculated for each row,
which is equivalent to a simple parity check bit. Parity check bits are also calculated for all
columns then both are sent along with the data.
Media Access Control (MAC)
• A Media Access Control address is a 48-bit address that is used for communication between
two hosts in the network. It is a hardware address of manufactured into NIC. It can not be
changed later. It is also known as physical address.
• Each Computer or node on a network needs a special circuit known as a Network Interface
Card (NIC) or LAN Card.
• IPv4 (Internet Protocol Version 4) is the fourth revision of the Internet Protocol (IP) used to
identify devices on a network through an addressing system.
• An IPv6 address is represented as eight groups of four hexadecimal digits, each group
representing 16 bits (two octets, known as hextet). The groups are separated by colons (:).
An example of an IPv6 address is: 2001:0db8:85f3:0000:0000:8f2e:0370:7334
IPV4 IPV6
It is a 32-bit number It is a 128-bit number
The format is X.X.X.X, where X is octet takes The format is X.X.X.X.X.X.X.X, where X is
0-255 values. hexadecimal takes 0-ffff values.
Number of addresses 232 Number of addresses 2128
Ex: 19.117.63.125 Ex: 2001:db8:3333:4444:cccc:dddd:eeee:ffff
Domain Name System (DNS)
•To Communicate over the internet, we can use IP addresses. But it is not possible to
remember all IP addresses.
•Domain Name makes it easy to change names in IP addresses. Domain name is used to
identify a web server in a URL i.e. a domain name is an address of a web server, for ex.-
https://kvsroagra.blogspot.com.
•A domain name has two parts-
–Top-level domain name or primary domain name
–Sub-domain name (s)
•Com is the primary domain name, blogspot is the sub-domain of com and kvsroagra is the
sub-domain of blogspot.
•The top level domain names are categorized into the following domain names:
•Generic domain names are- .com, .edu, .gov, .mil, .net, .org etc
•Country specific domain names are- : .in, .au, .nz, .jp, .us etc
URL(Uniform Resource Locator) Structure
• URL (Uniform Resource Locator) is used to identify a website or webpage. HTTP locators
are used to access distributed documents world wide.
• URL is used to specify any information on internet.
• URL structure has four factors-
– Protocol it is used to retrieve the document. Like http: , ftp:, https: etc.
– Host computer the host is the computer on which information is located.
– Port it is optional. Like, a port has a number 8080 and it is placed between host and path.
– Path it is the name of that path or place where file is stored.
•1G (First Generation) – The analog 1G offered simple telephony service without data.
•2G (Second Generation)-This was started in the year 1992. This protocol allows sending some
data and text messages. The speed is 250kbps. The frequency range is 900-1800 mhz.
• 3G (Third Generation)-This was started in the year 2000. This protocol allows sending
multimedia data and voice calls. The speed is 20mbps. The frequency 2100 mhz.
• 4G (Fourth Generation)-This was started in the year 2013. This protocol allows sending
multimedia data and voice calls. The speed is 50mbps. The frequency range is 1800 - 2300 mhz.
• Wi-Fi: This protocol is used to connect to the internet without a cable from your PC/Laptop to
the ISP. For this you need Internet connection, wireless router and PC.
• Generally, network tools or commands are used for-
– Netowrk configuration
– Network Troubleshooting
– To identify Network status
– To identify a User
• We will discuss some tools and commands here-
• Traceroute – This command traces the route in the internet from source to destination.
Basic Networking tools
• Ping – it is a network diagnostic tool carrying ip address or domain name . It tells that we are
connected to server or not.
Basic Networking tools
• Ipconfig – It is a network troubleshooting tool. With the help of this we get basic information
about network like MAC address, ip address, subnetmask etc.
Basic Networking tools
• nslookup – it means name server lookup and it is used to get information about internet
server.
Basic Networking tools
• whois – it is a query tool with which we can get information about registered user. It is an
external command.
Basic Networking tools
• netstat – it is used to get information about network statistics.
Basic Networking tools
• Speedtest – We can use various web services to get information about network speed.
E-mail
• One of the most common service of internet is e-mail , which is used to send a message from
sender to receiver.
• Email functioning resolves around the following three components:
• Mailer – it is also called mail program, mail application or mail client. It allows us to
manage, read and compose email.
• Mail server- the function of mail server is to receive, store and deliver the mail.
• Mail boxes- Mailbox is generally a folder that contains emails and information about them.
Email sending has following steps–
– Composition get ready the mail
– Transfer sending of mail from computer to server.
– Reporting informing the sender
about status of mail i.e. it is
delivered or not.
– Displaying reading of mail by user.
– Disposition act is decided by user after reading mail.
Secure Communications
•Secure communication is when two entities are communicating and do not want a third
party to listen in.
•Sharing information is the vital feature of the web. Every day people share lots of private
information such as banking info, credit/debit cards info, login id’s, passwords, social media
accounts, email accounts etc.
•To ensure safety of the information being transmitted over the web, encryption is the one
of the measure and highly recommended.
HTTPS
• Hyper Text Transfer Protocol Secure is a safe
protocol to send data on internet or on world
wide web.
• Remote Login accessing a remote computer using user name and password.
• Telnet also used for remote login where many users can connect to a server.
HTTP: The Hypertext Transfer Protocol is a protocol used namely to access data on the World
Wide Web. HTTP functions as a combination of FTP and SMTP . In this, first Client requests a
page and HTTP returns the code for a page.
FTP: (File Transfer Protocol)
It is used to transfer any type of file from one system to another system in a network.
Computer Science
Class XII ( As per CBSE Board)
Presented by: 1
Nausheen Khan, PGT CS, KV CRPF Rampur, Agra Region
SQL
Topics Covered:
2
By: Nausheen Khan, PGT CS, KV CRPF Rampur, Agra Region
SQL
3
By: Nausheen Khan, PGT CS, KV CRPF Rampur, Agra Region
SQL
Now we write the query – select * from student order by class desc;
Now we write query–select * from student order by class asc, marks asc;
Query result will be ascending order of class and if same class exists
then ordering will done on marks column(ascending order)
6
By: Nausheen Khan, PGT CS, KV CRPF Rampur, Agra Region
SQL
Now we write query–select * from student order by class asc, marks desc;
Query result will be ascending order of class and if same class exists
then ordering will done on marks column(descending order)
7
By: Nausheen Khan, PGT CS, KV CRPF Rampur, Agra Region
SQL
Functions in SQL
Single Row Functions
Single row functions are the one who work on single row and
return one output per row.
For example, LENGTH, SUBSTR, etc.
Multiple Row Functions (Aggrigate Functions)
Multiple row functions work upon group of rows and return one
result for the complete set of rows. They are also known as
Group Functions. AGGREGATE (GROUP) FUNCTIONS Group
functions or Aggregate functions work upon groups of rows,
rather than on single row. That is why, these function are also
called multiple row functions.
For example: AVG, SUM, etc.
8
By: Nausheen Khan, PGT CS, KV CRPF Rampur, Agra Region
SQL
9
By: Nausheen Khan, PGT CS, KV CRPF Rampur, Agra Region
SQL
Name Purpose
SUM() Returns the sum of given column.
MIN() Returns the minimum value in the given column.
MAX() Returns the maximum value in the given column.
AVG() Returns the Average value of the given column.
COUNT() Returns the total number of values/ records as per given
column.
10
By: Nausheen Khan, PGT CS, KV CRPF Rampur, Agra Region
SQL
Aggregate Functions & NULL
Consider a table Emp having following records as-
Null values are excluded while (avg)aggregate function is used
Emp
Code Name Sal
E1 Mohak NULL
E2 Anuj 4500
E3 Vijay NULL
E4 Vishal 3500
SQL Queries E5 Anil 4000
Result of query
mysql> Select Sum(Sal) from EMP; 12000
mysql> Select Min(Sal) from EMP; 3500
mysql> Select Max(Sal) from EMP; 4500
mysql> Select Count(Sal) from EMP; 3
mysql> Select Avg(Sal) from EMP; 4000
mysql> Select Count(*) from EMP; 5
11
By: Nausheen Khan, PGT CS, KV CRPF Rampur, Agra Region
SQL
12
By: Nausheen Khan, PGT CS, KV CRPF Rampur, Agra Region
SQL
Query result will be unique occurrences of class values along with counting of
students(records) of each class(sub group).
14
By: Nausheen Khan, PGT CS, KV CRPF Rampur, Agra Region
SQL
Query result will be unique occurrences of class values along with average
marks of each class(sub group).
15
By: Nausheen Khan, PGT CS, KV CRPF Rampur, Agra Region
SQL
MySQL GROUP BY with aggregate functions (with where and order by clause)
we are having student table with following data.
Query result will be unique occurrences of class values where class<10 along with
average marks of each class(sub group) and descending ofer of marks.
16
By: Nausheen Khan, PGT CS, KV CRPF Rampur, Agra Region
SQL
Query result will be unique occurrences of class values along with average
marks of each class(sub group) and each class having average marks<90.
18
By: Nausheen Khan, PGT CS, KV CRPF Rampur, Agra Region
SQL
Query result will be unique occurrences of class values along with average
marks of each class(sub group) and each class having less than 3 rows.
19
By: Nausheen Khan, PGT CS, KV CRPF Rampur, Agra Region
SQL
Thank You
20
By: Nausheen Khan, PGT CS, KV CRPF Rampur, Agra Region
COMPUTER SCIENCE
68
COMPUTER SCIENCE
mydb=mysql.connector.connect(host="localhost",user="root",passwd="12345",database="student")
mycursor=mydb.cursor()
mycursor.execute("DESC STUDENT")
for x in mycursor:
print(x)
# SELECT QUERY
import mysql.connector
conn=mysql.connector.connect(host="localhost",user="root",passwd="12345",database="student")
c=conn.cursor()
c.execute("select * from student")
r=c.fetchone()
while r is not None:
print(r)
r=c.fetchone()
#WHERE CLAUSE
import mysql.connector
conn=mysql.connector.connect(host="localhost",user="root",passwd="12345",database="student")
if conn.is_connected==False:
print("Error connecting to MYSQL DATABASE")
c=conn.cursor()
c.execute("select * from student where marks>90")
r=c.fetchall()
count=c.rowcount
print("total no of rows:",count)
for row in r:
print(row)
# DYNAMIC INSERTION
import mysql.connector
mydb=mysql.connector.connect(host="localhost",user="root",passwd="12345",database="student")
mycursor=mydb.cursor()
r=int(input("enter the rollno"))
n=input("enter name")
m=int(input("enter marks"))
mycursor.execute("INSERT INTO student(rollno,name,marks) VALUES({},'{}',{})".format(r,n,m))
mydb.commit()
print(mycursor.rowcount,"RECORD INSERTED")
# UPDATE COMMAND
import mysql.connector
mydb=mysql.connector.connect(host="localhost",user="root",passwd="12345",database="student")
mycursor=mydb.cursor()
mycursor.execute("UPDATE STUDENT SET MARKS=100 WHERE MARKS=40")
mydb.commit()
print(mycursor.rowcount,"RECORD UPDATED")
# DELETE COMMAND
import mysql.connector
mydb=mysql.connector.connect(host="localhost",user="root",passwd="12345",database="student")
mycursor=mydb.cursor()
mycursor.execute("DELETE FROM STUDENT WHERE MARKS<50")
mydb.commit()
print(mycursor.rowcount,"RECORD DELETED")
# DROP COMMAND
import mysql.connector
mydb=mysql.connector.connect(host="localhost",user="root",passwd="12345",database="student")
mycursor=mydb.cursor()
mycursor.execute("DROP TABLE STUDENT")
# ALTER COMMAND
import mysql.connector
69
COMPUTER SCIENCE
mydb=mysql.connector.connect(host="localhost",user="root",passwd="12345",database="student")
mycursor=mydb.cursor()
mycursor.execute("ALTER TABLE STUDENT ADD GRADE CHAR(3)")
(1 mark question)
Q.1.1 What is database.
Ans. The database is a collection of organized information that can easily be used, managed, update, and they are
classified according to their organizational approach.
Q.1.2 Write command to install connector.
Ans. pip install mysql-connector-python
Q.1.3 Write command to import connector.
Ans. import mysql.connector
(2 mark question)
Q.2 write the steps of connectivity between SQL and Python
Ans. import,connect,cursor,execute
Environment Description
Variables
ROLLBACK It works like "undo", which reverts all the changes that you have made.
Chapter 13: SQL commands: aggregation functions – having, group by, order by
• ORDER BY Clause: You can sort the result of a query in a specific order using ORDER BY clause. The ORDER BY clause allow
sorting of query result by one or more columns. The sorting can be done either in ascending or descending order.
Note: - If order is not specified then by default the sorting will be performed in ascending order.
e.g., Select * from emp order by deptno
Three methods of ordering data are:
1. Ordering data on single column.
2. Ordering data on multiple column.
3. Ordering data on the basis of an expression
• Aggregate Functions: These functions operate on the multiset of values of a column of a relation, and return a value
avg: average value,
min: minimum value ,
max: maximum value ,
sum: sum of values ,
count: number of values
These functions are called aggregate functions because they operate on aggregates of tuples. The result of an aggregate function is
a single value.
e.g., Select deptno, avg (sal), sum (sal) from emp group by deptno
• GROUP BY Clause: The GROUP BY clause groups the rows in the result by columns that have the same values. Grouping is
done on column name. It can also be performed using aggregate functions in which case the aggregate function produces single
value for each group.
e.g., Select deptno, avg (sal), sum (sal) from emp group by deptno
• HAVING Clause: The HAVING clause place conditions on groups in contrast to WHERE clause that place conditions on
individual rows. While WHERE condition cannot include aggregate functions, HAVING conditions can do so.
e.g., Select deptno, avg (sal), sum (sal) from emp group by deptno having deptno=10;
Select job, count (*) from emp group by job having count (*) <3;
Revision of MySQL:-
71
COMPUTER SCIENCE
Database: Collection of logically related data along with its description is termed as database.
Relation: Relation (collection of rows and columns) on which we can perform various operations. It is also known as table.
Tuple: A row in a relation is called a tuple. It is also known as record.
Attribute: A column in a relation is called an attribute. It is also termed as field or data item.
Degree: Number of attributes in a relation is called degree of a relation.
Cardinality: Number of tuples in a relation is called cardinality of a relation.
Primary Key: Primary key is a key that can uniquely identifies the records/tuples in a relation. This key can never be
duplicated and NULL.
Foreign Key: Non key attribute of a table acting as primary key in some other table is known as Foreign Key in its
current table. This key is used to enforce referential integrity in RDBMS.
Candidate Key: Attributes of a table which can serve as a primary key are called candidate keys.
Alternate Key: All the candidate keys other than the primary key of a relation are alternate keys for
a relation.
DBA: Data Base Administrator is a person (manager) that is responsible for defining the data base schema, setting
security features in database, ensuring proper functioning of the data bases etc.
Select Operation: The select operation selects tuples from a relation which satisfy a given condition. It is denoted by
lowercase Greek Letter σ (sigma).
Project Operation: The project operation selects columns from a relation which satisfy a given condition. It is denoted
by lowercase Greek Letter π (pi). It can be thought of as picking a sub set of all available columns.
Union Operation: The union (denoted as ∪) of a collection of relations is the set of all distinct tuples in the collection. It
is a binary operation that needs two relations.
Set Difference Operation: This is denoted by - (minus) and is a binary operation. It results in a set of tuples that are in
one relation but not in another
SQL is a non procedural language that is used to create, manipulate and process the databases(relations).
Operators in SQL: The following are the commonly used operators in SQL
1. Arithmetic Operators +,-,*, /
2. Relational Operators =, <,>, <=,>=,<>
3. Logical Operators OR, AND, NOT
Data types of SQL: Just like any other programming language, the facility of defining data of various types is available in SQL also.
Following are the most common data types of SQL.
1) NUMBER e.g. Number (n, d) Number (5, 2)
2) CHAR e.g. CHAR (SIZE)
3) VARCHAR / VARCHAR2 e.g. VARCHAR2 (SIZE)
4) DATE DD-MON-YYYY
Constraints: Constraints are the conditions that can be enforced on the attributes of a relation. The constraints come in play
whenever we are trying to insert, delete or update a record in a relation.
Not null ensures that we cannot leave a column as null. That is a value has to be supplied for that column.
72
COMPUTER SCIENCE
SQL COMMANDS:
1. Create Table command is used to create a table.
The syntax of this Command is: CREATE TABLE <Table_name>
(column_name 1 data_type1 [(size) column_constraints],
column_name 1 data_type1 [(size) column_constraints],
:
:
[<table_constraint> (column_names)]);
2. The ALTER Table commandis used to change the definition (structure) of existing table.
ALTER TABLE <Table_name>ADD/MODIFY <Column_defnition>; For Add or modify column
ALTER TABLE <Table_name> DROP COLUMN <Column_name>; For Deleting a column
3. The INSERT Command: The rows (tuples) are added to a table by using INSERT command.
The syntax of Insert command is:
INSERT INTO <table_name> [(<column_list>)] VALUES (<value_list>);
e.g.,
INSERT INTO EMP (empno, ename, sex, sal, deptno) VALUES (1001, ’Ravi’, ’M’, 4500.00, 10);
If the order of values matches the actual order of columns in table then it is not required to give the column_list in INSERT
command. e.g.
INSERT INTO EMP VALUES (1001, ’Ravi’, ’M’, 4500.00, 10);
4. The Update command is used to change the value in a table. The syntax of this command is:
UPDATE <table_name>
SET column_name1=newvalue1/expression [, column_name2=newvalue2/expression …] WHERE <condition>;
e.g., to increase the salary of all the employees of department No 10 by 10%, then command will
be:
UPDATE emp
SET sal=sal*1.1
WHERE Deptno=10;
5. The DELETE command removes rows from a table. This removes the entire rows, not individual field values.
The syntax of this command is
DELETE FROM <table_name>
[WHERE <condition>];
e.g., to delete the tuples from EMP that have salary less than 2000, the following command is used:
DELETE FROM emp WHERE sal<2000;
To delete all tuples from emp table:
DELETE FROM emp;
73
COMPUTER SCIENCE
6. The SELECT command is used to make queries on database. A query is a command that is given to produce certain
specified information from the database table(s). The SELECT command can be used to retrieve a subset of rows or
columns from one or more tables. The syntax of Select Command is:
SELECT <Column-list>
FROM <table_name>
[WHERE<condition>]
[GROUP BY <column_list>]
[HAVING<condition>]
[ORDER BY <column_list [ASC|DESC]>]
The select clause list the attributes desired in the result of a query. e.g.,To
display the names of all Employees in the emp relation:
select ename from emp;
To force the elimination of duplicates, insert the keyword distinct after select. Find the
number of all departments in the emp relations, and remove duplicates
select distinct deptno from emp;
An asterisk (*) in the select clause denotes “all attributes”
SELECT* FROM emp;
The select clause can contain arithmetic expressions involving the operation, +, -, *, and /, and operating
on constants or attributes of tuples.The query:
SELECTempno, ename, sal * 12 FROM emp;
would display all values same as in the emp relation, except that the value of the attribute sal is multiplied by 12.
The WHERE clause in SELECT statement specifies the criteria for selection of rows to be returned.
• Conditions based on a range (BETWEEN Operators): The Between operator defines a range of values that the column values must
fall in to make condition true. The range includes both lower value and upper value.
e.g., Find the empno of those employees whose salary between 90,000 and 100,000 (that is, 90,000 and 100,000)
SELECT empno FROM emp WHERE sal BETWEEN 90000 AND 100000;
• Conditions based on a list (IN operator): To specify a list of values, IN operator is used.
IN operator selects values that match any value in a given list of values.
For example, to display a list of members from ‘DELHI’, ‘MUMBAI’, ‘CHENNAI’ or‘BANGALORE’ cities:
SELECT * FROM members WHERE city IN (‘DELHI’, ‘MUMBAI’, ‘CHENNAI’, ‘BANGALORE’);
The NOT IN operator finds rows that do not match in the list. So if you write
SELECT * FROM members WHERE city NOT IN (‘DELHI’, ‘MUMBAI’, ‘CHENNAI’, ‘BANGALORE’);
It will list members not from the cities mentioned in the list.
• Conditions based on Pattern: SQL also includes a string-matching operator, LIKE, for comparison on character string using
patterns. Patterns are described using two special wildcard characters:
Percent (%) - ‘%’ matches any substring (one, more than one or no character).
Underscore (_) - ‘_’ character matches exactly one character.
Patterns are case-sensitive.
Like keyword is used to select row containing columns that match a wildcard pattern. The keyword not like is used to select the row
that do not match the specified patterns of characters.
Searching for NULL: The NULL value in a column is searched for in a table using IS NULL in the WHERE
clause (Relational Operators like =,<> etc can not be used with NULL).
For example, to list details of all employees whose departments contain NULL (i.e., novalue), you use the command:
SELECT empno, ename FROM emp Where Deptno IS NULL;
The DROP Command: The DROP TABLE command is used to drop (delete) a table from database. But there is a
condition for droping a table ; it must be an empty table i.e. a table with rows in it cannot be dropped.The syntax of this
command is :
DROP TABLE <Table_name>;
e.g., DROP TABLE EMP;
Query Based on Two table (Join):
SELECT <Column-list>
FROM <table_name1>,<table_name2>
WHERE <Join_condition>[AND condition];
SQL (Question and Answers)
(1 mark question)
Q.1 State two advantages of using Databases.
74
COMPUTER SCIENCE
Ans: Databases help in reducing Data Duplication i.e. Data Redundancy and controls Data Inconsistency.
Q2. Name some popular relational database management systems.
Ans: Oracle, MYSQL, Sqlite, MS-Access etc
Q.3 Define – Relation, Tuple, Degree, Cardinality
Ans: A Relation is logically related data organized in the form of tables.
Tuple indicates a row in a relation.
Degree indicates the number of Columns.
Cardinality indicates the number of Columns.
Q4. What is Data Dictionary?
Ans: Data Dictionary contains data about data or metadata. It represents structure or schema of a database?
Q5. Name some data types in MySQL
Ans: Char, Varchar, Int, Decimal, Date, Time etc.
(2 mark question)
Q6. Differentiate between Char and Varchar.
Ans: Char means fixed length character data and Varchar means variable length character data. E.g. For the data “Computer” char (30)
reserves constant space for 30 characters whereas Varchar (30) reserves space for only 8 characters.
Q.7 What is a Primary Key?
Ans: A Primary Key is a set of one or more attributes (columns) of a relation used to uniquely identify the records in it.
Q.8 What is a Foreign Key? What is its use?
Ans: A Foreign key is a non-key attribute of one relation whose values are derived from the primary key of some other relation. It is
used to join two / more relations and extract data from them.
Q.9 Write SQL statements to do the following
(a)Create a table Result with two columns Roll and Name with Roll as primary key
CREATE TABLE Result
(Roll INT PRIMARY KEY, Name Varchar (30))
(b)Add a column Marks to Result table
ALTER TABLE Result
ADD (Marks DECIMAL (10,2))
Insert a record with values 1, “Raj”, 75.5
INSERT INTO Result
VALUES (1,”Raj”,75.5)
(d)Show the structure of Result table
DESCRIBE Result
(e) Display the records in ascending order of name
SELECT * FROM Result
ORDER BY Name
(f)Display records having marks>70
SELECT * FROM Result
WHERE Marks > 70
(g)Update marks of,”Raj” to 80
UPDATE Result
SET Marks = 80
WHERE Name=”Raj”
Q10. What are the various Integrity Constraints?
Ans: Various Integrity Constraints are –
NOT NULL – Ensures value for the column is not left unassigned
UNIQUE – ensures that all values in a column are distinct or no two rows can have the same values for a column having UNIQUE
constraint
CHECK – Ensures that values for a particular column satisfy the specified condition
DEFAULT – Ensures that the default value is assumed if value for the column is not specified
PRIMARY KEY – Automatically applies UNIQUE and NOT NULL for uniquely identifying rows / records in a table
6 - Marks Questions
Q1. Consider the following tables GAMES and PLAYER. Write SQL commands for the statements (i) to (iv) and give outputs for
SQL queries (v) to (viii).
75
COMPUTER SCIENCE
Table: GAMES
GCode GameName Number PrizeMoney ScheduleDate
101 Carom Board 2 5000 23-Jan-2004
102 Badminton 2 12000 12-Dec-2003
103 Table Tennis 4 8000 14-Feb-2004
Table: PLAYER
PCode Name Gcode
1 Nabi Ahmad 101
2 Ravi Sahai 108
3 Jatin 101
4 Nazneen 103
(i) To display the name of all Games with their Gcodes.
(ii) To display details of those games which are having PrizeMoney more than 7000.
(iii) To display the content of the GAMES table in ascending order of ScheduleDate.
(iv) To display sum of PrizeMoney for each of the Number of participation groupings (as
shown in column Number 2 or 4).
(v) SELECT COUNT(DISTINCT Number) FROM GAMES;
(vi) SELECT MAX(ScheduleDate),MIN(ScheduleDate) FROM GAMES;
(vii) SELECT SUM(PrizeMoney) FROM GAMES;
(viii) SELECT DISTINCT Gcode FROM PLAYER;
Ans: (i) SELECT GameName,Gcode FROM GAMES;
(ii) SELECT * FROM GAMES WHERE PrizeMoney>7000;
(iii) SELECT * FROM GAMES ORDER BY ScheduleDate;
(iv) SELECT SUM(PrizeMoney),Number FROM GAMES GROUP BY Number;
(v) 2
(vi) 19-Mar-2004 12-Dec-2003
(vii) 59000
(viii) 101
103
108
Q2. Consider the following tables FACULTY and COURSES. Write SQL commands for the statements (i) to (v) and give outputs for
SQL queries (vi) to (vii).
FACULTY
76
COMPUTER SCIENCE
iii) To increase the fees of all courses by 500 of “System Design” Course.
iv) To display details of those courses which are taught by ‘Sulekha’ in descending order of courses.
v) Select COUNT (DISTINCT F_ID) from COURSES;
vi) Select Fname, Cname from FACULTY, COURSES where COURSES.F_ID =FACULTY.F_ID;
Ans.: (i) Select * from faculty where salary > 12000;
(ii) Select * from Courses.where fees between 15000 and 50000;
(iii) Update courses set fees = fees + 500 where Cname = “System Design”;
(iv) Select * from faculty fac, courses cour where fac.f_id = cour.f_id and fac.fname = 'Sulekha'order by
cname desc;
(v) 4
(vi)
Fname Cname
Amit Grid Computing
Rakshit Computer Security
Rashmi Visual Basic
Sulekha Human Biology
2- Marks Questions
Define the following terms with example:
(i) DDL (ii) DML (iii) Primary Key (iv) Candidate Key
(v) Alternate Key (vi) Foreign Key (vii) Cardinality of relation (viii) Degree of relation
(ix) Relation (x) Attribute (xi) Tuple (xii) Selection
(xiii) Projection
Licensing
A software license is a document that provides legally binding guidelines to the person who holds it for the use and distribution of
software. It typically provide end users with the right to make one or more copies of the software without violating copyrights. It also
defines the responsibilities of the parties entering into the license agreement and may impose restrictions on how the software can be
used. Software licensing terms and conditions usually include fair use of the software, the limitations of liability, warranties and
disclaimers and protections.
Creative commons: Creative Commons (CC) is an internationally active non-profit organization to provide free licenses for
creators to use it when making their work available to the public in advance under certain conditions. CC licenses allow the
creator of the work to select how they want others to use the work. When a creator releases their work under a CC license,
members of the public know what they can and can’t do with the work.
General Public License: General Public License (GNU GPL), is the most commonly used free software license, written by
Richard Stallman in 1989 of Free Software Foundation for GNU Project. This license allows software to be freely used modified,
and redistributed by anyone. WordPress is also an example of software released under the GPL license, that’s why it can be used,
modified, and extended by anyone.
Apache License: The Apache License is a free and open source software (FOSS) licensing agreement from the Apache Software
Foundation (ASF). The main features are copy, modify and distribute the covered software in source and/or binary forms, all
copies, modified or unmodified, are accompanied by a copy of the license.
Open Source
Open source means any program whose source code is made available publically for use or modification as users or other
developers see fit. Open source software is usually made freely available.
Eg: Open source software: python, java, linux, mongodb etc
Open data
Open data is data which can be accessed, used and shared by anyone to bring about social, economic and environmental
benefits. Open data becomes usable when made available in a common, machine-readable format.
Open source terminologies and definitions:
a. Free Software: They are freely accessible and can be freely used, changed, improved, copied and distributed by all and
payments are not needed for free Software.
b. Open Source Software: Software whose source code is available to the user and it can be modified and redistributed without
any limitation .OSS may come free of cost but nominal charges have to be paid for support of Software and development of
Software.
c. Proprietary Software: Proprietary Software is neither open nor freely available, normally the source code of the Proprietary
Software is not available but further distribution and modification is possible by special permission by the developer.
d. Freeware: Freeware are the software freely available, which permit redistribution but not modification (their source code is
not available). Freeware is distributed in Binary Form (ready to run) without any licensing fees.
e. Shareware: Software for which license fee is payable after some time limit, its source code is not available and modification
to the software are not allowed.
Privacy
It is the protection of personal information given online.
Online fraud
Fraud committed using the internet is called online fraud. Online fraud occurs in many forms such as non-delivered goods,
non-existent goods, stealing information, fraudulent payments.
Preventive measures to stop online fraud
a. Strong security mechanism by the e-commerce site and payment gateways to prevent stealing of crucial information.
b. Official guidelines and safeguards on the selling of users’s data to third parties.
c. A monitoring official body that ensures the delivery of goods/services as promised.
Cybercrime
Any criminal offense that is facilitated by the use of electronic device, computer or internet is called cybercrime. Eg: Information
Theft, scams, illegal downloads etc.
Phishing
78
CYBER SAFETY
CHAPTER-15
Made by:
Sumit Kumar Sahu
PGT Computer Science
KV Babina Cantt,
Jhansi
PRIVACY
It refers to obtaining files for which you don’t have the right to
use or download from the internet. It is downloading a paid
digital item , without making any payment and using an illegal
way to download it.
For example you are downloading a movie which is not
available for free download , this is illegal download ,
downloading a copy of the licensed software bypassing the
legal measures is also illegal download
A product is protected by copyright law can not be
downloaded , copied, reproduced, or resold without their
permission.
CHILD PORNOGRAPHY
Net etiquettes:
We follow certain etiquettes during our social interactions. Similarly ,
we need to exhibit proper manners and etiquettes while being
online.
1.Be Ethical
2. Be respectful
3. Be responsible
Social media etiquettes:
1.Be secure
2. Be reliable
Communication etiquettes:
1. Be precise
2. Be polite
3. Be credible.