Class - XI
Part - I
Government of Kerala
DEPARTMENT OF EDUCATION
State Council of Educational Research and Training (SCERT); Kerala
2016
Dear students,
Computer Science, a subject belonging to the discipline of Science
and of utmost contemporary relevance, needs continuous updating.
The Higher Secondary Computer Science syllabus has been revised
with a view to bringing out its real spirit and dimension. The constant
and remarkable developments in the field of computing as well as
the endless opportunities of research in the field of Computer Science
and Technology have been included.
This textbook is prepared strictly in accordance with the revised syllabus
for the academic year 2014 - 15. It begins with the historical
developments in computing and familiarises the learner with the latest
technological advancements in the field of computer hardware,
software and network. The advancement in computer network,
Internet technology, wireless and mobile communication are also
dealt with extensively in the content. In addition to familiarising various
services over the Internet, the need to be concerned about the factors
that harness morality and the awareness to refrain from cyber security
threats are also highlighted.
The major part of the textbook as well as the syllabus establishes a
strong foundation to construct and enhance the problem solving
and programming skills of the learner. The multi-paradigm
programming language C++ is presented to develop programs
which enable computers to manage different real life applications
effectively. The concepts and constructs of the principles of
programming are introduced in such a way that the learner can
grasp the logic and implementation methods easily.
I hope this book will meet all the requirements for stepping to levels
of higher education in Computer Science and pave your way to the
peak of success.
Wish you all success.
Dr P. A. Fathima
Director, SCERT; Kerala
3. As a result of carrying out the instructions, some outputs (here, omlette) are
obtained.
The instructions given to process the inputs are, however, not precise. They are
ambiguous. For example, the interpretation of "till the side is fried" in step 5 and "fried
well" in step 6 can vary from person to person. Due to such imprecise instructions,
different persons following the same recipe with the same inputs can produce omlettes
which differ in size, shape and taste.
The above ambiguities should be avoided while writing steps to solve the problems
using the computer.
a. Algorithm
Mathematicians trace the origin of the word algorithm
to a famous Arab mathematician, Abu Jafar Mohammed
Ibn Musaa Al-Khowarizmi. The word 'algorithm' is
derived from the last part of his name Al-Khowarizmi.
In computer terminology an algorithm may be defined
as a finite sequence of instructions to solve a problem.
It is a step-by-step procedure to solve a problem, where
each step represents a specific task to be carried out.
However, in order to qualify an algorithm, a sequence Fig. 4.4 : Abu Jafar Mohammed
of instructions must possess the following Ibn Musaa Al-Khowarizmi
(780 - 850)
characteristics:
(i) It should begin with instruction(s) to accept inputs. These inputs are processed by
subsequent instructions. Sometimes, the data to be processed will be given along
with the problem. In such situations, there will be no input instruction at the
beginning of the algorithm.
(ii) Use variables to refer the data, where variables are user-defined words consisting
of alphabets and numerals that are similar to those used in mathematics. Variables
must be used for inputting data and assigning values or results.
(iii) Each and every instruction should be precise and unambiguous. In other words,
the instructions must not be vague. It must be possible to carry them out. For
example, the instruction "Catch the day" is precise, but cannot be carried out.
(iv) Each instruction must be sufficiently basic such that it can, in principle, be carried
out in finite time by a person with paper and pencil.
(v) The total time to carry out all the steps in the algorithm must be finite. As algorithm
may contain instructions to repetitively carry out a group of instructions, this
requirement implies that the number of repetitions must be finite.
(vi) After performing the instructions given in the algorithm, the desired results
(outputs) must be obtained.
114
6. Data Types and Operators
The exact sizes of these data types depend on the compiler and computer you are
using. It is guaranteed that:
• a double is at least as big as a float.
• a long double is at least as big as a double.
Each type and their modifiers are listed in Table 6.1 (based on GCC compiler) with
their features.
Name Description Size Range
char Character 1 byte signed: -128 to 127
unsigned: 0 to 255
short int Short Integer 2 bytes signed: -32768 to 32767
(short) unsigned: 0 to 65535
int Integer 4 bytes signed: -2147483648 to 2147483647
unsigned: 0 to 4294967295
long int Long integer 4 bytes signed: -2147483648 to 2147483647
(long) unsigned: 0 to 4294967295
+/-38
Floating point number 4 bytes -3.4×10 to +3.4 × 10+/-38 with
float
approximately 7 significant digits
double Double precision 8 bytes -1.7 × 10+/-308 to +1.7 × 10+/-308 with
floating point number approximately 15 significant digits
long
Long double precision 12 bytes -3.4 × 10+/-4932 to +3.4 ×10+/-4932 With
double
floating point number approximately 19 significant digits
Table 6.1: Data type and type modifiers
The values listed in Table 6.1 are only sample values to
give you a general idea of how the types differ. The
values for any of these entries may be different on your
system.
6.5 Variables
Memory locations are to be identified to refer data. Variables are the names given
to memory locations. These are identifiers of C++ by which memory locations are
referenced to store or retrieve data. The size and nature of data stored in a variable
depends on the data type used to declare it. There are three important aspects for a
variable.
149