XI CS Focuspoint Notes
XI CS Focuspoint Notes
Boolean Algebra
Chapter 1: The Discipline of Computing
Abacus: Considered as the first computer for basic arithmetical Number System
calculations. Consist of beads on movable rods divided into two
parts.
(125)10=(157)8
(1005)8=(517)10
Decimal to Hexadecimal:Repeated division by 16 and
grouping the remainders
Hexadecimal to Decimal : Multiply hexadecimal digit by
place value (power of 16)and find their sum
(2D5)16=(725)10
(11011)2=(27)10
Short Cut Method of Convertions: Binary to octal conversion:
Octal to binary conversion:
Representation of numbers(integers):
(i) Sign and magnitude representation:In this method, first
Hexadecimal to binary conversion:
bit from left (MSB) is used for representing sign of integer and remaining
7-bits are used for representing magnitude of integer. For negative integers
sign bit is 1 and for positive integers sign bit is 0.
Representation of characters:
ASCII: American Standard Code for Information Interchange uses 7 bits c)The NOT operator
to represent each character in computer memory and NOT gate: The
UNICODE: It is a 16 bit or 32 bit code It is used to represent all the NOT operator performs
characters used in the written languages in the world. logical negation and the
symbol used for the
operation is - (Over bar) or '
(dash) eg:A'
Circuit designing for Simple Boolean Chapter 3:Components of the Computer System
Expressions:
Processor:The processor also known as CPU, is responsible for
computing and decision making.
1)Accumulator : It stores the result of ALU operations.
2) Memory Address Register (MAR): It stores the address of a
memory location to which data is either to be read or written.
3) Memory Buffer Register (MBR): It holds the data to be written
to or read from the memory.It is also known as Memory Data
Register(MDR).
4) Program Counter (PC): It holds the address of the next
instruction to be executed by the CPU.
5) Instruction Register (IR):It Stores the current instruction.
e-Waste:e-Waste refers to electronic products nearing the end of their Language processors:Language processors are the system
"useful life". programs that translate programs written in high level language or
e-Waste disposal methods: assembly language into its equivalent machine language.
a)Reuse: It refers to second-hand use or usage after the equipment has Types of language processors:
been upgraded or modified. Assembler: Translates the program code written in assembly language
b)Incineration: It is a controlled and complete combustion process in to machine language
which the waste is burned in specially designed incinerators at a high Compiler: Translates a program written in high level language into
temperature machine language in a single run. Compilers are used in C, C++ ....
c)Recycling of e-Waste: Recycling is the process of making or Interpreter: Converts a HLL program into machine language line by
manufacturing new products from a product that has originally served its line
purpose.
d)Land filling: e-Waste material is buried in soil making deep Free and open source software:Free and open source software gives
pits. the user the freedom to use, copy, distribute, examine, change and improve
the software.
The Free Software Foundation (FSF) defines the four freedoms for free
System software: is a set of system programs which aids in the and open source software:
execution of a general user's computational requirements on a computer Freedom 0 - The freedom to run program for any purpose.
system. Components of system software are Operating System,Language Freedom 1 - The freedom to study how the program works and adapt it
Processors and Utility Software to your needs. Access to source code should be provided.
Operating system(OS):Operating system is a set of programs that acts Freedom 2 - The freedom to distribute copies of the software.
as an interface between the user and computer hardware. Operating Freedom 3 - The freedom to improve the program and release
system controls and co-ordinates the operations of a computer.
your improvements to the public, so that the whole community
benefits.
Chapter 4 : Principles of Programming
and Problem Solving
Phases in programming
1. Problem identification
2. Preparing algorithms and flow charts
3. Coding the program using programming language
4. Translation 5. Debugging
6. Execution and testing 7. Documentation
Jump Statements:The statements that facilitate the transfer Declaring arrays: The syntax for declaring an array in C++ is as
follows.
of program control from one place to another.They are return, data_type array_name[size];
goto, break and continue statements.
example: int num[10];
break statement: When a break statement is encountered in a
loop (for, while, do-while), it takes the program control outside the Array initialisation: Array elements can be initialised
immediate enclosing loop. in their declaration statements in the same manner as in the case
of variables, except that the values must be included in braces, as
continue statement:The statement continue is another jump shown in the following examples:
statement used for skipping over a part of the code within the
loop-body and forcing the next iteration. int score[5] = {98, 87, 92, 79, 85};
char code[6] = {‘s’, ‘a’, ‘m’, ‘p’, ‘l’, ‘e’};
for (i=1; i<=10; ++i) float wgpa[7] = {9.60, 6.43, 8.50, 8.65, 5.89, 7.56, 8.22};
{
if (i==6) Accessing elements of arrays: Array is accessed
continue; element-wise That is, only one element can be accessed at a time.
cout<<i<<"\t"; The element is specified by the array name with the subscript.
}
This code gives the following output: 1 2 3 4 5 7 8 9 10 Array operations:The operations performed on arrays
include traversal, searching, insertion, deletion,
sorting and merging.
1.Traversal:Accessing each element of an array at least once
to perform any operation is known as traversal operation.
2.Sorting:Sorting is the process of arranging the elements of
the array in some logical order.
a. Selection sort:To sort an array in ascending
order, the selection sort algorithm starts by finding the minimum
value in the array and moving it to the first position. At the same
time, the element at the first position is shifted to the position of
the smallest element.
b.Bubble sort:Bubble sort is a sorting algorithm that Chapter 9 : String handling and I/O
works by repeatedly stepping through lists that need to be sorted,
comparing each pair of adjacent items and swapping them Functions
if they are in the wrong order.
3.Searching: Searching is the process of finding the location Character array declaration: char my_name[10];
of the given element in the array. initialization method
a.Linear search:Linear search or sequential search is char my_name[10]={'N', 'i', 'k', 'e', 't', 'h'};
a method for finding a particular value in a list.
Input/Output operations on strings:
b.Binary search :Binary search is an algorithm
which uses minimum number of searches for locating the position cin gets()
of an element in a sorted list, by checking the middle, eliminating
half of the list from consideration, and then performing the search gets() accepts
cin does not accept
on the remaining half. continuous input,
the input of spaces
including spaces, TAB
Used to enter Receive a string, and the
numbers. space, TAB
Header file iostream Header file cstdio
Stream functions for I/O operations:These
functions are generally called stream functions since they allow a
stream of bytes (data) to flow between memory and objects.
A. Input functions:These functions allow the input of
character and string data.
i. get() :It can accept a single character or multiple
Example:
characters (string) through the keyboard.
char ch, str[10];
ch=cin.get(ch); //accepts a character and stores in ch
cin.get(ch); //equivalent to the above statement
cin.get(str,10); //accepts a string of maximum 10 characters
ii. Getline():It accepts a string through the
keyboard. The delimiter will be Enter key, the number of
characters or a specified character.
Examples:
char ch, str[10];
int len;
cin.getline(str,len); // With 2 arguments
cin.getline(str,len,ch); // With 3 arguments
B. Output functions:Output functions like put() and write() Improves reusability: A function written once may be
allow a stream of bytes to flow from memory into an output object. used later in many other programs, instead of starting from
i. put():It is used to display a character constant or scratch. This reduces the time taken for program development.
the content of a character variable given as argument. Demerits of modular programming:Proper breaking
char ch='c'; down of the problem is a challenging task. Care should be taken
cout.put(ch); //character 'c' is displayed while setting the hierarchy of the execution of the modules.
cout.put('B'); //character 'B' is printed
cout.put(65); //character 'A' is printed String Functions:for the manipulation of strings,the header
ii. write() :This function displays the string file cstring
contained in the argument. example given below.
char str[10]="hello"; Functions Syntax / Example Operation
cout.write(str,10); strlen() strlen(string) To find the length of a
The above code segment will dispaly the string hello followed by 5 string
white spaces, since the second argument is 10 and the number of
characters in the string is 5 strcpy() strcpy(string1, string2) To copy one string
into another
Chapter 10 : Functions strcmp() strcmp(string1, string2) To compare two
strings
strcmpi() strcmpi(string1, string2) To compare two
Concept of modular programming:In programming, the strings ignoring
entire problem will be divided into small sub problems that can be
solved by writing separate programs. This kind of approach is
cases
known as modular programming.