Download as pdf or txt
Download as pdf or txt
You are on page 1of 67

https://forms.

gle/GyrFE9hdU35FwYpL6
Theory
Distribution of marks
Practical
Learning Outcomes
• Computational thinking and Python 45 marks
• Basics
• Strings
• Lists
• Tuples
• Dictionary
• Sorting techniques
• Computer System Organisation 10 marks
• Data Representation
• Boolean Algebra
• Understanding of computer systems
• Society, Law and Ethics 15 marks

Computer science syllabus


(http://cbseacademic.nic.in/web_material/CurriculumMain22/SrSec/Computer_Science_SrSec_2021-22.pdf)
Books
• Computer Science with Python by Sumita Arora (DHANPAT RAI AND CO.)

• NCERT (http://ncert.nic.in/textbook/textbook.htm?kecs1=0-11)

(You may download NCERT book using above link)


To Do….
• Install python 3.7 (https://www.python.org/downloads/windows/)
• Kindly check before installation if your system is 32 bit or 64 bit (executable installer x86/x86-64)
Number System
Decimal Number System
Digits used: 0,1,2,3,4,5,6,7,8,9
No. of digits used: 10
Base : 10
Format of writing Number: (num)10
Examples: (3458)10, (100)10, (999)10
Number System
Decimal Number System
Digits used: 0,1,2,3,4,5,6,7,8,9
No. of digits used: 10
Base : 10
Format of writing Number: (num)10
Examples: (3458)10, (100)10, (999)10
Binary Number System
Digits used: 0,1
No. of digits used: 2
Base : 2
Format of writing Number: (num)2
Examples: (10011)2, (100)2, (11111)2
Number System
Decimal Number System Octal Number System
Digits used: 0,1,2,3,4,5,6,7,8,9 Digits used: 0,1,2,3,4,5,6,7
No. of digits used: 10 No. of digits used: 8
Base : 10 Base : 8
Format of writing Number: (num)10 Format of writing Number: (num)8
Examples: (3458)10, (100)10, (234)10 Examples: (12345067)8, (100)8, (234)8
Binary Number System
Digits used: 0,1
No. of digits used: 2
Base : 2
Format of writing Number: (num)2
Examples: (10011)2, (100)2, (11111)2
Number System
Decimal Number System Octal Number System
Digits used: 0,1,2,3,4,5,6,7,8,9 Digits used: 0,1,2,3,4,5,6,7
No. of digits used: 10 No. of digits used: 8
Base : 10 Base : 8
Format of writing Number: (num)10 Format of writing Number: (num)8
Examples: (3458)10, (100)10, (234)10 Examples: (12345067)8, (100)8, (234)8
Binary Number System Hexadecimal Number System
Digits used: 0,1 Digits used: 0,1,2,3,4,5,6,7,8,9,10,11,
No. of digits used: 2 12,13,14,15
Base : 2 No. of digits used: 16
Format of writing Number: (num)2 Base : 16
Examples: (10011)2, (100)2, (11111)2 Format of writing Number: (num)16
Examples: (123AF067)16, (100)16, (234)16
Number System
Hexadecimal Number System
1234
Digits used: 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
No. of digits used: 16
Base : 16
Format of writing Number: (num)16
1234 C34
Examples: (123AF067)16, (100)16, (23F)16
10 11 12 13 14 15
A B C D E F
Number System
Applications of number system
Binary: The ICs (Integrated Circuits) in a computer are made up of a large number of transistors
which are activated by the electronic signals (low/high) they receive. The ON/ high and
OFF/low state of a transistor is represented using the two digits 1 and 0, respectively. These
two digits 1 and 0 form the binary number system.
Octal: With increase in the value of a decimal number, the number of bits (0/1) in its binary
representation also increases. Sometimes, a binary number is so large that it becomes difficult
to manage. Octal number system was devised for compact representation of the binary
numbers. Octal number is also used to represent 16 bit memory address
Hexadecimal: Main memory is made up of memory locations where each location has a unique
address. To simplify the address representation, hexadecimal and octal numbers are used.
Hexadecimal numbers are also used for describing the colours on the webpage.
Conversion
among
Number Systems
Decimal ()10 to Binary ()2 Number System
• Divide the decimal number by 2
• Write its remainder
• Keep on dividing the quotient by the base value 2 and note the
remainder till the quotient is zero.
• Collect the remainders from bottom to top to get the binary
equivalent.
Decimal ()10 to Octal ()8 Number System
• Divide the decimal number by 8
• Write its remainder
• Keep on dividing the quotient by the base value 8 and note the
remainder till the quotient is zero.
• Collect the remainders from bottom to top to get the binary
equivalent.
Decimal ()10 to Hexadecimal ()16 Number System
• Divide the decimal number by 16
• Write its remainder
• Keep on dividing the quotient by the base value 16 and note the
remainder till the quotient is zero.
• Collect the remainders from bottom to top to get the binary
equivalent.
Task: Convert from Decimal ()10
• to Binary ()2
• to Hexadecimal ()16
• to Octal ()8

i) 122

ii) 65
Task: Convert from Decimal (122)10
• to Binary ()2

• to Hexadecimal ()16

• to Octal ()8
Task: Convert from Decimal (65)10
• to Binary ()2

• to Hexadecimal ()16
(65)10= (41)16

• to Octal ()8
Convert from Binary ()2 to Decimal ()10

(111001)2 = ()10

1x25+ 1x24 + 1x23 + 0x22 + 0x21 + 1x20


32+ 16 + 8 + 0 + 0 + 1
57
Hence, (111001)2 = (57)10
TASK:Convert from Binary ()2 to Decimal ()10

(11110011)2 = ()10
TASK:Convert from Binary ()2 to Decimal ()10

(11110011)2 = ()10
1x27+ 1x26+ 1x25+ 1x24 + 0x23 + 0x22 + 1x21 + 1x20
128+ 64 + 32 + 16 + 0 + 0 + 2 + 1
243
Hence, (11110011)2 = (243)10
Convert from Octal ()8 to Decimal ()10

(71)8 = ()10
7x81+ 1x80
56 + 1
57
Hence, (71)8 = (57)10
TASK: Convert from Octal ()8 to Decimal ()10

(363)8 = ()10
TASK: Convert from Octal ()8 to Decimal ()10

(363)8 = ()10
3x82 + 6x81+ 3x80
192 + 48 + 3
243
Hence, (363)8 = (243)10
Convert from Hexadecimal ()16 to Decimal ()10

(39)16 = ()10
3x161+ 9x160
48 + 9
57
Hence, (39)16 = (57)10
TASK:Convert from Hexadecimal ()16 to Decimal ()10

(F3)16 = ()10
TASK:Convert from Hexadecimal ()16 to Decimal ()10

(F3)16 = ()10
15x161+ 3x160
240 + 3
243
Hence, (F3)16 = (243)10
Decimal ()10 to Binary ()2 Number System
(57.639)10 = () 2

0.639 x 2 = 1.278 1
0.278 x 2 = 0.556 0
0.556 x 2 = 1.112 1
0.112 x 2 = 0.224 0
0.224 x 2 = 0.448 0
:
:
:

(57.639)10 = (111001.10100) 2
Task: Decimal ()10 to Binary ()2 Number System
(243.7832)10 = () 2
Task: Decimal ()10 to Binary ()2 Number System
(243.7832)10 = () 2

0.7832 x 2 = 1.5664 1
0.5664 x 2 = 1.1328 1
0.1328 x 2 = 0.2656 0
0.2656 x 2 = 0.5312 0
0.5312 x 2 = 1.0624 1
:
:
:

(243.7832)10 = (11110011.11001) 2
Decimal ()10 to Octal ()8 Number System
(57.85)10 = () 8
Decimal ()10 to Octal ()8 Number System
(57.85)10 = () 8

0.85 x 8 = 6.8 6
0.8 x 8 = 6.4 6
0.4 x 8 = 3.2 3
0.2 x 8 = 1.6 1
0.6 x 8 = 4.8 4
0.8 x 8 = 6.4 6
:
:
:

(57.85)10 = (71.663146) 8
TASK:Decimal ()10 to Hexadecimal ()16 Number System
(243.85)10 = () 16
Decimal ()10 to Hexadecimal ()16 Number System
(243.85)10 = () 16

0.85 x 16 = 13.6 13 (D)


0.6 x 16 = 9.6 9
0.6 x 16 = 9.6 9
:
:
:
(243.85)10 = (F3.D99) 16
Convert from Binary ()2 to Decimal ()10

(111001.10100)2 = ()10
1x25+1x24+1x23+0x22+0x21+1x20+ 1x2-1 + 0x2-2 + 1x2-3 + 0x2-4 + 0x2-5
32 + 16 + 8 + 0 + 0 + 1 + 0.5 + 0 + 0.125 + 0 + 0
57.625
Hence,

(111001.10100) 2 = (57.639)10
Convert from Octal ()8 to Decimal ()10

(71.663)8 = ()10
Convert from Octal ()8 to Decimal ()10

(71.663)8 = ()10
7x81+ 1x80 + 6x8-1 + 6x8-2 + 3x8-3
56 + 1 + 0.75 + 0.09375+ 0.005859375
57.84
Hence,

(71.663) 8 =(57.85)10
Hexadecimal ()16 to Decimal ()10 to Number System
(F3.D99) 16 = ()10
Hexadecimal ()16 to Decimal ()10 to Number System
(F3.D99) 16 = ()10

15 x 161+ 3 x 160 + 13 x 16-1 + 9 x 16-2 + 9 x 16-3


240+ 3 + 0.8125 + 0.03515625 + 0.0021972
243.849

(F3.D99) 16 = (243.85)10
Binary ()2 to Octal ()8 Number System (8=23)
(111001.10100) 2 = ()8
X Y Z
Incomplete 0 0 0 0
group 0 0 1 1
111 001 . 101 00 0 1 0 2
0 1 1 3
111 001 . 101 000 4
1 0 0
1 0 1 5
7 1 . 5 0 1 1 0 6
1 1 1 7

2 6 0 2 7 1
8/2=4/2=2/2=1
2 3 1 2 3 1
1 1
Binary ()2 to Octal ()8 Number System
(111001.10100) 2 = ()8
X Y Z
Incomplete
0 0 0 0
111 001 . 101 00 group
1
0 0 1
111 001 . 101 000 0 1 0 2
0 1 1 3
1 0 0 4
7 1 . 5 0
1 0 1 5
Octal ()8 to Binary ()2 Number System
1 1 0 6
(7 1 . 5 0)8 to Binary Number()2 1 1 1 7

2 6 0 2 7 1
7 1 . 5 0 2 3 1 2 3 1
1 1

111 001 . 101 000


Binary ()2 to Hexadecimal ()16 Number System (16=24)
W X Y Z
() 2 = ()16 0 0 0 0 0
0 0 0 1 1
(111001.10100) 2 = ()16 0 0 1 0 2
0 0 1 1 3
(11 1001.1010 0) 2 = ()16 0 1 0 0 4
0 1 0 1 5
0 1 1 0 6
Incomplete Incomplete
group group 0 1 1 1 7
1 0 0 0 8
(0011 1001 . 1010 0000) 2 = ()16 1 0 0 1 9
1 0 1 0 10 (A)
1 0 1 1 11 (B)
1 1 0 0 12 (C)
3 9 . 10 0 1 1 0 1 13 (D)
(111001.10100) 2 = (39.A)16 1 1 1 0 14 (E)
1 1 1 1 15(F)
Binary ()2 to Hexadecimal ()16 Number System
W X Y Z
(111001.10100) 2 = ()16 0 0 0 0 0
(11 1001.1010 0) 2 = ()16 0 0 0 1 1
(0011 1001 . 1010 0000) 2 = ()16 0 0 1 0 2
0 0 1 1 3
0 1 0 0 4
3 9 . 10 0 0 1 0 1 5
(111001.10100) 2 = (39.A)16 0 1 1 0 6
Hexadecimal ()16 to Binary ()2 0 1 1 1 7
1 0 0 0 8
(39.A)16 = () 2 1 0 0 1 9
3 9 . 10 1 0 1 0 10 (A)
1 0 1 1 11 (B)
1 1 0 0 12 (C)
(0011 1001 . 1010 ) 2 = ()16 1 1 0 1 13 (D)
1 1 1 0 14 (E)
(39.A)16 = (111001.10100) 2 1 1 1 1 15(F)
TASK:
W X Y Z
0 0 0 0 0
(10101100.010111) 2 = ()16 0 0 0 1 1
0 0 1 0 2
0 0 1 1 3
(10101100.010111) 2 = ()8 0 1 0 0 4
0 1 0 1 5
0 1 1 0 6
(605.12) 8 = ()10 0 1 1 1 7
1 0 0 0 8
(100101.101) 2 = ()10 1 0 0 1 9
1 0 1 0 10 (A)
1 0 1 1 11 (B)
1 1 0 0 12 (C)
1 1 0 1 13 (D)
1 1 1 0 14 (E)
1 1 1 1 15(F)
TASK: Binary ()2 to Hexadecimal ()16 Number System
W X Y Z
0 0 0 0 0
(1010 1100.010111) 2 = ()16 0 0 0 1 1
0 0 1 0 2
Ans: (AC.5C) 16 3
0 0 1 1

(10 101 100.010 111) 2 = ()8 0 1 0 0 4


0 1 0 1 5
Ans: (254.27) 8 0 1 1 0 6
0 1 1 1 7
(605.12) 8 = ()10 1 0 0 0 8
6x82 1 0 0 1 9
Ans: (605.12) 8 = (389.15625)10 1 0 1 0 10 (A)
1 0 1 1 11 (B)
(100101.101) 2 = ()10 1 1 0 0 12 (C)
1 1 0 1 13 (D)
(Ans: 100101.101) 2 = (37.625)10 1 1 1 0 14 (E)
1 1 1 1 15(F)
Text Interpretation by computer

ASCII ISCII UNICODE


Encoding: The mechanism of converting data into an equivalent cipher using
specific code is called encoding.
Cipher: It means something converted to a coded form to hide/conceal it from
others. It is also called encryption (converted to cipher) and sent to the
receiver who in turn can decrypt it to get back the actual content.
ASCII
American Standard/Scripts Code for Information Interchange
• Most commonly used 7-bit coding scheme
• ASCII is able to encode character set of English language only
• ASCII can represent 27 = 128 i.e. 128 characters
ASCII codes to be learnt by heart

A : 65 0 : 48
B : 66 1 : 49
C : 67 :
: 9 : 57
Z : 90 Backspace : 8
a : 97 Carriage return: 13
b : 98
:
Out of 128, Ninety-five of the encoded characters are
z : 122 printable: these include the digits 0 to 9, lowercase
letters a to z, uppercase letters A to Z, and punctuation
symbols. In addition, the original ASCII specification
included 33 non-printing control codes
Encode the word DATA and convert the encoded value into binary values
which can be understood by a computer.
Encode the word DATA and convert the encoded value into binary values
which can be understood by a computer.
Riya sent the following message encoded in ASCII code to her friend Diya.
Diya is not able to decode the message….could you try!!
1001000 1000101 1001100 1010000
The following is the message encoded in ASCII code. What is the message?

1001000 1000101 1001100 1010000

72 69 76 80 Decimal Equivalents
The following is the message encoded in ASCII code. What is the message?

1001000 1000101 1001100 1010000

72 69 76 80 Decimal Equivalents

H E L P
ISCII
Indian Standard/Scripts Code for Information Interchange

• ISCII was developed in India during mid 1980s


• 8-bit code representation for Indian languages which means it can represent
28=256 characters
• It retains all 128 ASCII codes and uses rest of the codes (128) for additional
Indian language character set
• The supported scripts are: Assamese, Bengali (Bangla), Devanagari, Gujarati,
Gurmukhi, Kannada, Malayalam, Oriya, Tamil, and Telugu.
UNICODE
Universal Code
• developed to incorporate all the characters of every
written language of the world
• provides a unique number for every character, irrespective
of device (server, desktop, mobile), operating system
(Linux, Windows, iOS) or software application (different
browsers, text editors, etc.)
• Commonly used UNICODE encodings are UTF-8, UTF-16
and UTF-32
• Superset of ASCII, and the values 0–127 have the same
character as in ASCII
UNICODE
Universal Code
• Commonly used UNICODE encodings are UTF-8, UTF-16
and UTF-32

Why UTF-8, UTF-16


or UTF-32 ???

UTF: Unicode Transformation Format


UNICODE Why UTF-8,
UTF-16 or UTF-
Universal Code 32 ???

• UTF-32 uses 32-bit values for each character. That allows them to use a fixed-width code for every
character.
• UTF-32 uses four bytes per character regardless of what character it is, so it will always use more
space than UTF-8 to encode the same string.
• UTF-16 uses 16-bit by default, but that only gives you 65k possible characters, which is nowhere near
enough for the full Unicode set.
>>> for i in range(2304,2388):
print(chr(i),end=' ')

ऀऀऀऀ ऄअआइईउऊऋऌऍऎएऐऑऒओऔकखगघङचछजझञटठडढणतथदधनऩपफबभमयरऱलळ
ऴ व श ष स ह ऀ ऀ ऀ ऽ ऀ िऀ ऀ ऀ ऀ ऀ ऀ ऀ ऀ ऀ ऀ ऀ ऀ ऀ ऀ ऀ ॎऀ ऀ ॐ ऀ ऀ ॓

>>> for i in range(2304, 2304+128):


print(chr(i),end=' ')

ऀऀऀऀ ऄअआइईउऊऋऌऍऎएऐऑऒओऔकखगघङचछजझञटठडढणतथदधनऩपफबभमयरऱलळ
ऴ व श ष स ह ऀ ऀ ऀ ऽ ऀ िऀ ऀ ऀ ऀ ऀ ऀ ऀ ऀ ऀ ऀ ऀ ऀ ऀ ऀ ऀ ॎऀ ऀ ॐ ऀ ऀ ॓ ॔ ऀ ऀ ऀ क़ ख़ ग़ ज़ ड़ ढ़ फ़ य़ ॠ ॡ ऀ ऀ । ॥ ० १ २ ३ ४ ५
६७८९॰ॱॲॳॴॵॶॷॸॹॺॻॼॽॾॿ

>>> for i in range(2560, 2560+128):


print(chr(i),end=' ')

਀ऀऀऀ ਀ਅਆਇਈਉਊ਀਀਀਀ਏਐ਀਀ਓਔਕਖਗਘਙਚਛਜਝਞਟਠਡਢਣਤਥਦਧਨ਀ਪਫਬਭਮਯਰ਀ਲਲ਼
਀ ਵ ਸ਼ ਀ ਸ ਹ ਀ ਀ ऀ ਀ ऀ ਿऀ ऀ ऀ ऀ ਀ ਀ ਀ ਀ ऀ ऀ ਀ ਀ ऀ ऀ ऀ ਀ ਀ ਀ ੑ ਀ ਀ ਀ ਀ ਀ ਀ ਀ ਖ਼ ਗ਼ ਜ਼ ੜ ਀ ਫ਼ ਀ ਀ ਀ ਀ ਀ ਀ ਀ ੦ ੧ ੨
੩੪੫੬੭੮੯ऀऀੲੳੴੵ੶਀਀਀਀਀਀਀਀਀
>>> for i in range(3328, 3328+128):
print(chr(i),end=' ')

ഀऀऀ ऀ ਀അആഇഈഉഊഋഌ਀എഏഐ਀ഒഓഔകഖഗഘങചഛജഝഞടഠഡഢ
ണ ത ഥ ദ ധ ന ഩ പ ഫ ബ ഭ മ യ ര റ ല ള ഴ വ ശ ഷ സ ഹ ഺ ഻ ഼ ഽ ऀ ऀ ऀ ऀ ऀ ऀ ऀ ਀ െऀ േऀ ൈऀ ਀
െऀ േऀ െऀ ऀ ऀ ൏ ਀ ਀ ਀ ਀ ൔ ൕ ൖ ऀ ൘ ൙ ൚ ൛ ൜ ൝ ൞ ൟ ൠ ൡ ऀ ऀ ਀ ਀ ൦ ൧ ൨ ൩ ൪ ൫ ൬ ൭
൮൯൰൱൲൳൴൵൶൷൸൹ൺൻർൽൾൿ
ADDITIONAL INFORMATION
BINARY ADDITION NOT IN SYLLABUS THIS YEAR
BINARY ADDITION
BINARY ADDITION
BINARY ADDITION
☺☺☺☺☺☺☺☺☺☺☺☺☺☺☺

You might also like