Chapter 1: The Discipline of Computing: Computer Science - XI
Chapter 1: The Discipline of Computing: Computer Science - XI
in
Generations of Computers:
Number representation methods: (i) Sign and magnitude representation (ii) 1’s complement
representation (iii) 2’s complement representation.
Character Representations
ASCII: American Standard Code for Information Interchange. It uses 7 bits to represent a
character. Another version ASCII-8 uses 8 bits.
Unicode: Originally used 16 bits which can represent up to 65,536 characters. Unicode can
represent characters in almost all written languages of the world.
Boolean operations: The operations performed on the Boolean values 0s and 1s. The
operations are OR (Logical Addition), AND (Logical Multiplication), NOT (Logical Negation).
Processor: CPU is referred to as the processor. It is responsible for all computing and
decision making operations. It coordinates the working of a computer. It has ALU, CU and
registers as components.
Important registers inside a CPU:
Accumulator, Memory Address Register (MAR), Memory Buffer Register (MBR), Instruction
Register (IR), Program Counter (PC).
Ports: Used to connect external devices. VGA, PS/2, USB, HDMI, Ethernet are examples.
RAM: Random Access Memory, Volatile, CPU can directly access it.
Measuring units of memory:
Binary Digit = 1 Bit 1 MB (Mega Byte) = 1024 KB
1 Nibble = 4 Bits 1 GB (Giga Byte) = 1024 MB
1 Byte = 8 Bits 1 TB (Tera Byte) = 1024 GB
1 KB (Kilo Byte) = 1024 Bytes 1 PB (Peta Byte) = 1024 TB
e-Waste: Electronic waste may be defined as discarded computers, office electronic
equipment, entertainment devices, mobile phones, television sets and refrigerators.
e-Waste disposal methods: Re-use, incineration (combustion process in which the waste is
burned in incinerators at a high temperature), recycling, (the process of making new
products from a product that has originally served its purpose) and land filling.
System software: The components of system software are Operating system, Language
processors and Utility software.
Operating system (OS): A set of programs that acts as an interface between the user and
computer hardware. It controls and co-ordinates the operations of a computer.
Function of OS: Process management, memory management, file management, device
management, security management and command interpretation.
Language processors: These are the system programs that translate programs written in
high level language into machine language. Eg: Interpreter (converts a HLL program into
machine language line by line) and Compiler (translates a program written in high level
language into machine language).
Free and Open source software: Gives the user the freedom to use, copy, distribute,
examine, change, and improve the software. GNU/Linux is a free and open source operating
system. Firefox, Libre Office are also examples.
Four freedoms for free and open source software:
Freedom 0, Freedom 1, Freedom 2, Freedom 3
Debugging: The process of detecting and correcting the errors in a program. The following
types of errors are corrected.
Syntax errors: The errors occur when the rules or syntax of the programming language are
not followed.
Logical error: It is due to improper planning of the program's logic.
Run time error: These errors occur unexpectedly when computer becomes unable to
process some improper data.
Type promotion: It is the implicit type conversion is performed by C++ compiler internally.
Type casting: It is the explicit type conversion and is done by the programmer.
main() function: An essential function in every C++ program. The execution starts at main()
and ends within main().
Structure of C++ program:
#include<iostream.h> Pre processor directive to include header file
using namespace <std> To use cin and cout independently
int main() Essential function in C++ program
{
statements; Program statements
return 0; To end the program
}
switch statement
Syntax:
switch(expression)
{
case constant_1 : statement block 1;
break;
case constant_2 : statement block 2;
break;
:
5 Joy John’s CS Capsule
Computer Science - XI Downloaded from www.hsslive.in
:
case constant_n-1 : statement block n-1;
break;
default : statement block n;
}
for statement
It is also an entry-controlled loop in C++. All the three loop elements (initialisation, test
expression and update statement) are placed together in for statement. The syntax is:
for (initialisation; test expression; update statement)
{
body-of-the-loop;
}
do...while statement
In the case of for loop and while loop, the test expression is evaluated before executing
the body of the loop. Its syntax is :
initialisation of loop control variable;
do
{
body of the loop;
updation of loop control variable;
} while(test expression);
Chapter 8: Arrays
Arrays are used to store a set of values of the same type under a single variable name.
The syntax for declaring an array in C++ is as follows.
data_type array_name[size];
abs(int)
Functions
The data_type is any valid data type of C++. The function_name is a user-defined word
(identifier). The argument_list, which is optional, is a list of parameters, i.e. a list of
variables preceded by data types and separated by commas. The body comprises of C++
statements required to perform the task assigned to the function. Function usually returns a
value and it should be of the data type of the function.
Arguments or parameters are the means to pass values from the calling function to the
called function. The variables used in the function definition as arguments are known as
formal arguments. The constants, variables or expressions used in the function call are
known as actual (original) arguments.