ACT – ASSOCIATION OF COMPUTER TEACHERS
MALAPPURAM
ComprehensiveStudy Notes on
COMPUTER SCIENCE
CLASS XI
Contents
1 The discipline of Computing 2
2 Data Representation and Boolean Algebra 6
3 Components of Computer System 15
4 Principles of programming and problem solving 24
5 Introduction to programming 28
6 Data types and operators 30
7 Contro Statements
F 35
8 Arrays 40
9 String handling using I/O functions 45
10 Functions 47
11 Computer networks 52
12 Internet and mobile computing 60
, Join Telegram Channel: https://t.me/hsslive Downloaded from www.Hsslive.in ®
2
CHAPTER 1
The discipline of Computing
Computing milestones and machine evolution
1. Development of number systems:
Origin Base Features
Egyptians (3000 BC) 10 • Right to left
Sumerian/ 60 • Sexagesima system F
• Left to Right
Babylonian
• Used blank space for 0
Chinese (2500 BC) 10 • Used bamboo rods to represent digits
India (1500 years • Invented a symbo for zero F
ago) • Positiona decima system
F F
• Hindu-Arabic Numera system F
Greek (500 BC) 10 • Ionian number system
Roman Numeral • 7 letters[ I, V, X, (50 ),C (100),
F
D(500), M (1000 ) ]
Mayans 20 • Great accuracy
Evolution of the computing machine:
1.Abacus:
• means calculating!!board.
• Discovered!!by!!the!!Mesopotamians.
• Used!!for!!arithmetical!!calculations.
2. Napier's!!bones.
• John! ! Napier! ! invented! ! a! ! set! ! of! ! numbered! ! rods! ! to! ! simplify! ! multiplication! ! process! ! (
Napier's!!bones).
• He also!!invented!!logarithm.
3. Pascaline:
• Blaise! ! Pascal!!developed!!in!!1642
• can! ! perform! ! arithmetic operations.
al
• Operated!!by!!dialling! ! a!!series!!of!!wheels,!! gears!!and!!cylinders.
4. Leibniz's calculator! ! ! ! :
• Leibniz! ! designed! ! a! ! calculating! ! machine!!called!!step!!reckoner.
• Expanded!!on!!Pascal’s!!idea!!to!!perform!!multiplication!!and!!division!!too.
Preparedby :LijuMathew(MTHSS Chungathara) PriyaMD(GHSS Purathur) JessieMathew(GHSS Vaniyambalam)
, Join Telegram Channel: https://t.me/hsslive Downloaded from www.Hsslive.in ®
3
5. Jacquard's!!loom:
• Joseph! ! Jacquard!!invented!!a!!mechanical!!loom!!to!!simplify !! a!!textile !! manufacturi
ng ! ! process.
• The! ! loom! ! controlled! ! by!!punched!!cards!!had!!the!!ability!!to!!store!!information.
6. Difference!!Engine
• Developed!!by!!Charles!!Babbage
• compile!!mathematical!!tables,!!do!!arithmetical!!operations!!and!!print!!results!!automatically.
• Developed! ! by! ! Charles! ! Babbage! ! in! ! 1833
• Had!!many!!essential!!features!!found!!in!!modern!!digital!!computer.
• Programmable!!using!!punched!!cards
• It!!had!!a!!store!!(memory)!! and!!a!!separate!!‘Mill’!!(Processor)
8. Hollarith’s!!Machine
• Herman!!Hollarith!!made!!first!!electromechanical!!punched!!card!!tabulator!!with!!input,!!output!!a
nd!!instructions.
• Used!!electricity!!to!!read,!!count!!and!!sort!!punched!!cards.
9. Mark-I Computer:
• Developed!!by!!Howard!!Aiken
• Could! ! do! ! all!! 4! ! arithmetic!!operations,logarithmic!! and!!trigonometric!!functions.
Generations!!of!!Computer
1) First!!generation!!computers:
• Used!!Vacuum!!tubes
• The! ! ENIAC!! (Electronic! ! Numerical! ! Integrator! ! and! ! Calculator! ! ),! ! the
first!!general! ! purpose! ! programmable! ! electronic!!computer(built! ! by!!J.! ! P.! ! Eckert!!and! ! John!!
Mauchly.)
• UNIVAC(! ! UNIVersal! ! Automatic! ! Computer! ! ).! ! -! ! first! ! commercially! ! successful!! computer
• Von!!Neumann!!designed! ! EDVAC(! ! Electronic!!Discrete!!Variable!!Automatic! ! Computer!!)
with! ! a!!memory!!to!!store!!program!!and!!data.(!!stored!!program!!concept)
2) Second! ! Generation! ! Computers! ! :
• Vacuum! ! tubes! ! were! ! replaced! ! by!! transistors ! ! reducing ! ! size.
• less! ! electricity,! ! less! ! expensive.
• Concept!!of!!programming!!language!!was!!developed.!! High!!Level!!Languages!!like!!FORTAN
(FORmula! ! ! ! TRANslation),! ! COBOL!!(COmmon Business! ! Oriented! ! Language)! ! ! ! developed.
• Magnetic! ! core! ! memory! ! (Primary!!memory! ! )! ! and! ! magnetic! ! disk! ! memory! ! (Sec
ondary!!memory!!).
• The! ! popular!! computers! ! are! ! IBM! ! 1401! ! and!!IBM!!1620
Preparedby :LijuMathew(MTHSS Chungathara) PriyaMD(GHSS Purathur) JessieMathew(GHSS Vaniyambalam)
, Join Telegram Channel: https://t.me/hsslive Downloaded from www.Hsslive.in ®
4
3) Third! ! Generation!! Computers:
• Silicon! ! chips! ! or! ! IC(Integrated Circuits)!!that!!contain!! very!! small!!transistors!!were
developed by Jack Kilby F F F
• Transistors were replaced by IC's. F F F F
• It reduced size, increased speed and efficiency, and became cheaper.
F F F F F F F F
• High Level Language BASIC (Beginner’s All Purpose Symbolic Instruction Code )
F F F F F F F F F F F
was developed F
• Moore's Law states that the number of transistors on IC's doubles approximately every two
F F F F F F F F F F F F F
years.
• The popular computers are IBM 360 and IBM 370.
F F F F F F F F
4) Fourth Generation Computers:
F F
• Microprocessors are used (a single chip with Large Scale of Integration (LSI) of electronic F F F F F F F F F F F F F F
components)
• Later LSI circuits were replaced by VLSI ( Very Large Scale Integration ).
F F F F F F F F F F F F
• IBM PC and Apple II are popular computers. Programming Languages like. C, C++, Java etc.were
F F F F F F F F F F F F F F F
developed.
e). Fifth Generation Computers:
F F
• They are based on Artificial Intelligence (AI).
F F F F F F
• AI is the ability of machines to simulate human intelligence
F F F F F F F F F
• Presently in the development stage. F F F F
• Common AI programming Languages- LISP and Prolog. F F F F F F
Program:
The set of detailed instructions given to a computer for executing specific tasks.
F F F F F F F F F F F F
Programming languages are artificial languages designed to give instructions to the computers.
F F F F F F F F F F F
• Machine language (Low Level Language -LLL).consists of 0's and 1's. This is the only language
F F F F F F F F F F F F F F F
understood by the computer. F F F
• Assembly language, with English like words instead of 0's and 1's EDSAC (Electronic Delay
F F F F F F F F F F F F F F
Storage Automatic Calculator ) built in 1949 was the first computer to use assembly language.
F F F F F F F F F F F F F F
• Later, High Level Languages (HLL) like, BASIC, C, C++, Java etc were developed.
F F F F F F F F F F F F
Algorithm and Computer programs: F F F
An algorithm is a step by step procedure to solve a problem.
F F F F F F F F F F F
Theory of computing:
F F
• This branch deals with how efficiently problems can be solved based on computation models
F F F F F F F F F F F F F F
and related algorithms. The study is based on a mathematical abstraction of computers called
F F F F F F F F F F F F F F
model of computation. F F
• The most commonly used model is Turing machine named after the computer scientist Alan
F F F F F F F F F F F F F
Preparedby :LijuMathew(MTHSS Chungathara) PriyaMD(GHSS Purathur) JessieMathew(GHSS Vaniyambalam)
, Join Telegram Channel: https://t.me/hsslive Downloaded from www.Hsslive.in ®
5
Turing. He is considered as the Father of modern computer science and Artificial intelligence.
F F F F F F F F F F F F F
Turing machine:
F
• Introduced by Alan Turing F F F
• Theoretical device that uses symbols on a long tape (acting like memory)
F F F F F F F F F F F
• The tape contains cells with a blank, 0 or 1
F F F F F F F F F
• The action decided by the current state, symbol currently being read and table of transition
F F F F F F F F F F F F F F F
rules.
• Considered as the first theoretical development towards the idea of Artificial Intelligence.
F F F F F F F F F F F
Preparedby :LijuMathew(MTHSS Chungathara) PriyaMD(GHSS Purathur) JessieMathew(GHSS Vaniyambalam)
, Join Telegram Channel: https://t.me/hsslive Downloaded from www.Hsslive.in ®
6
CHAPTER 2 F
Data Representation and Boolean Algebra
F F F F
Number system
F
• The number of symbols used in a number system is called base or radix.
F F F F F F F F F F F F F
Number System Base Symbols used F F Example
Binary 2 0, 1 F (1101)2
Octal 8 0, 1, 2, 3, 4, 5, 6, 7
F F F F F F F (236)8
Decimal 10 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
F F F F F F F F F (5876)10
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
F F F F F F F F F F F F F F F
Hexadecimal 16 (A, B, C, D, E, F represents 10, 11, 12, 13, 14, 15
F F F F F F F F F F F F (12AF)16
respectively)
• MSD: The leftmost digit of a number is called Most Significant Digit (MSD).
F F F F F F F F F F F F
• LSD: The right most digit of a number is called Least Significant Digit (LSD).
F F F F F F F F F F F F F
Number Conversions
F
Decimal to binary conversion
F F F
Repeated division by 2 and grouping the remainders( 0 or 1)
F F F F F F F F F F
Example: Convert (30)10 to binary.
F F F F
2 Remainders F
2 0
2 1
2 1
2 1
0 1
(30)10 = (11110)2
F F
Decimal fraction to binary
F F F
1. Multiply the decimal fraction by 2.
F F F F F
2. Integer part of the answer will be first digit of binary fraction.
F F F F F F F F F F F
3. Repeat step 1 and step 2 to obtain the next significant bit of binary fraction.
F F F F F F F F F F F F F F
Example: Convert (0.625)10 to binary.
F F F F
0.625 x 2 = 1.25 F F F F
1 0.25 x 2 = 0.50
F F F F
0 0.50 x 2 = 1.00
F F F F
Preparedby:LijuMath1ew (MTH
F F
.00
FS S Chungathara) PriyaMD(GHSS Purathur) JessieMathew(GHSS Vaniyambalam)
F F F F F F
, Join Telegram Channel: https://t.me/hsslive Downloaded from www.Hsslive.in ®
7
(0.625)10 = (0.101)2 F F
Decimal to Octal conversion
F F F
Repeated division by 8 and grouping the remainders.(0,1,2,3,4,5,6 or 7)
F F F F F F F F F
Example: Convert (120)10 to octal. F F F F
8 120 Remainders
8 15 0
8 1 7 (120)10 = (170)8 F F
8 0 1
Decimal to Hexadecimal conversion
F F F
Repeated division by 16 and grouping the remainders( 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E or F)
F F F F F F F F F F
Example: Convert (165)10 to hexadecimal. F F F F
16 165 Remainders F
16 10 5
16 0 10 (A) F
(165)10 = (A5)16 F F
Binary to decimal conversion
F F F
Multiply binary digit by place value (power of 2) and find their sum.
F F F F F F F F F F F F
Example: Convert (110010)2 to decimal. F F F F
(110010)2 = 1×25 + 1×24 + 0×23 + 0×22 + 1×21 + 0×20
F
F
F
F
F
F
F
F
F
F
F Weight 25 24 23 22 21 20
= 32 + 16 + 0 + 0 + 2 + 0 = (50)10
F F F F F F F F F F F F F Bit 1 1 0 0 1 0
Binary fraction to decimal
F F F
Multiply binary digit by place value (negative power of 2) and find their sum.
F F F F F F F F F F F F F F
Example: Convert (0.101)2 to decimal. F F F F
Weight 2-1 2-2 2-3
(0.101)2 = 1×2-1 + 0×2-2 + 1×2-3
F F
F
F
F
F Bit 1 0 1
= 0.5 + 0 + 0.125 = (0.625)10
F F F F F F F
Octal to decimal conversion
F F F
Multiply octal digit by place value (power of 8) and find their sum.
F F F F F F F F F F F F
Example: Convert (167) 8 to decimal. F F F F F
(167) 8 = 1×82 + 6×81 + 7×80
F F
F
F
F
F
Weight 82 81 80
= 64 + 48 + 7 = (119)10
F F F F F F F
Octa digit F 1 6 7
Hexadecimal to decimal conversion F F F
Multiply hexadecimal digit by place value (power of 16) and find their sum.
F F F F F F F F F F F F
Example: Convert (2B5) 16 to decimal. F F F F F
(2B5) 16 = 2×162 + 11×161 + 5×160
F F
F
F
F
F
Weight 162 161 160
Preparedby :LijuMathew(MTHSS Chungathara) Hexadecima
PriyaMD(GHSS
digit Purathur)
2 B 5JessieMathew(GHSS Vaniyambalam) F
, Join Telegram Channel: https://t.me/hsslive Downloaded from www.Hsslive.in ®
8
= 512 + 176 + 5
F F F F F
= (693)10
F
Octal to binary conversion
F F F
Converting each octal digit to its 3 bit binary equivalent. F F F F F F F F F
Octal digit F 0 1 2 3 4 5 6 7
Binary equivalent F 000 001 010 011 100 101 110 111
Example: Convert (437)8 to binary. F F F F
3- bit binary equivalent of each octal digits are
F F F F F F F
4 3 7
(437)8 = (100011111)2 F F
100 011 111
Hexadecimal to binary conversion F F F
Converting each hexadecimal digit to its 4 bit binary equivalent.
F F F F F F F F F
Example: Convert (AB)16 to binary. F F F F
Octal digit F 0 1 2 3 4 5 6 7 8 9 A B C D E F
Binary equivalent F 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
4- bit binary equivalent of each hexadecimal digits are
F F F F F F F
(AB)16 = (10101011)2 F F
Binary to octal conversion
F F F
Form groups of 3 bits each from right to left and then convert each to its octal form
F F F F F F F F F F F F F F F F F
Example: Convert (10111000011) 2 to octal. F F F F
Group the given binary number from right as shown below:
F F F F F F F F F
010 111 000 011
if the left most group
F F F F F
does not have 3 bits, F F F F F (10111000011)2 = (2703)8 F F
then add leading zeros
F F F F
2 7 0 3
to form 3 bit binary.
F F F F
Binary to Hexadecimal conversion
F F F
Form groups of 4 bits each from right to left and then convert each to its hexadecimal form
F F F F F F F F F F F F F F F F F
Example: Convert (100111100111100)2 to hexadecimal.
F F F F
0100 1111 0011 1100 (100111100111100)2 = (4F3C)16 F F
if the left most group
does not have 4 bits,
then add leading zeros 4
to form 4 bit binary. 15(F) 3 12(C)
Octal to hexadecimal conversion
F F F
Convert octal to binary and then binary to hexadecimal.
F F F F F F F F
Preparedby :LijuMathew(MTHSS Chungathara) PriyaMD(GHSS Purathur) JessieMathew(GHSS Vaniyambalam)
, Join Telegram Channel: https://t.me/hsslive Downloaded from www.Hsslive.in ®
9
Example: Convert (537)8 to hexadecimal equivalent.
F F F F F F
First convert (537)8 into binary.
F F F F
5 3 7
= (101011111)2
F
101 011 111
Then convert (101011111)2 into hexadecimal.
F F F F
0001 0101 1111
1 5 15(F) = (15F)16
F
(537)8 = (15F)16 F F
Hexadecimal to octal conversion
F F F
Convert hexadecimal to binary and then binary to octal.
F F F F F F F F
Example: Convert (A3B)16 into octal equivalent.
F F F F F F
First convert (A3B)16 into binary.
F F F F
= (101000111011)2
F
Then convert (101000111011) 2 into octal.
F F F F
101 000 111 011
= (5073)8
F (A3B)16 = (5073)8 F F
5 0 7 3
Representation of integers F F
3 methods : (i) Sign and magnitude representation, (ii) 1’s complement representation &
F F F F F F F F F F F F
(iii) 2’s complement representation
F F F
i) Sign and magnitude representation (8 bit form)
F F F F F F
• Find binary equivalent of integer
F F F F
• Make the first bit 1 for negative numbers and 0 for positive numbers.
F F F F F F F F F F F F
= 10111
= 00010111
Sign and magnitude of +23 = 00010111
= 10111
= 00010111
Sign
and magnitude of -23 = 10010111
ii) 1’s complement representation
F F
• If the number is negative, it is represented as 1’s complement of 8-bit form binary.
F F F F F F F F F F F F F F
• 1’s complement of a binary is obtained by changing 0 to 1 and 1 to 0.
F F F F F F F F F F F F F F F
• If the number is positive, the 8-bit form binary itself is the 1’s complement.
F F F F F F F F F F F F F
Preparedby :LijuMathew(MTHSS Chungathara) PriyaMD(GHSS Purathur) JessieMathew(GHSS Vaniyambalam)
, Join Telegram Channel: https://t.me/hsslive Downloaded from www.Hsslive.in ®
10
Example: Represent +23 in 1’s complement form.
F F F F F F
Binary of 23 in 8-bit form = (00010111)2
F F F F F F F
+23 in 1’s complement form = (00010111)2(For +ve numbers, no need to find 1’s
F F F F F F F F F F F F F F
complement)
Example: Represent -23 in 1’s complement form.
F F F F F F
Binary of 23 in 8-bit form = (00010111)2
F F F F F F F
-23 in 1’s complement form = (11101000)2
F F F F F F F F (by replacing 0 with 1 and 1 with 0)
F F F F F F F F
iii) 2’s complement representation
F F
• 2’s complement of a binary number is calculated by adding 1 to its 1’s complement.
F F F F F F F F F F F F F F
• If the number is negative, it is represented as 2’s complement of 8-bit form binary.
F F F F F F F F F F F F F F
• If the number is positive, 8-bit form binary itself is the 2’s complement.
F F F F F F F F F F F F
Example: Represent +23 in 2’s complement form.
F F F F F F
Binary of 23 in 8-bit form = (00010111)2
F F F F F F F
+23 in 2’s complement form = (00010111)2(For +ve numbers, no need to find 2’s
F F F F F F F F F F F F F F
complement)
Example: Represent -23 in 2’s complement form.
F F F F F F
Binary of 23 in 8-bit form F F F F F = (00010111)2
F
-23 in 1’s complement form = (11101000)2
F F F F F F F (by replacing 0 with 1 and 1 with 0)
F F F F F F F F
-23 in 2’s complement form = 11101000 +
F F F F F F F
1
= (11101001)2
F
Representation of floating point numbers F F F F
• Any number in floating point notation contains two parts, mantissa and exponent.
F F F F F F F F F F F
• Eg: 25.45 can be written as 0.2545×102, where 0.2545 is the mantissa and the power 2 is the
F F F F F F F F F F F F F F F F F F
exponent.
Representation of characters F F
Different methods to represent characters in computer memory are: ASCII, Unicode, ISCII,
F F F F F F F F F F F F
EBCDIC
ASCII(American Standard Code for Information Interchange) F F F F F
• Uses 7 bits per character, can represent only 128 characters.
F F F F F F F F F
• ASCII-8, which uses 8 bits, can represent 256 characters.
F F F F F F F F
EBCDIC(Extended Binary Coded Decimal Interchange Code) F F F F F
• 8 bit code used in IBM Machines. It can represent 256 characters.
F F F F F F F F F F F
Preparedby :LijuMathew(MTHSS Chungathara) PriyaMD(GHSS Purathur) JessieMathew(GHSS Vaniyambalam)