Class 11 Computer Science (Society Law and Ethics)
Class 11 Computer Science (Society Law and Ethics)
Class 11 Computer Science (Society Law and Ethics)
4. What is Cyber-crime ?
Any criminal offense that is facilitated by, electronic communications or information
systems, including any electronic device, computer, or the internet is referred to as cyber-
crime.
5. What is Cyber Trolls ?
Derogatory messages or comments posted online targeting people are called cyber trolls.
12.What is Malware?
Malware, or malicious software, is any program or file that is harmful to a computer user.
Malware includes computer viruses, worms, Trojan horses and spyware. These malicious
programs can perform a variety of functions, including stealing, encrypting or deleting
sensitive data, altering or hijacking core computing functions and monitoring users’
computer activity without their permission.
13.What is Virus?
A computer virus is a type of malicious code or program written to alter the way a computer
operates and that is designed to spread from one computer to another. A virus operates by
inserting or attaching itself to a legitimate program or document that supports macros in
order to execute its code.
14.What is Trojans?
In computing, a Trojan horse is a program that appears harmless, but is, in fact, malicious. A
Trojan can perform unexpected changes to computer settings and unusual activity, even
when the computer is idle.
15.What is E-waste?
Whenever an electronic device covers up its working life, or becomes unusable due to
technological advancements or becomes non-functional, it is not used anymore and comes
under the category of e-waste or electronic waste.
Disability Issues:
● Unavailability of teaching materials/aids
● Lack of special needs teachers
● Lack of supporting curriculum
PYTHON LISTS
Lists are great, but not suitable for every task. There are other data types out there like
arrays, tuples and dictionaries which may be more suitable for certain tasks. First scope out
your problem and then decided which data type fits the best.
mylist = ["C","C++","Java","Python","PHP"]
The items within the list must be enclosed within square brackets, and each item must be
separated by a comma. Unlike arrays, Lists can store any type of data type as well as store
variables of different datatypes at the same time.
The double quotes are not part of the syntax of the list. They are only necessary if the item
is a string.
List Indexing
You can access the contents of a list by using it’s index. A list is an ordered collection, so the
values can be called in the order in which they were placed inside.
Don’t forget that indexing starts from zero in python. The code below will output “C++”.
mylist = ["C","C++","Java","Python","PHP"]
print(mylist[1])
Output:
C++
Using negative integers will reverse the order of the list. Negative indexing starts from –
mylist = ["C","C++","Java","Python","PHP"]
print(mylist[-2])
Output:
Python
You don’t nessacerily how to define the starting point, as the default will be 0, or the start of
the list. The semi-colon and ending point must be present though.
mylist = ["C","C++","Java","Python","PHP"]
print(mylist[:3])
Output:
['C', 'C++', 'Java']
It also works the other way around, where you define the start point, and leave out the end
point, while keeping the semi-colon.
mylist = ["C","C++","Java","Python","PHP"]
print(mylist[2:])
Output:
['Java', 'Python', 'PHP']
The insert() function takes two parameters. The first is the position you want to add a value,
and the second parameter is the value itself.
mylist = ["C","C++","Java","Python","PHP"]
mylist.insert(2,"Rust")
print(mylist)
Output:
['C', 'C++', 'Rust', 'Java', 'Python', 'PHP']
Note that the former second position item, “java” was moved forward to the third position.
mylist = ["C","C++","Java","Python","PHP"]
mylist.remove("C++")
print(mylist)
Output:
['C', 'Java', 'Python', 'PHP']
Unlike remove(), the pop() function takes an index as a parameter, and removes the item at
that index. However, the pop function is also often used without any parameters, in which
case, it will remove the last item.
mylist = ["C","C++","Java","Python","PHP"]
mylist.pop(0)
print(mylist)
Output:
['C++', 'Java', 'Python', 'PHP']
The del() function has two functions. Like, the pop() function it can delete an item at a
specific index, as well as delete a whole list in one go.
mylist = ["C","C++","Java","Python","PHP"]
del mylist
You can delete the value at a specific index using the del keyword in the following manner.
mylist = ["C","C++","Java","Python","PHP"]
del mylist[2]
print(mylist)
Output:
['C', 'C++', 'Python', 'PHP']
Other Useful Operations
Output:
5
PYTHON OPERATORS
Operator in python
Operators are the constructs which can manipulate the value of operands.
Consider the expression 4 + 5 = 9. Here, 4 and 5 are called operands and + is called operator.
a+b=
+ Addition Adds values on either side of the operator.
30
a–b=-
– Subtraction Subtracts right hand operand from left hand operand.
10
* a*b=
Multiplies values on either side of the operator
Multiplication 200
% Modulus Divides left hand operand by right hand operand and returns remainder b%a=
0
a**b
=10 to
** Exponent Performs exponential (power) calculation on operators the
power
20
9//2 = 4
and
9.0//2.0
Floor Division – The division of operands where the result is the quotient in which the
= 4.0, -
// digits after the decimal point are removed. But if one of the operands is negative, the
11//3 =
result is floored, i.e., rounded away from zero (towards negative infinity) −
-4, -
11.0//3
= -4.0
Types of Operator
Python language supports the following types of operators.
Arithmetic Operators
Comparison (Relational) Operators
Assignment Operators
Logical Operators
Bitwise Operators
Membership Operators
Identity Operators
Let us have a look on all operators one by one.
Python Arithmetic Operators
Assume variable a holds 10 and variable b holds 20, then
Python Comparison Operators
(a == b)
== If the values of two operands are equal, then the condition becomes true. is not
true.
(a != b) is
!= If values of two operands are not equal, then condition becomes true.
true.
(a <> b)
is true.
This is
<> If values of two operands are not equal, then condition becomes true.
similar to
!=
operator.
If the value of left operand is greater than the value of right operand, then condition becomes (a > b) is
>
true. not true.
If the value of left operand is less than the value of right operand, then condition becomes (a < b) is
<
true. true.
(a >= b)
If the value of left operand is greater than or equal to the value of right operand, then
>= is not
condition becomes true.
true.
If the value of left operand is less than or equal to the value of right operand, then condition (a <= b)
<=
becomes true. is true.
These operators compare the values on either sides of them and decide the relation among
them. They are also called Relational operators.
Assume variable a holds 10 and variable b holds 20, then −
c=a+b
assigns
= Assigns values from right side operands to left side operand
value of a
+ b into c
c += a is
equivalent
+= Add AND It adds right operand to the left operand and assign the result to left operand
to c = c +
a
-= Subtract AND It subtracts right operand from the left operand and assign the result to left operand c -= a is
equivalent
to c = c –
a
c *= a is
equivalent
*= Multiply AND It multiplies right operand with the left operand and assign the result to left operand
to c = c *
a
c /= a is
/= Divide AND It divides left operand with the right operand and assign the result to left operand equivalent
to c = c / a
c %= a is
equivalent
%= Modulus AND It takes modulus using two operands and assign the result to left operand
to c = c %
a
c **= a is
**= Exponent Performs exponential (power) calculation on operators and assign value to the left equivalent
AND operand to c = c **
a
c //= a is
equivalent
//= Floor Division It performs floor division on operators and assign value to the left operand
to c = c //
a
(a & b)
& Binary AND Operator copies a bit to the result if it exists in both operands (means
0000 1100)
(a | b) = 61
| Binary OR It copies a bit if it exists in either operand. (means
0011 1101)
(a ^ b) = 49
^ Binary XOR It copies the bit if it is set in one operand but not both. (means
0011 0001)
(~a ) = -61
(means
1100 0011
in 2’s
~ Binary Ones
It is unary and has the effect of ‘flipping’ bits. complement
Complement
form due to
a signed
binary
number.
a << 2 = 240
The left operands value is moved left by the number of bits specified by the
<< Binary Left Shift (means
right operand.
1111 0000)
a >> 2 = 15
The left operands value is moved right by the number of bits specified by
>> Binary Right Shift (means
the right operand.
0000 1111)
and Logical
If both the operands are true then condition becomes true. (a and b) is true.
AND
Operator Description Example
or Logical OR If any of the two operands are non-zero then condition becomes true. (a or b) is true.
x in y, here
not Logical NOT Used to reverse the logical state of its operand. Not(a and b) is false.
in results
in a 1 if x is
In Evaluates to true if it finds a variable in the specified sequence and false otherwise. a member
of
sequence
y.
x not in y,
here not in
results in a
1 if x is not
not in Evaluates to true if it does not finds a variable in the specified sequence and false otherwise. a member
of
sequence
y.
x is y,
Evaluates to true if the variables on either side of the operator point to the same object here is results
Is
and false otherwise. in 1 if id(x)
equals id(y).
x is not y,
here is
Evaluates to false if the variables on either side of the operator point to the same object not results in
is not
and true otherwise. 1 if id(x) is
not equal to
id(y).
Identity operators compare the memory locations of two objects. There are two Identity
operators explained below −
**
1
Exponentiation (raise to the power)
~+–
2
Complement, unary plus and minus (method names for the last two are +@ and -@)
* / % //
3 Multiply, divide, modulo and floor division
+–
4
Addition and subtraction
>> <<
5
Right and left bitwise shift
&
6
Bitwise ‘AND’
^|
7
Bitwise exclusive `OR’ and regular `OR’
<> == !=
9
Equality operators
= %= /= //= -= += *= **=
10
Assignment operators
is is not
11
Identity operators
in not in
12
Membership operators
not or and
13
Logical operators
The following table lists all operators from highest precedence to lowest.