0% found this document useful (0 votes)
99 views80 pages

12 Computer Science EM

Uploaded by

Dharani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
99 views80 pages

12 Computer Science EM

Uploaded by

Dharani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 80

www.kalviexpress.in www.kalviexpress.

in

Government of Tamilnadu

REFRESHER COURSE MODULE

in
2021-2022

s.
es
pr
12
ex
vi
al
.k

COMPUTER SCIENCE
w
w
w

Department of School Education

12th Computer science_RCM_EM_Without day.indd 1 8/14/2021 12:39:53 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

in
s s.
p re
ex
vi
al
.k
w
w
w

II

12th Computer science_RCM_EM_Without day.indd 2 8/14/2021 12:39:53 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

CONTENTS
SL.NO. TITLE Page No.
1 Fundamentals of Computers 1
2 Computer Organization 3
3 Windows Operating System 5
4 Windows Operating System 7
5 Flowchart 9
6 Pseudo-Code 11
7 Introduction to C++ 13

in
8 Operators 15
9 Sample C++ Program and Execution 18

s.
10 Data Types,Variables 20

s
11 Selection Statements-if,if..else 23
12
13
Selection Statements-nested if..else
Iteration Statements -for loop
p re 26
30
ex
14 while and do-while Loops 33
15 Jump Statements 35
vi

16 Functions 38
17 C++ header files and Built-in functions 40
al

18 User defined functions 43


.k

19 Different forms of user defined function declarations 45


w

20 Recursive function 48
21 Scope Rules of variables 50
w

22 Single-Dimensional Array 53
w

23 Two -Dimensional Array 56


24 Introduction to Object Oriented Programming Techniques 59
25 Classes and Objects-Introduction 62
26 Classes and Objects-Class Members 65
27 Constructors 68
28 Destructors 70
29 Computer Ethics and Cyber Security 72
30 Tamil Computing 74

III

12th Computer science_RCM_EM_Without day.indd 3 8/14/2021 12:39:53 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

in
s s.
p re
ex
vi
al
.k
w
w
w

IV

12th Computer science_RCM_EM_Without day.indd 4 8/14/2021 12:39:53 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

Fundamentals of
1 Computers
Learning Outcome
After learning the concepts in this topic , the students will be able
™™ To know about computers.
™™ To know the components and their functions.
™™ To know about various generations of computer.

in
Teacher Activity 1

s.
Introduction

s
A Computer is an electronic device that manipulates information or data. It has the ability to store,
retrieve and process data.
Uses of computer
p re
Computers are used in the field of education, research, travel and tourism, weather forecasting,
social networking, e-commerce etc.
ex

Generations of Computers
vi

Period and
S.no Generations Merit/Demerit
component used
al

FIRST 1940-1956 Vacuum Big Size, Malfunction, Machine Language


.k

1
GENERATION tube Ex: ENIAC,EDVAC
w

Smaller, Assembly Language, First


SECOND 1956-1964 Transistor
2 Operating system developed. Ex: IBM 1401,
w

GENERATION
IBM 1620
w

THIRD 1964-1971 Integrated Faster and more reliable, High Level


3
GENERATION circuit Languages were used Ex: IBM 360 SERIES

Smaller and Faster, Microcomputer series


FOURTH 1971-1980 Micro
4 such as IBM, APPLE were developed.
GENERATION Processor
Portable Computers were introduced.
1980-till date
FIFTH Parallel Processing , Introduction of AI, Can
5 Ultra Large Scale
GENERATION recognize Images and Graphics
Integration
Natural Language Processing, Development
SIXTH
6 In Future of robotics, Development of voice
GENERATION
recognition Software

12th Computer science_RCM_EM_Without day.indd 1 8/14/2021 12:39:54 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

Teacher Activity 2
Components of Computer
Input unit
It is used to feed any form of data to the computer. Ex : Keyboard, Mouse etc.

Central Processing Unit (CPU)


It has three components.
ALU (Arithmetic and Logic Unit)
It performs arithmetic operations like addition, subtraction, multiplication, division and
logical operations.
CU (Control Unit )

in
It controls the flow of data between the CPU, memory and I/O devices.
MU (Memory Unit )

s.
It has two types. They are primary memory and secondary memory.

s
œœ Primary Memory: It is used to store the programs and data temporarily. Eg: RAM

Output Unit
p re
œœ Secondary Memory: Used to store the data permanently. Eg: CD-ROM

It is any hardware component that conveys information to users in an understandable form.


ex
Eg: Monitor, Printer

Student Activity
vi
al

1. The teacher asks the students to categorize the input and output devices in their note book.
.k

Evaluation
w
w

1. What is computer ?
w

2. Match the following.

a. First generation - Transistors


b. Second generation - IC
c. Third generation - Microprocessor
d. Fourth generation - ULSI
e. Fifth generation - Vacuum tubes

XII Std Computer Science 2

12th Computer science_RCM_EM_Without day.indd 2 8/14/2021 12:39:54 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

Computer
2 Organization
Learning Outcome

After learning the concepts in this topic , the students will be able
™™ To know the processors and their characteristics.
™™ To know the importance of memory devices and their roles in a computer.

in
™™ To know the secondary storage devices and their usage.

s.
Teacher Activity 1

s
Basics of Microprocessors
p re
¾¾ Microprocessor is a programmable multipurpose silicon chip.
¾¾ It processes data as per instructions stored in memory.
¾¾ Performance of microprocessor depends on the characteristics
ex

i) CLOCK SPEED: Internal clock that regulates the speed at which it executes instructions.
INSTRUCTION SET: Basic set of machine level instructions that a microprocessor is
ii) 
vi

designed to execute is called as an instruction set.


al

iii) WORD SIZE: It determines the amount of RAM that can be accessed by a microprocessor.

Memory Devices
.k

Main memories are RAM and ROM.


w

RAM (Random Access Memory):


w

¾¾ RAM is a volatile memory. It means that the information stored in it is not permanent.
¾¾ It allows both read and write operations.
w

¾¾ Two types of RAM : Dynamic RAM , Static RAM

ROM (Read Only Memory):


¾¾ It is called as non-volatile memory.
¾¾ Pre-recorded program available in ROM performs diagnostics that boots the computer.
¾¾ It cannot be modified or removed.
¾¾ Types of ROM are
œœ Programmable Read Only Memory (PROM)
œœ Erasable Programmable Read Only Memory (EPROM)
œœ Electrically Erasable Programmable Read Only Memory (EEPROM)
3 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 3 8/14/2021 12:39:54 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

Teacher Activity 2
Secondary Storage Devices
¾¾ To store data and programs permanently .

Hard Disk :
œœ It is a magnetic disk on which you can store data.
œœ It has the stacked arrangement of disks accessed by a pair of heads for each of the disks.

Compact Disk (CD):


œœ It is made from 1.2 millimeters thick, poly carbonate plastic material.
œœ The capacity of the ordinary CD-ROM is 700 MB..

in
Flash Memory:
œœ It offers fast access time.

s.
œœ The time taken to read or write a character in memory is called access time.

s
œœ Capacity of flash memory varies from 1 GB to 2 TB.

Digital versatile Disk (DVD)


re
œœ It is an optical disc capable of storing up to 4.7GB of data
p
œœ DVDs are often used to store movies at a better quality.
ex

Blue-ray Disc:
œœ It is a high density optical disc used for PlayStation games and playing High definition movies.
vi

œœ It can store up to 50GB of data.


al

œœ It uses a blue violet laser to write.


.k

Student Activity
w

1. The students are divided into groups and are asked to identify the storage capacity of CD, DVD,
Flash Memory and Blue-Ray Disc.
w
w

Evaluation

1. Expand the following


1. ROM
2. RAM
3. PROM
4. EPROM
5. EEPROM

XII Std Computer Science 4

12th Computer science_RCM_EM_Without day.indd 4 8/14/2021 12:39:54 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

Windows Operating
3 System
Learning Outcome
After learning the concepts in this topic , the students will be able
™™ To know the concepts of operating system and its types.
™™ To know the elements of the windows Desktop.

in
Teacher Activity 1

s.
Introduction of Operating System:
¾¾ It is a System software.

s
¾¾ It enables the hardware to communicate and operate with other software.

the computer.
p re
¾¾ I t acts as an interface between the user and the hardware and controls the overall execution of
ex
vi
al
.k
w
w
w

Types of Operating System:


Single user Operating System:
An Operating System allows only a single user to perform a task at a time.
Example: MS-DOS.
Multi user Operating System:
It allows same data and applications to be accessed by multiple users at the same time.
Example: WINDOWS, LINUX.

5 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 5 8/14/2021 12:39:54 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

Teacher Activity 2

Windows Operating System:


¾¾ Windows operating system is one of the most popular Graphical User Interface.
¾¾ Multiple applications executed simultaneously in windows is known as multitasking.

Windows Desktop:
The opening screen of windows is called “Desktop”.

in
s s.
p re
ex

Elements of Desktop:
Start button, Icons, Taskbar, Notification area and Date and Time.
vi

Icons:
al

¾¾ It is a graphic symbol representing the window element.


¾¾ They are classified as Standard Icons,Shortcut Icons, Disk drive Icons (C, D,E).
.k

Student Activity
w
w

1. The teacher asks the students to pair up with a partner and to list out the elements of windows
desktop.
w

Evaluation

1. Define Operating System and its types.


2. Identify the type of icons in the following.
1. My Computer
2. Local Disk(D)
3. MS_Paint

XII Std Computer Science 6

12th Computer science_RCM_EM_Without day.indd 6 8/14/2021 12:39:54 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

4 Windows Operating
System
Learning Outcome
After learning the concepts in this topic , the students will be able
™™ To understand the different Elements of a window
™™ To manage the files and folders

in
Teacher Activity 1
Introduction

s.
The teacher brings a laptop to the class and opens the window screen and asks the students what

s
they are seeing. The teacher introduces the topic and explains it
Explain the Elements Of the Window.
1. Title bar:
p re
The title bar displays the name of the application. It also contain minimize, maximize and close
ex
button.
2. Menu bar:
vi

The menu bar contain the different types of menus like file, edit ,help etc.
3. The workspace:
al

The workspace is the area in the document window to enter or type the text of your document.
.k

4. Scroll bar:
The scroll bars are used to scroll the workspace horizontally or vertically.
w

5. Corners and borders:


w

 e corners and borders of the window helps to drag and resize the windows. The mouse pointer
Th
changes to a double headed arrow when positioned over a border or a corner.
w

Teacher Activity 2
Files and folders
The teacher asks the students how they will save or store data or information in the windows. The
teacher explains the importance of files and folders through demonstration method.
1. Files:
The data or information are stored in windows as files. Each file has its own name. The extension
name followed by the name of the file indicates the application in which it is created.
Creating files
Wordpad is an inbuilt word processor in windows to create and manipulate text documents.

7 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 7 8/14/2021 12:39:54 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

Step 1:  click start  all programs  accessories  wordpad


Step 2:  Type the contents in the workspace and save the file using File  Save or Ctrl+s
Step 3:  Save As dialog box opens, type the name of the file and click save button.
2. Folders:
The group or collection of files is stored in folders. Folders also got its own name. There are two
different ways in which a folder can be created.

Method-1.
Step 1:  open computer icon and open a drive in which you want to create a new folder.
Step 2:  Click on File  New  Folder
Step 3:  A new folder is created with the default name “New folder”
Step 4:  Type the Folder Name and Press Enter Key

in
Method -2.

s.
Step 1:  In the desktop, right Click New Folder
Step 2:  A folder appears with the default name “New folder”

s
Step 3:  Type the Folder Name and Press Enter Key

Finding files and folders


p re
We can use the search box on the start menu to quickly search a particular folder or file in the
ex
computer or in a specific drive.

To find a file or folder


vi

Step 1:  Click the start button, the search box appears at the bottom of the start menu
al

Step 2:  Type the name of the file or the folder you want to search
Step 3 The files or folders with the specified names will appear, if you click that file it will directly
.k

open the file or folder.


w

Student Activity
w

1. The teacher divides the students into groups and asks each group to present various elements of
w

windows through concept map.

Evaluation

1. Create a folder in desktop with your name


2. 
Create a WordPad file named as address and type your name, class, Age, contact no and save it
under your folder.

XII Std Computer Science 8

12th Computer science_RCM_EM_Without day.indd 8 8/14/2021 12:39:54 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

5 FLOW CHART

Learning Outcome
After learning the concepts in this topic , the students will be able
™™ To Understand the purpose of using flow charts
™™ To Know the Flow chart symbols
™™ To Know the Advantages and disadvantages of using flow charts

in
Teacher Activity 1

s.
Introduction

s
Before starting the topic the teacher asks the students about the traffic sign. what do

re
you understand on seeing the traffic signs?. Most of the traffic signs are represented in
the form of pictures. So the purpose of representing traffic signs in the diagrammatic
way is to understand the meaning for everyone despite of languages. Teacher draws
p
an image on the board and asks the students to identify the name of the symbol.
ex
The student answers it is a school nearby.
vi

Teacher Activity 2
al

The teacher gives explanation of flowchart by drawing its symbols on the board
¾¾ A flow chart is a diagrammatic representation of an algorithm
.k

¾¾ Flow charts are drawn by connecting the different symbols


¾¾ An algorithm is a step by step procedure to solve a problem written in any communication
w

language
w

¾¾ Since flow chart uses symbols to represent every step in algorithm, it is easy to understand by
everyone
w

¾¾ The important and basic symbols in flowchart is as follows

Symbol meaning
Start/end

Process

Input / output

Decision making

Arrows to connect

9 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 9 8/14/2021 12:39:54 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

Teacher Activity 3
Draw a flow chart to add two numbers

START

Input A,B

C= A+ B

Print C

in
END

s s.
Advantages of flow chart

¾¾ It is easy to understand
p re
¾¾ The flow charts are the better way of communicating the logic of a problem
ex
¾¾ It is very efficient and helps in debugging

Disadvantages of flow chart


vi

¾¾ It is very difficult to draw a flow chart for complex problems.


¾¾ Moreover it slows down the process of software development
al
.k

Student Activity
w

The students individually prepare a flowchart to find out the multiplication of any two numbers.
w

Evaluation
w

1. Identify the following flowchart symbols

a.

b.

c.

2. Draw a flow chart to find the greater among two numbers.


3. Draw and explain the flow chart symbol.

XII Std Computer Science 10

12th Computer science_RCM_EM_Without day.indd 10 8/14/2021 12:39:55 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

6 PSEUDO-CODE

Learning Outcome

After learning the concepts in this topic , the students will be able
¾¾ To know the way of writing a pseudo code
¾¾ To solve a problem using Pseudo Code

in
Teacher Activity 1

s.
Before entering into the topic, the teacher asks the students a common example. “How do you
prepare coffee?”. Each student says one step and teacher writes steps one by one on the board.

s
1. First take a bowl
2. Pour milk into the bowl
3. Switch on the gas stove and place it on the stove.
4. Let the milk boil
p re
ex
5. After that pour milk in a glass and add sugar and coffee powder.
So the teacher concludes that just to prepare a coffee we need atleast five steps. Similarly to solve a
problem in a computer we have to frame few steps.
vi

 n algorithm is a step by step sequence of statements intended to solve a problem. The planning
¾¾ A
to solve a problem is written in our own language.
al

¾¾ A
 fter planning a solution, we decide a programming language to be used and we use some of
.k

the keywords in that language along with the algorithm. Now it is called as a pseudo language.
A pseudo code is a step by step written outline of our code.
w

Teacher Activity 2
w

1. Teacher gives an example to write a pseudo code to find whether the given number is greater
w

than 100 or not


START
A > 100
   IF A > 100
    PRINT “the value is greater than 100”
  ELSE
    PRINT “the value is less than 100”
END
In the above example it uses both plain English and the programming language. An algorithm
expressed as pseudo code is not for computers to execute directly but for human readers to understand.

11 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 11 8/14/2021 12:39:55 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

Teacher Activity 3
Write a pseudo code and draw a flow chart to find smallest of two numbers

Pseudo code
START
  READ A, B
   IF A < B
    PRINT “A is smaller”
  ELSE
    PRINT “B is smaller”
END

in
Flow chart

s.
start

s
input A, B
p re
ex
Yes No
IF a < b
vi

A is small B is small
al
.k

END
w

Student Activity
w
w

1 The students individually prepare a pseudo code find out the division of any two numbers.

Evaluation

1. Say true or false


a. Algorithm is written in a computer language
b. Flow chart is the pictorial form of solution to a problem
c. Pseudo code is not used for computer execution.
2. Draw a flow chart and write a pseudo code to find the sum and average of any 5 numbers.

XII Std Computer Science 12

12th Computer science_RCM_EM_Without day.indd 12 8/14/2021 12:39:55 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

7 Introduction to C++

Learning Outcome
After completion of this topic, the student will be able to
™™ Know the History of C++
™™ Understand the Basic Building blocks of C++

in
™™ Know the Benefits of C++

Teacher Activity 1

s s.
History of C++ :

¾¾ It was referred “New C” and “C with Classes”.


p re
¾¾ C++ was developed by Bjarne Stroustrup at AT & T Bell laboratory during 1979.
ex
¾¾ The name was changed as C++ by Rick Mascitti.

¾¾ C++ is called a Hybrid Language.


vi

¾¾ It is a programming language which supports both procedural and Object Oriented
al

Programming (OOP) paradigms.

Benefits of C++ :
.k

¾¾ C++ is a simple language .


w

¾¾ It is often the language of choice for multi-device, multi-platform and app development.
w

¾¾ C++ allows function overloading.


w

¾¾ It is a powerful , efficient and fast language.

Teacher Activity 2

Basic Building Blocks of C++ (Tokens) :


C++ program statements are constructed by different small elements such as commands,
variables, constants and many more symbols called operators and punctuators. These individual
elements are collectively called as Lexical units (or) lexical elements or Tokens

C++ has the following Tokens :


ÂÂ Keywords  - Reserved words which convey specific meaning to C++ compiler.

13 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 13 8/14/2021 12:39:55 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

C++ Keywords :
asm double new switch
auto else operator template
break enum private this
case extern protected throw
catch float public try
char for register typedef
class friend return union
const goto short unsigned
continue if signed virtual

in
default inline sizeof void
delete int static volatile

s.
do long struct while

s
ÂÂ I dentifiers  User-defined names given to different parts of the program.
Eg- Num, _ add, total_sales
re
ÂÂ Literals(Constants)  – Data items whose value do not change during the execution of the
p
program. The Kinds of literals are Integer, Float, Real, Boolean, Character and String.
ex

ÂÂ Operators  - The Symbols which are used to do some mathematical or logical operations.
ÂÂ Punctuators  - The symbols which are used as delimiters while constructing a C++ Program.
vi
al

Student Activity
.k

1. The students are asked to work in groups to trace out whether the given identifiers are valid or
invalid and to share their reasons to the class.
w

i) Num
w

ii) NUM
iii) this
w

iv) 2myfile
v) total-sales

Evaluation

1. Identify the following literals and match the following


a) int constant - “Apple”
b) string literal - 26.8
c) Floating point constant - 850

XII Std Computer Science 14

12th Computer science_RCM_EM_Without day.indd 14 8/14/2021 12:39:55 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

8 OPERATORS

Learning Outcome
After completion of this topic, the students will be able to
™™ Know about Operators and different types of Operators.
™™ Understand mathematical or logical operators.

in
Teacher Activity 1

s.
Operators :
ÂÂ Operators  – Symbols used to do some mathematical or logical operations.

s
ÂÂ Operands  – Operators which acts upon the data item or values.

Arithmetic Operators :
p re
¾¾ Performs simple arithmetic operations like addition, subtraction, multiplication, division etc.
ex

Operator Operation Example


+ Addition 5+5=10
vi

- Subtraction 5-5=0
al

* Multiplication 5*5=25
.k

/ Division 10/5=2
w

% Modulus 10%3=1
w

Relational Operators :
w

¾¾ Used to determine the relationship between its operands.

Operator Operation Example


> Greater than 10>5
< Less than 6<10
>= Greater than or equal to 10>=5
<= Less than or equal to 6<=10
== Equal to 5==5
!= Not equal 10!=5

15 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 15 8/14/2021 12:39:55 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

Logical operators :
¾¾ Used to evaluate logical and relational expressions.

Operator Operation Description

The logical AND combines two different relational expressions in to


&& AND one. It returns 1 (True), if both expression are true, otherwise it returns
0 (false).

The logical OR combines two different relational expressions in to one.


II OR It returns 1 (True), if either one of the expression is true. It returns 0
(false), if both the expressions are false

in
NOT works on a single expression / operand. It simply negates or

s.
! NOT inverts the truth value. i.e., if an operand / expression is 1 (true) then
this operator returns 0 (false) and vice versa

s
Assignment Operator :
re
¾¾ Used to assign a value to a variable which is on the left hand side of an assignment statement
p
ex

Operator Operation Example


vi

= Assignment a = 10
al

+= Addition assignment a = 10; c = a += 5; c=15


.k

-= Subtraction assignment a = 10; c = a -=5; c=5


w

*= Multiplication assignment a = 10; c = a *=5 c=50


w

/= Division assignment a = 10; c = a /=5 c=2


w

%= Modulus assignment a = 10; c = a %=5 c=0

Conditional Operator :
¾¾ Th
 is operator is used as an alternate to if ….else control statement. It is also known as Ternary
Operator.

¾¾ ?: is a Conditional operator.

XII Std Computer Science 16

12th Computer science_RCM_EM_Without day.indd 16 8/14/2021 12:39:55 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

Teacher Activity 2

Other Operators :
¾¾ (,) Comma operator – Used to string together several expression.

¾¾ Sizeof - Returns size of a variable in bytes.

¾¾ * Pointer to a variable

¾¾ &- Address of variable

Input/Output Operator :

in
¾¾ >> - Input Operator  Eg: cin>>num;

¾¾ << - Output operator  Eg cout<<x<<y;

s s.
Student Activity

Mind Map.
p re
1. The teacher uses some arithmetic operators and asks the students to state their various uses through
ex

2. The students prepare a flowchart for the ternary operator and explain that to the class.
vi
al

Evaluation
.k

1. Write an expression involving a logical operator to test, if marks are 90 and grade is ‘A’.
w

2. Give that i=8, j=10, k=8 What will be the result of the following expression?
w

(i) i<k (ii) i<j (iii) i==j (iv) j!=k


w

17 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 17 8/14/2021 12:39:55 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

9 Sample C++ Program


and Execution
Learning Outcome
After completion of this topic, the students will be able to
™™ Create Source code
™™ Save Source code
™™ Execute Source code

in
Teacher Activity 1

s.
Introduction:
Lets start with a very simple program which makes students easily understand about C++ coding,

s
and then we shall look at the basic Elements one by one that every C++ program has.
Create a new source code :

//C++ program to print a string


p re
To create a new source file open Dev C++ and Select File New  Source file or Ctrl+N
ex
#include<iostream>
using namespace std;
int main()
vi

{
cout<<”Welcome to School”;
al

return 0;
}
.k

¾¾ Here //C++program to print a string line is a comment line. Any line beginning with // is a
w

comment line.
¾¾ #include<iostream> tells the compiler’s pre-processor to include the header file in the program.
w

¾¾ using namespace std tells the compiler to use standard namespace.


¾¾ int main() denotes that the executable statements should be inside the main() function.
w

Saving source code with extension .cpp


¾¾ After typing the source code should be saved with the extension .cpp. File  Save (or) Ctrl + S
Compilation and Execution of C++ program :
 ompilation – Execute  Compile and Run or press F11 key. If any error is found it will
¾¾ C
throw error message. If there are no errors, it translates the source code into machine readable
object file with an extension .obj
¾¾ After successful compilation output will appear in output console.
¾¾ And now let’s see the output of the program.
Welcome to School

XII Std Computer Science 18

12th Computer science_RCM_EM_Without day.indd 18 8/14/2021 12:39:55 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

Teacher Activity 2
Ask students to create a simple program using the above steps and their first C++ program is below
with an output “Hello World !”.
// My first C++ Program
#include<iostream>
using namespace std ; Output:
int main() Hello World !
{
cout<<”Hello World !”;
return 0;
}
After the execution of programs students understand about the types of errors that occurs during
compilation.

in
ÂÂ Syntax Error  – Set of Grammatical rules to construct a Program.
ÂÂ Semantic Error  – Wrong use of variables, operators, order of execution etc.

s.
ÂÂ Run-Time Error  – Some illegal operations that takes place.

s
For Example

shows an Syntax Error


#include<iostream>
p re
The same program we have learnt above suppose doesn’t have an semicolon in the second line it

using namespace std The error has to be corrected by


ex

int main() inserting a ; (Semicolon) in the end


{ of second line so that we can get the
vi

cout<<”Hello World !” Output.


return 0;
}
al

Student Activity
.k
w

1. The teacher facilitates the students during the execution of the task and also guides them to cor-
rect the errors that occur during execution.
w
w

Evaluation

1. Write a C++ program that prints a string “Stay Home Stay Safe!”
2. Write a C++ program to find the total marks of three subjects.
3. Point out the type of error.
# include<iostream>
using namespace std;
int main()
{
int l=10; b=12;
cout<<”Area of rectangle”<< l*b;
}

19 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 19 8/14/2021 12:39:55 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

DATA TYPES,
10 VARIABLES
Learning Outcome

After completion of this topic, the students will be able to


™™ Know the concepts of data types and variables
™™ Know the categories of data types

in
™™ Understand the need for variable declaration

Teacher Activity 1

s s.
Data Types and variables
p re
Every programming language has two fundamental elements data types and variables. They are
very essential elements to write programs. C++ provides a predefined set of data types for handling the
data items. Such data types are known as fundamental or built-in data types. Apart from the built-in
data types, a programmer can also create their own data types called as User-defined data types.
ex

Example:
Name = Ram
vi

Age = 15
al

Average_mark = 85.6
Here Name, Age and Average mark are called fields, Ram, 15 and 85.6 are values. Fields are referred
.k

as variable and the values are referred to as data.


w

Data kinds of Data


w

Ram Sequence of characters


15 integer
w

85.6 floating point number

Teacher Activity 2

C++ Data types:


There are three categories of data types:
1. Fundamental or Built-in datatypes:
Predefined data type in C++. It uses 5 keywords int, char, float, double and void to denote 5
fundamental or built-in data types in C++.

XII Std Computer Science 20

12th Computer science_RCM_EM_Without day.indd 20 8/14/2021 12:39:55 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

int data type  accepts only integer number. It may or may not be signed. it uses the keyword ‘int’.
int num = 12;
cout<<num; Output : 12
char data type  accepts only characters. It store either a character or an integer value. It uses the
keyword ‘char’
char ch =‘A’;
cout<<ch: Output : A

int n;
char ch =‘d’;
n=ch;
cout <<n; Output : 100

in
float data type  accepts only floating point values. . It uses the keyword ‘float’
float a,b;

s.
a=12.5;

s
b=5;
cout << a+b; Output : 17.5
re
double data type  also accepts double precision floating point numbers. It is also used for handling
p
floating point numbers. It uses the keyword ‘double’
ex
void data type  is a special data type, it stores nothing. It does not return any value.

Memory Representation:
vi

Important reason for declaring a variable as a particular data type is to allocate appropriate space
in memory. Depending on the compiler (Turbo C++, dev C++) the memory size differs.
al

char - 1 byte
.k

int - 4 bytes
w

float - 4 bytes
double - 8 bytes
w

2. User defined datatype:


w

Programmers can define their own data types called user defined data types.
Example:  structure, union, class, enumeration

3. Derived data type:


Data types derived from fundamental data types are called derived data types.
Example:  Array, Function, Pointers

Declaration of variables:
Every variable should be declared before they are used in a program. Declaration is a process to
instruct the compiler to allocate memory as per the data type specified along with the variable name.

21 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 21 8/14/2021 12:39:55 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

Syntax :
<datatype><var 1>,<var 2>,<var 3>....<var n>;
Example
int a,b;
Here the compiler allocates 4 bytes of memory for each variable.

Student Activity
1. The students pair up and identify the variables used in the given program. Each group share their
data type to the class.
#include<iostream>
using namespace std;

in
int main()

s.
{
float a,c;

s
int b;
cout<<”Enter values”;
cin>>a>>b;
p re
c=a+b;
ex

cout <<“\n The sum =”<<c;


}
vi

Output :
al

Enter values 5.5 2


.k

The sum = 7.5


w

2. The teacher divides the class into two groups as A & B and group A writes a C++ program to find
the area of a circle using radius as integer data type and the other group ‘B’ in the radius as float
w

data type.
w

Evaluation

1. Which one is the valid data type in C++ ?


a) Char b) Int c) double d) Void
2. Which one is the valid value for char datatype in C++?
a) 5 b) ‘5’ c) H d) h

XII Std Computer Science 22

12th Computer science_RCM_EM_Without day.indd 22 8/14/2021 12:39:56 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

11 Selection Statements -
if,if..else

Learning Outcome

After completion of this topic, the students will be able to


™™ Understand the different kinds of selection statements.
™™ Construct different flow of control statements in C++

in
œœ To understand ‘if ’ statement

s.
œœ To know ‘if-else’ statement.

s
Teacher Activity 1

Introduction:
p re
Generally, a program executes its statements sequentially from beginning to end. However, in
ex
some situations, the flow of control jumps from one part of the code to another segment of code. Such
jumps are called “control flow”. Here we are going to study about the basic control structure “Selection”.
vi

Statements:
A computer program is a set of statements or instructions to perform a specific task.
al

Control statements:
.k

Control statements are statements that alter the sequence of flow of instructions.
w

Teacher Activity 2
w
w

The teacher explains the syntax and program of ‘if ’ statement.

‘if ‘statement:
The ‘if ’ statement evaluates a condition, if the condition is true then a true-block is executed, oth-
erwise the true-block is skipped.

General syntax of the ‘if ’ statement:


if (expression)
true-block;
Statement-x;

23 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 23 8/14/2021 12:39:56 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

Here if the expression is true then the true block is executed and followed by statement-x are also
executed, otherwise the control passes to statement-x.

Program:
C++ program to check whether a person is eligible to vote using if statement.
#include <iostream>
using namespace std;
int main ()
{ Output:
int age; Enter your age: 23
You are eligible for voting
cout<<’’\n Enter your age:’’; This statement is always executed.

in
cin>>age;

s.
if (age>=18)

s
cout<<”\n You are eligible for voting”;

return 0;
}
cout<<’’This statement is always executed.”;
p re
ex

Teacher Activity 3
vi

The teacher explains the syntax and program of if -else statement.


al

‘if –else’ statement:


Syntax:
.k

if (expression)
w

{
w

True –block;
w

}
else
{
False-block;
}
Statement x;
In ’if – else’ statement, if the result is true then the statements inside true-block is executed and
false block is skipped. If the result is false, then the statement inside false-block is executed and the
true block is skipped.

XII Std Computer Science 24

12th Computer science_RCM_EM_Without day.indd 24 8/14/2021 12:39:56 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

Program:
Write a C++ program to find whether the given number is odd or even
# include <iostream>
using namespace std;
int main ()
{
int num,rem;
cout<<’’\n Enter number:’’;
cin>>num;
rem=num%2;

in
if (rem==0)

s.
cout<<’’\n The given number”<<num<<”is even”;

s
else

return 0; re
cout<<”\n The given number “<<num<<”is odd”;
p
}
ex

Output:
vi

Enter number: 10
The given number 10 is even
al
.k

Student Activity
w
w

1 The teacher splits the class into groups and ask to write a program to get computer science mark of
a student and check whether the student is pass or fail. (mark>=35 pass, otherwise fail).
w

Evaluation

1. Write a C++ program to find whether the given person is a Senior Citizen or not.
2. Write a C++ program to check whether the given number is divisible by 10 or not.

25 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 25 8/14/2021 12:39:56 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

12 Selecton Statements -
Nested if. Else
Learning Outcome

After completion of this topic, the students will be able


™™ To understand Nested if statement
™™ To know if-else-if ladder
™™ To write programs using all selection statements

in
Teacher Activity 1

s.
Introduction

s
The teacher motivates the students to ask previous topic questions.

Nested if:
p re
An ‘if ’ statement which contains another if statement is called nested if. There are three types.
ex
1. If nested inside if part
2. If nested inside else part
vi

3. If nested inside both if part and else part

Teacher Activity 2
al
.k

The teacher explains the different syntax and examples of nested if statement.
The syntax of the nested if:
w

1.  If nested inside if part 2.  If nested inside else part


w

if (expression-1) if (expression-1)
{ {
w

if (expression-2) Body of True Part;


{ }
True_Part_Statements; else
} }
else if (expression-2)
{ {
False_Part_Statements; True_Part_Statements;
} }
} else
else {
Body of the else part; False_Part_Statements;
}
}

XII Std Computer Science 26

12th Computer science_RCM_EM_Without day.indd 26 8/14/2021 12:39:56 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

3.  If nested inside both if part and else part


if (expression-1)
{
if (expression-2)
{
True_Part_Statements;
}
else
{
False_Part_Statements;
}

in
}
else

s.
{
if (expression-2)

s
{
True_Part_Statements;
}
p re
else
ex

{
False_Part_Statements;
vi

}
al

Program:
.k

C++ program to calculate commission according to sales using nested if statement.


w

Sales Commission
w

>5000 10%
Otherwise 5%
w

#include <iostream>
using namespace std;
int main()
{
int sales, commission;
cout<< “\n Enter Sales amount:”;
cin>> sales;
if (sales>5000)

27 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 27 8/14/2021 12:39:56 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

{
commission= sales * 0.10;
}
else
{
Output:
commission= sales * 0.05;
Enter Sales amount: 6000
}
Commission: 600
cout<<”\n Commission:”<<commission;
return 0;
}

in
Teacher Activity 3

s.
The teacher explains the different syntax and examples of if-else-if ladder statement.

s
if-else-if ladder

re
The if-else-if ladder is a multi-path decision making statement. In this type of statement ‘if ’ is
followed by one or more ‘else if ’ statements and finally end with an else statement.
p
The syntax of if-else ladder:
ex

if (expression 1)
vi

{
Statement-1
al

}
else
.k

if (expression 2)
When the respective expression
w

{ becomes true, the statement associated


Statement – 2 with block is executed, and the rest of
w

} the ladder is bypassed. If none of the


conditions is true, then the final else
w

else statement will be executed.


if (expression 3)
{
Statement- 3
}
else
{
Statement- 4
}

XII Std Computer Science 28

12th Computer science_RCM_EM_Without day.indd 28 8/14/2021 12:39:56 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

Program:
C++ program to find your grade using if-else ladder
#include <iostream>
using namespace std;
int main()
{
int mark;
cout<< “\n Enter your Mark:”; Output:
cin>> mark; Enter your Mark: 60
if (mark >= 60) Your grade is 1st class !!
cout<< “Your grade is 1 class !!”;st

else if (mark >= 50)

in
cout<< “Your grade is 2nd class !!”;
else if (mark >=40)

s.
cout<<”Your grade is 3rd class !!”;

s
else
cout<<”You are Fail !!”<<endl;

}
return 0;
p re
ex

Student Activity
vi

1. The teacher splits the class into groups and ask each group to share their ideas and thoughts to
prepare a C++ program to find the biggest of three numbers
al
.k

Evaluation
w

1. Write a C++ program to calculate the income tax for the given annual income using the following
w

data.
w

Annual Income Income Tax


< 500000 0
500000 to 1000000 10%
>1000000 20%

2. Write a C++ program to find the given number is positive, negative or zero.

29 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 29 8/14/2021 12:39:56 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

13 Iteration statements -
For loop
Learning Outcome

After learning this topic, the students will be able to


™™ Know the concept of iteration statements in C++.
™™ Construct simple C++ program using ‘for’ statement

in
Teacher Activity 1

s.
Introduction

s
re
Selection statements and iteration statements are executed depending upon the conditional
expression. The conditional expression evaluates to either true or false. Here we are going to study
about for loop.
p
ex
Iteration
An iteration (or looping) is a sequence of one or more statements that are repeatedly executed
vi

until a condition is satisfied. These statements are also called as control flow statements.

Uses of Iteration statements:


al

¾¾ It reduces the length of code.


.k

¾¾ Reduces time
w

¾¾ It executes the program and takes less memory space.


w

Types of Iteration statements:


¾¾ for statement
w

¾¾ while statement
¾¾ do-while statement
All looping statements repeat a set of statements as long as a specified condition remains true. The
specified condition is referred as a loop control. For all three loop statements, a true condition is any
nonzero value and a zero value shows a false condition.

‘for ‘ loop
The for loop is a entry- controlled loop (first the test-expression is evaluated and if it is nonzero,
the body of the loop is executed otherwise the loop is terminated). and is the easiest looping statement
which allows code to be executed repeatedly.

XII Std Computer Science 30

12th Computer science_RCM_EM_Without day.indd 30 8/14/2021 12:39:56 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

The general syntax is:


for (initialization(s); test-expression; update expression(s))
{
Statement 1;
Statement 2;
………….....
}
Statement-x;
The initialization part is used to initialize variables or declare variable which are executed only
once, then the control passes to test-expression. After evaluation of test-expression, if the result is
false, the control transferred to statement-x. If the result is true, the body of the for loop is executed,
next the control is transferred to update expression.

in
Program -1

s.
C++ program to display numbers from 1 to 5 using for loop

s
#include <iostream>


{
using namespace std;
int main ()
p re Output:
1
ex
int i;
2
for(i = 1; i<=5; i ++ )
3
vi

cout <<i<<endl;
4
return 0;
5
al

}
.k

Program -2
C++ program to sum the numbers from 1 to 10 using for loop
w

#include <iostream>
w

using namespace std;


w

int main ()
{
int i,sum=0;
for(i=1; i<=10;i++)
{
sum=sum+i; Output:
} The sum of 1 to 10 is : 55
cout<<”The sum of 1 to 10 is : “<<sum;
return 0;
}

31 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 31 8/14/2021 12:39:56 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

Student Activity

1. The teacher asks the students to write a C++ program to display numbers from 10 to 1 using for
loop.

Evaluation

1. Write a C++ Program to print your name 5 times .


2. Answer the following questions based on the Program given below.
#include <iostream>

in
using namespace std;
int main()

s.
{

s
int i,fact = 1;

{
for(i = 1; i < 6; i++)
p re
ex
fact *= i;
}
vi

cout << “Factorial of “<<i<<” is : “<<fact;


}
al

1. Identify the Control variable used .


.k

2. Identify the test expression


w

3. H
 ow many times the loop will be executed ?
w

4. What is the output of the program?


5. What type of loop is this ?
w

XII Std Computer Science 32

12th Computer science_RCM_EM_Without day.indd 32 8/14/2021 12:39:56 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

14 while and do-while


Loops
Learning Outcome
After learning this topic, the students will be able to
™™ Know the concept of while and .do-while loops.
™™ Construct simple C++ program using ‘while’ and ‘do-while’ loops .

Teacher Activity 1

in
Introduction

s.
Looping statements repeat a set of statements as long as a specified condition remains true. In

s
C++, any non zero is treated as true including negative numbers and zero is treated as false . Here we
are going to study about the iteration or Looping statements while and do-while.

While loop
p re
A while loop is a control flow statement that allows the loop statements to be executed as long
ex
as the condition is true. The while loop is an entry-controlled loop because the test-expression is
evaluated before entering into a loop.

The general syntax is:


vi

while (Test expression)


al

{
Body of the loop;
.k

}
Statement-x;
w

In while loop, the test expression is evaluated and if the test expression result is true, then the body
of the loop is executed and again the control is transferred to the while loop. When the test expression
w

result is false the control is transferred to statement-x.

Program
w

C++ program to find sum and average of 1 to 5 numbers using while loop
#include <iostream>
using namespace std;
int main ()
Output:
{
int i=1,avg,sum=0; The sum is : 15
while(i<=5) The average is : 3
{
sum=sum+i ;
i++;
}

33 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 33 8/14/2021 12:39:56 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

avg=sum/5;
cout<<”The sum is : “<<sum<<endl;
cout<<”The average is :”<<avg;
return 0;
}

Teacher Activity 2
do-while loop
The do-while loop is an exit-controlled loop because the condition is evaluated at the bottom of
the loop after executing the body of the loop. This means that the body of the loop is executed at least
once, even when the condition evaluates false during the first iteration.
The general syntax is:
do

in
{
Body of the loop;

s.
} while(condition);
Program

s
C++ program to display number from 10 to 1 using do-while loop



{
#include <iostream>
using namespace std;
int main ()
p re
ex
int n = 10; Output:
do
{ 10 9 8 7 6 5 4 3 2 1
vi

cout<<n<<” “;
n--;
al

}while (n>0) ;
}
.k

Student Activity
w

1. The students are asked to write a C++ program to display numbers from 1 to 10 using while and do-
while loops.
w

2. Each student in the class is asked to write a C++ program to print their name 5 times using do-
while loop.
w

Evaluation
1. Write a C++ Program to find the sum of all numbers from 10 to 15 using while loop.
2. What will be the output of the following code:
int i = 5,total = 0;
do
{
total += i;
i++;
}while (i <= 10);
cout << total;

XII Std Computer Science 34

12th Computer science_RCM_EM_Without day.indd 34 8/14/2021 12:39:56 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

15 Jump statements

Learning Outcome

After learning this topic, the students will be able to


™™ Know the concept of jump statements in C++.
™™ Construct simple C++ program using jump statements.

in
Teacher Activity 1

s.
Introduction

s
re
Generally a program executes its statements sequentially from beginning to end. However, in some
situations, the flow of control jumps from one part of the code to another segment of code. Such jumps
are called “control flow”. Here we are going to study about various jump statements.
p
Jump statements
ex

Jump statements are used to interrupt the normal flow of program.


vi

Types of Jump Statements


al

¾¾ goto statement
¾¾ break statement
.k

¾¾ continue statement
w

goto statement
w

The goto statement is a control statement which is used to transfer the control from one place to
another place without any condition in a program.
w

The general syntax is:


goto label;
--------------
--------------
label:

In the syntax above, label is an identifier. When goto label is encountered, the control of program
jumps to label: and executes the code below it.

35 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 35 8/14/2021 12:39:56 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

Program
C++ program to display the first five odd numbers using goto statement
# include <iostream>
using namespace std;
int main()
{
int n=1;
jump:
{
if(n<10)

in
{

s.
cout<<n<<’\t’;

s
n+=2; Output:
goto jump;
}
p re 1 3 5 7 9

return 0;
ex

}
vi

}
al

Teacher Activity 2
.k

break statement
w

A break statement is a jump statement which terminates the execution of loop and the control is
transferred to resume normal execution after the body of the loop .
w

Program
w

C++ program to count N numbers using break statement


#include <iostream>
using namespace std;
int main ()
{
for(int i=1; i<10;i++)
{
cout<< “Count : “ <<i <<’\t’;

XII Std Computer Science 36

12th Computer science_RCM_EM_Without day.indd 36 8/14/2021 12:39:56 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

if( i > 3)
{ Output:
break; Count : 1 Count : 2 Count :3 Count : 4

}}
return 0; }

continue statement
In is very similar to tha break statement Instead of terminating the loop (break statement),
continue statement forces the loop to continue or execute the next iteration.

Program
C++ program to display numbers from 1 to 10 except 6 using continue statement

in
#include <iostream>

s.
using namespace std;
int main()

s
{

{
for (int i = 1; i<= 10; i++)
p re
ex
if (i == 6)
Output:
continue;
1 2 3 4 5 7 8 9 10
vi

else
al

cout<<i<< “ “;
} }
.k

Student Activity
w

1. The teacher asks the students to write a C++ program to display odd numbers from 49 to 19 except
w

25 using continue statement.


w

Evaluation

1. What are the difference between break and continue statements.


2. Write a C++ Program to print first 10 even numbers using goto statement.

37 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 37 8/14/2021 12:39:56 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

16 Functions

Learning Outcome

After learning this topic, the student will be able to


™™ Know the definition of functions.
™™ Understand the uses of functions.

in
™™ Understand the types of functions.

Teacher Activity 1

s s.
Introduction:

Example:
p re
The Teacher motivates the students by asking about daily life problems like functions of the bank.

In a bank, we have many functions like opening an account, closing the account. accepting deposit,
ex
granting loans, credit cash and so on.
A large program can be split into small sub-programs (blocks) called as functions where each sub-
program can perform some specific functionality. Functions reduce the size and complexity of a program.
vi

It makes easier to understand, test and check for errors. The functions which are available by default is
known as “Built in” function and user can create their own functions known as “User-defined” function.
al

Teacher Activity 2
.k

The Teacher explains the need for the function.


w

Need for function:


w

To reduce size and complexity of a program.


w

1.  Divide and conquer


¾¾ Complicated programs can be divided into manageable sub programs called function.
¾¾ A programmer can focus on developing, debugging and testing individual functions.
¾¾ Many programmers can work on different functions simultaneously.

Example:  In a bank, there are few following functions


OpenAccount()
CloseAccount()
AcceptDeposit()
CreditCash()
GrantLoans()

XII Std Computer Science 38

12th Computer science_RCM_EM_Without day.indd 38 8/14/2021 12:39:57 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

2. Reusability:
¾¾ F
 ew lines of code may be repeatedly used in different context. Duplication of the same code
can be eliminated by using functions which improves the maintenance and reduce the program
size.
¾¾ Some functions can be called multiple times with different inputs.

Example:  To calculate the value of ncr = (n!) / ((n-r)! *r!)


To calculate n factorial, r factorial and n-r factorial of the above formula.
Here we write a code one time then we call the same code three times with inputs n, r and n-r .

Teacher Activity 3

The Teacher explains the types of function.

in
Types of functions:

s.
Function can be classified into two types.
1. Pre-defined or Built-in or Library functions.

s
 
2. User defined functions.

re
C++ provides a rich collection of function ready to be used for various tasks. The tasks are
p
already written, debugged and compiled, their definitions alone are grouped and stored in files called
header files. Such ready to use sub programs called pre-defined or built-in functions.
ex

C++ also provides the facility to create new functions for specific need as per user requirement.
The name of the task and data required (arguments) are decided by the user and hence they are known
vi

as User-defined functions.
al

Student Activity
.k

1. The teacher asks the students to write the functions of school, hospital, medical shop etc.
w
w

Evaluation
w

1. Define function.
2. What are the types of functions?
3. What is built in function?

39 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 39 8/14/2021 12:39:57 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

17 C++ header files and


Built-in functions
Learning Outcome

At the end of the topic, the students will be able to


™™ Understand built-in functions.
™™ Apply mathematical functions for solving problems.

in
™™ Use string and character functions for the manipulation of string and character data.

s.
Teacher Activity 1

s
Motivation:
The Teacher asks questions to motivate the students.
1. What is function?
p re
ex
2. What are the types of function?
3. What is built in function?
vi

 Introduction:
The teacher introduces the lesson witha real time examples.
al

Header file provide function prototype and definitions for library functions. Data types and con-
.k

stants used with the library functions are also defined in them.

A header file can be identified by their file extension .h. It contains multiple built-in functions.
w

i) stdio.h – this header file defines the standard I/O predefined functions getchar( ), putchar( ),
w

gets( ), puts( ) and etc.


w

ii) ctype.h – this header file defines various operations on characters. The various ctype functions
are isalnum( ), isalpha( ), isdigits( ),islower( ), isupper( ), tolower( ), toupper( ) etc.

iii) string.h – has several common functions for dealing with strings stored in array of characters.
The various string functions are strcpy( ), strlen( ), strcmp( ), strcat( ), strupr(), strlwr( ) etc.

iv) math.h – has several mathematical functions like cos( ), sqrt( ), sin( ), pow( ) etc.

Teacher Activity 2
The teacher explains the usage of mathematical and Character functions.

XII Std Computer Science 40

12th Computer science_RCM_EM_Without day.indd 40 8/14/2021 12:39:57 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

Program 1:
C++ code to find the square root of the given number.
#include<iostream>
#include<math.h>
using namespace std;
int main( )
{
int n;
cout<<”Enter a number:”;
cin>>n;
cout<<sqrt(n);

in
return(0);
}

s.
Output:

s
Enter a number: 49

Program 2:
7 p re
ex
C++ code to check whether a given character is a digit or not.
#include<iostream>
vi

#include<ctype.h>
using namespace std;
al

int main( )
.k

{
char ch;
w

cout<<”Enter a character:”;
w

cin>>ch;
cout<<”The return value of isdigit(ch) is:”<<isdigit(ch);
w

Output 1:
Enter a character: 3
The return value of
isdigit(ch) is: 1
Output 2:
Enter a character: A
The return value of
isdigit(ch) is: 0

41 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 41 8/14/2021 12:39:57 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

Program 3:
C++ code to convert a lowercase string into its uppercase string.
#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
int main( )
Output:
{
Enter a string in lowercase: computer
char s[50];
The uppercase string is: COMPUTER
cout<<”Enter a string in lowercase:”;
gets(s);

in
cout<<”The uppercase string is:”<<strupr(s);

s.
return(0);
}

s
Student Activity p re
1. The students are divided into two groups and one group discusses the gets() function and the
ex
other group the pow() function.

2. The students in groups discuss and share their information with others on how to write a C++
vi

program to find the length of the string.


al

Evaluation
.k

1. What is the output of the following program?


w

#include<iostream>
w

#include<stdio.h>
#include<string.h>
w

using namespace std;


int main( )
{
char s[ ] = “COMPUTER”;
cout<<”The lowercase string is:”<<strlwr(s);
return(0);
}
2. What are the functions available in math.h?
3. Write a c++ program to find the value of x10 ?

XII Std Computer Science 42

12th Computer science_RCM_EM_Without day.indd 42 8/14/2021 12:39:57 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

18 User Defined
Functions
Learning Outcome
After completion of this topic, the students will be able to
™™ Implement modular programming for creating function.
™™ Understand the function definition and prototype.
™™ Understand return statement.

in
Teacher Activity 1
Motivation:

s.
The teacher asks questions from the previous topic.

s
Introduction:

re
We can define new functions to perform a specific task. These are called as “user defined” functions.
They are created by the user. A function can optionally define input parameters that enable callers to
p
pass arguments into the function. A function can also optionally return a value as output.
Function definition:
ex

In C++ a function must be defined before it is used anywhere in the program.


Syntax of function:
vi

Return_data_type function-name (parameter list)


{
al

Body of the function 


}
.k

Example:
int add (int a, int b)
w

{
int c;
w

c=a+b;
return(c);
w

Teacher Activity 2

Function Prototype:
A function prototype describes the function interface to the compiler by giving details such as
the number and the types of arguments and the types of return values. Like a variable declaration, a
function must be declared before it is used in the program. the declaration statement may be given
outside the main( ) function.
Example:
long fact ( int, double );

43 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 43 8/14/2021 12:39:57 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

The aboue function furction the fillowing infarmation to the campiter


(i) Return type – long
(ii) Name of the function- fact
(iii) Argument list – (int, double)

Teacher Activity 3
Accessing a Function:
The user - defined function should be called explicitly using its name and the required arguments
to be passed. The compiler refers to the function prototype to check whether the function has been called
correctly. If the argument type does not match exactly with the data type defined in the prototype, the
compiler will perform type conversion, if possible. If type conversion is impossible, it generates an error
message.
Example:
#include<iostream>

in
using namespace std;
int sum(int x, int y) // function prototype

s.
{
return (x+y);

s
}
int main( )
{


int a,b;
cout<<”enter a and b values:”;
cin>>a>>b;
p re
ex
cout<<”The sum is:”<<sum(a,b); // calling a function
}
vi

Teacher Activity 4
Return Statement:
al

The return statement is used to return from a function. It is categorized as a jump statement
because it terminates the execution of the function and transfer the control to the called statement.
.k

A return may or may not have a value associated with it. If return has a value associated with it, that
value becomes the return value for the calling statement. void function without parameter, the return
w

statement can also be used to terminate the function.


Syntax :
w

return expression/variable; 
Example
w

return (a+b):
return s;

Student Activity
1. The students are asked to draw a concept map for return statement.
2. The students in group discuss about the user defined functions.

Evaluation
1. What is user defined function?
2. How to access a function?
3. Write a C++ program to multiply two numbers using user defined functions.

XII Std Computer Science 44

12th Computer science_RCM_EM_Without day.indd 44 8/14/2021 12:39:57 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

19 Different forms of user


defined function declarations

Learning Outcome

After completion of this topic, the students will be able


™™ To know the different forms of user defined function declarations.

Teacher Activity 1

in
Motivation:

s.
The teacher asks the questions from the previous topic.

s
Introduction:

i) A function without return value and without parameter


p re
C++ program can contain any number of functions. The function declaration are in various forms.

ii) A function with return value and without parameter


ex

iii) A function without return value and with parameter


iv) A function with return value and with parameter
vi
al

Teacher Activity 2
.k

Teacher explains the different forms of user defined function declarations with example.
i). A function without return value and without parameter
w

The name of the function is display(), its return data type is void and it does not have any param-
w

eter.
#include <iostream>
w

using namespace std;


void display( )
{
int a,b,sum;
cout<<”Enter two numbers:”;
Output:
cin>>a>>b;
sum=a+b; Enter two numbers: 10 30
cout<<”The sum is:”<<sum; The sum is: 40
}

int main( )

45 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 45 8/14/2021 12:39:57 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

{
display( );
return(0);
}
ii) A function with return value and without parameter
The name of the function is display(), its return data type is int and it does not have any param-
eter.

#include <iostream>
using namespace std;
int display( )
{
int a,b,sum;

in
Output:
cout<<”Enter two numbers:”; Enter two numbers: 10 30

s.
cin>>a>>b; The sum is: 40

s
sum=a+b;

}

return sum;

int main( )
p re
ex

{
cout<<”The sum is:”<<display( );
vi

return(0);
al

}
.k

iii) A function without return value and with parameter


The name of the function is display(), its return data type is void and it has two parameters x and
w

y to receive two values.


w

#include <iostream>
w

using namespace std;


void display(int x, int y)
{
int sum=x+y;
cout<<”The sum is:”<<sum;
}
int main( )
{
int a,b;

XII Std Computer Science 46

12th Computer science_RCM_EM_Without day.indd 46 8/14/2021 12:39:57 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

cout<<”Enter two numbers:”;


cin>>a>>b; Output:
display(a,b); Enter two numbers: 10 30
return(0); The sum is: 40

}
iv) A function with return value and with parameter
The name of the function is display(), its return data type is int and it has two parameters x and y
to receive two values.

#include <iostream>
using namespace std;
int display(int x, int y)

in
{

s.
int sum=x+y;
return sum; Output:

s
} Enter two numbers: 10 30

{
int main( )
p re The sum is: 40
ex
int a,b;
cout<<”Enter two numbers:”;
vi

cin>>a>>b;
int sum=display(a,b);
al

cout<<”The sum is:”<<sum;


.k

return(0);
}
w

Student Activity
w
w

1. The teacher asks the students individually write a program to multiply two numbers using func-
tion with four different forms of user defined function declaration.

Evaluation

1. Write a program to calculate area of rectangle using different forms of user defined function
declarations?

47 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 47 8/14/2021 12:39:57 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

20 Recursive Function

Learning Outcomes

After completion of this topic, the students will be able


™™ To Understand recursive function.
™™ To construct simple C++programs using recursive function.

in
Teacher Activity 1

s.
Motivation:

s
The teacher motivates the students by asking questions of the previous topic

Introduction :
re
A function that calls itself is known as recursive function. And, this technique is known as recur-
sion.
p
ex

The teacher explains recursive function program for the students.

Program:
vi

Write a program to find the factorial of the given Number.


al

#include <iostream>  
using namespace std;  
.k

int factorial(int);  
int main()   
w

{  
int n,fact;  
w

cout<<”Enter a number to find factorial: “;  
w

cin >> n;  
fact=factorial(n);  
cout << “Factorial of “ << n <<” = “ << fact;  
return 0;  
}  
int factorial (int n)   
{  
if (n > 1)   
return n *factorial(n-1);      
else   
return 1;  
}

XII Std Computer Science 48

12th Computer science_RCM_EM_Without day.indd 48 8/14/2021 12:39:58 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

Output:
Enter a number to find factorial: 5
Factorial of 5 = 120

Teacher Activity 2

Program:
Write a program to find the sum of first ‘n’ natural numbers. 1+2+3+……..+n.
#include <iostream>  
using namespace std;  
int sum(int);  
int main()   

in
{  
int n,sum;  
cout<<”Enter a number: “;  

s.
cin >> n;  
sum=sum1(n);  

s
cout << “Sum of first “ << n <<” numbers = “ << sum;  




}  
return 0;  

int sum1 (int n)   
{  
p
Output:
re
ex
if (n > 1)    Enter a number : 10
return n+sum1(n-1);      
Sum of first 10 numbers = 55
else   
vi

return 1;  
}
al

Student Activity
.k

1. The students form groups and discuss about the execution of recursive function.
w
w

Evaluation
w

int hcf(int n1, int n2)


{
if(n2 != 0)
return hcf(n2,n1%n2);
else
return n1;
}
a. Write the name of the recursive function?
b. To find the recursive statement in the program?

49 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 49 8/14/2021 12:39:58 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

21 Scope Rules of
variables
Learning Outcomes
After completion of this topic, the students will be able
™™ To know the definition of scope.
™™ To understand the types of scope variables and functions in a program.

in
Teacher Activity 1
Introduction:

s.
Scope refers to the accessibility of a variable. There are four types of scopes in C++.They are Local

s
Scope, Function Scope, File Scope and Class Scope.

¾¾
p
Inside a block which is called local variables.
re
A scope is a region or life of the variable and broadly speaking there are three places, where
variables can be declared,

¾¾ Inside a function is called function variables.


ex

¾¾ Outside of all functions which is called global variables.


¾¾ Inside a class is called class variable or data members.
vi

Local Scope:
al

¾¾ A variable which is declared inside a block .A block of code begins and ends with only braces
{ }.
.k

¾¾ The scope of the local variable is the block in which it is defined.


w

¾¾ The local variables cannot be accessed from outside the block of its declaration.

Program
w

#include<iostream>
w

using namespace std;


int main()
{
int a=20,b=10;
if (a>b)
{
int s1; //Local variable//
s1=a+b;
cout<<”Local Variable=”<<s1;
}}

XII Std Computer Science 50

12th Computer science_RCM_EM_Without day.indd 50 8/14/2021 12:39:58 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

Teacher Activity 2

Function Scope:
¾¾ A Variable which is declared inside a function is called function variables.
¾¾ The life time of the function scope variable is the life time of the function block.

Program
#include<iostream>
using namespace std;
void add(int x,int y)
{
int s2=x+y; // Function variable //

in

cout<<”Function Variable=”<<s2;

s.
}
int main()

s
{

add(a,b);
int a=20,b=10;
p re
ex
return(0); }

Teacher Activity 2
vi
al

File Scope:
.k

¾¾ The variable which is declared outside of all functions is called file scope or global scope.
¾¾ The life time of a file scope is the life time of a program.
w

Program
w

#include<iostream>
w

using namespace std;


int s3=30; // File variable //
int main()
{
int a=20,b=10;
int sum=a+b+s3;
cout<<”sum=”<<sum;
}

51 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 51 8/14/2021 12:39:58 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

Class Scope
A class is a new way of creating and implementing a user defined data type. Classes provide a
method for packing together data of different types. Data members are the data variables that represent
the features or properties of a class.

Student Activity

1. The students in groups discuss about the reason for the invalidity of the underlined statement in
the following program.
#include<iostream>
using namespace std;
int main()
{

in
int a,b;

s.
cin>>a>>b;
if (a>=b)

s
{
int c;
c=a+b;
p re
ex
}
cout<<c;
vi

}
al
.k

Evaluation
w

1. Identify the scope of variables m1,m2,m3 in the following code.


w

#include<iostream> int main()


using namespace std; {
w

int m1; int m=24,n=10;


void sum(int x,int y) -------------------
{ if(m%2==0)
int m2; {
------ int m3;
} ---------- } }

XII Std Computer Science 52

12th Computer science_RCM_EM_Without day.indd 52 8/14/2021 12:39:58 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

22 Single Dimensional
Array
Learning Outcomes
After completion of this topic, the students will be able to
™™ Know the definition of arrays.
™™ Understand the Types of Arrays.
™™ Understand the memory allocation of single dimensional arrays.

in
™™ Understand how to access single dimensional array elements.

s.
Teacher Activity 1

s
Introduction:
re
A single variable is used to store a single value that can be used anywhere in the memory. In some
p
situations, we need to store multiple values of the same type. In that case, it needs multiple variables of
the same data type. All the values are stored randomly anywhere in the memory. For example, to store
ex

the roll numbers of the 100 students, it needs 100 variables named as roll1, roll2, roll3,……. roll100 .
It becomes very difficult to declare 100 variables and store all the roll numbers. In C++, the concept of
vi

Array helps to store multiple values in a single variable

Array
al

¾¾ An Array is a derived data type in C++.


.k

¾¾ An Array is a collection of variables of the same type that are referenced by a common name.
w

¾¾ I n array the values are stored in a fixed number of elements of the same type sequentially in
memory.
w

Types of Arrays
w

There are different types of arrays used in C++.They are


œœ One-dimensional Array
œœ Two-dimensional Array
œœ Multi-dimensional Array
One Dimensional Array
œœ This is the simplest form of an array.
œœ A one dimensional array represents values that are stored in a single row or in a single column.
œœ Each element has a unique index number starting from 0 which is known as subscript.

53 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 53 8/14/2021 12:39:58 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

Syntax:
<data type> <array_name> [<array_size>];
Example:
int num[10];
float sum[5];

Program
Write a C++ program to read the marks of 5 students and print the marks of all those students.
#include<iostream>
using namespace std;
int main()
{

in
int marks[5];

s.
cout<<”Read marks of 5 students”;
for(int i=0;i<5;i++)

s
cin>>marks[i];


cout<<”Print marks of 5 students\n”;
for(int i=0;i<5;i++)
p re
ex
cout<<marks[i]<<endl;
return 0;}
vi

Output
al

Read marks of 5 students Print marks of 5 students


50 50
.k

60 60
w

75 75
80 80
w

90 90
w

Teacher Activity 2

Memory representation of Arrays:


Example:
int num[5];
Memory representation of an array with five integer elements.
num[0] num[1] num[2] num[3] num[4]

                                             
1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021

XII Std Computer Science 54

12th Computer science_RCM_EM_Without day.indd 54 8/14/2021 12:39:58 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

Teacher Activity 3

Accessing array elements:


The elements of an array are accessed with the array name followed by the subscript index within
the square bracket.

Program:
Write a C++ program to access the 2nd and 5thelements of given array.
#include<iostream>
using namespace std;
int main()
{

in
int num[5]={10,20,30,40,50};
cout<<num[1]<<endl;

s.
cout<<num[4];
return 0;

s
}
Output:
20
p re
50
ex

Student Activity
vi

1. The students are divided into two groups and one group writes a C++ program to read the marks
al

of 10 students and the other group to print the marks of all those students .
2. The students are asked to access the first and last elements of the given array.
.k

int marks[5]={50,75,80,90,35}
w
w

Evaluation
w

1. What will be the output of the following program code.


#include<iostream>
using namespace std;
int main()
{
char vowel[ ]={‘A’, ‘E’, ‘I’, ‘O’, ‘U’};
cout<<vowel[0]<<endl;
cout<<vowel[3];
return 0;
}

55 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 55 8/14/2021 12:39:58 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

23 Two-Dimensional
Array
Learning Outcomes
After learning this topic the student will be able to
™™ Know the definition of Two-dimensional arrays.
™™ Understand the memory allocation of Two-dimensional arrays.
™™ Understand how to access Two-dimensional array elements.

in
Teacher Activity 1

s.
Introduction

s
A single variable is used to store a single value that can be used anywhere in the memory. In some

re
situations we need to store multiple values of the same type. In that case,it needs multiple variables of
the same data type.All the values are stored randomly anywhere in the memory.
p
For example, to store 5 subject marks of the 100 students, it needs 500 variables .It becomes very
ex
difficult to declare and store all the marks of students.In C++ the concept of 2D array helps to store
multiple values in a single variable.
Two-dimensional Array
vi

The 2D array is organized as matrices which can be represented as the collection of rows and col-
al

umns.
Syntax:
.k

data type array_name[row_size][Col-size];


Example:
w

int num[3][2];
Program
w

Write a C++ program to read the marks of 3 students in 2 subjects and print it in matrix form.
w

#include<iostream>
using namespace std;
int main()
{ int marks[3][2];
cout<<”Read the marks “;
for(int i=0;i<3;i++)
for(int j=0;j<2;j++)
cin>>marks[i][j];
cout<<”Matrix Form of marks\n”;
for(int i=0;i<3;i++)
{
for(int j=0;j<2;j++)

XII Std Computer Science 56

12th Computer science_RCM_EM_Without day.indd 56 8/14/2021 12:39:58 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

cout<<marks[i][j]<<” “;
cout<<”\n”;
}}

Output
Read the marks
50
20
75
80
89
78
Matrix Form of marks

in
50 20
75 80
89 78

s s.
Teacher Activity 2

Memory representation of 2D Arrays:


p re
ex

Example:
vi

num[0][0] num[0][1]
int num[3][2] ; num[1][0] num[1][1]
al

num[2][0] num[2][1]
.k

œœ The number of elements of an 2D array is


w

Numbers of Rows X Number of Columns


œœ The memory space allocated for an array is
w

Number of bytes allocated for type of array X Number of elements


w

Eg: int marks[4][3]


Number of elements = 4 × 3 = 12
Number of bytes required =4(bytes) × 12 = 48 bytes

Teacher Activity 3

Accessing array elements:


Two dimensional array uses two index values to access a particular element. Where the first index
specifies the row value and second index specifies the column value.

57 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 57 8/14/2021 12:39:58 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

Program:
Write a C++ program to access the 2nd and 5th elements of given array.
#include<iostream>
using namespace std;
int main()
{
int num[3][2]={10, 20, 30, 40, 50, 60};
cout<<num[0][1]<<endl;
cout<<num[2][0];
}

in
Output:

s.
20

s
50

Student Activity
p re
ex

1. The students in pair discuss about the two dimensional array and write a C++ program to print
the below given matrix (2x3) using two dimensional array.
vi

5 4 5
al

2 6 7
.k

2. The students are asked to find out the total number of elements in an array float mark[4][3].
3. The students are asked to write a C++ program to access the first and last elements of given array
w

int value[2][2]={50,75,80,56 }
w
w

Evaluation

1. Calculate the number of bytes required to store an array float A[3][2].


2. Write a C++ program to access the first 2 elements of given an array .
int num[3][2]={5,10,15,20,25,30}

XII Std Computer Science 58

12th Computer science_RCM_EM_Without day.indd 58 8/14/2021 12:39:59 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

24
Introduction to Object
Oriented Programming
Techniques

Learning Outcomes

After learning this topic the students will be able to


™™ Understand the concept of OOPS
™™ Know the difference between Procedural, Modular and Object Oriented Programming.

in
™™ Understand the advantages and disadvantages of Object Oriented Programming.

s.
Teacher Activity 1

s
Introduction:


Do you know the first name of C++?
C with Classes
p re
Object-Oriented Program:
ex

Object-Oriented Programming (OOP) is the term used to describe a programming approach based
on classes and objects. The object-oriented paradigm allows us to organize software as a collection
vi

of objects that consist of both data and behaviour. This is in contrast to conventional functional
programming practice, that loosely connects data and behaviour.
al
.k
w
w
w

59 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 59 8/14/2021 12:39:59 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

Teacher Activity 2

Programming Paradigms
Paradigm means organizing principle of a program. It is an approach to programming.There are
different approaches available for problem solving using computer. They are
1. Procedural programming
Procedural means a list of instructions were given to the computer to do something. Programs are
organized in the form of subroutines or sub programs. example. FORTRAN and COBOL.
2. Modular programming
Modular programming consists of multiple modules, each module has a set of functions of related
types. Data is hidden under the modules. It emphasis on algorithm rather than data. Example.

in
Pascal and C
3. Object Oriented Programming

s.
Object Oriented Programming paradigm emphasizes on the data rather than the algorithm. It

s
implements programs using classes and objects. Eg: C++, Python, java

re
Class:  A Class is used to bind data and its associated function together into a single unit using the
encapsulation concept. Class is a user defined data type. Class represents a group of similar
objects.
p
ex
Objects:  Represents data and its associated function together into a single unit. Objects are the basic
unit of OOP. Basically an object is created from a class. They are instances of class also called as
class variables An identifiable entity with some characteristics and behavior is called object.
vi

Eg: C++, Java, Python etc.


al

Teacher Activity 3
.k

The Object Oriented Programing has been developed to overcome the drawbacks of procedural
and modular programming. It is widely accepted that object-oriented programming is the most
w

important and powerful way of creating software.


w

The Object-Oriented Programming approach mainly encourages:


w

¾¾ Modularisation: where the program can be decomposed into modules.

¾¾ Software re-use: where a program can be composed from existing and new modules

Main Features of Object Oriented Programming

1. Encapsulation :  The mechanism by which the data and functions are bound together into a
single unit is known as Encapsulation.

2. Data Abstraction :  Abstraction refers to showing only the essential features without reveal-
ing background details.

3. Modularity :  Modularity is designing a system that is divided into a set of functional units.

XII Std Computer Science 60

12th Computer science_RCM_EM_Without day.indd 60 8/14/2021 12:39:59 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

4. Inheritance :  Inheritance is the technique of building new classes (derived class) from an
existing Class (base class).

5. Polymorphism :  Polymorphism is the ability of a message or function to be displayed in


more than one form.

Advantages of OOP
œœ Re-usability
œœ Redundancy
œœ Easy Maintenance
œœ Security
Disadvantages of OOP

in
œœ Size : OOPs are much larger than other programs.
œœ Effort : OOPs require a lot of work to create.

s.
œœ Speed : OOPs are slower than other programs, because of their size.

s
Student Activity p re
1. The students discuss about the advantages and disadvantages of OOP and write them down in
their note book.
ex

2. The students prepare matching cards for the main features of Object Oriented Programming
vi

1. Class – 1. Overloading
2. Data Abstraction – 2. User defined function
al

3. Modularity – 3. building new classes


.k

4. Inheritance – 4. Data hiding


5. Polymorphism – 5. Set of functional unit
w
w

Evaluation
w

1. Identify the class, Data members and methods.

Animal
Name eat()
Size sleep()
Age run()
Colour sit()
Sex

61 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 61 8/14/2021 12:39:59 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

25 Classes and Objects -


Introduction
Learning Outcomes

After learning this topic the students will be able to


™™ Understand the purpose of classes and objects.
™™ Know the declaration of class.

in
™™ Understand the Class Access Specifiers.

s.
Teacher Activity 1

s
Need for Class

re
Class is a way to bind the data and its associated functions together. Classes are needed to represent
real world entities, that not only have data type properties but also have associated operations. It is
used to create user defined data type.
p
ex

Declaration of a class
¾¾ A class is defined in C++ using the keyword class followed by the name of the class.
vi

¾¾ Th
 e body of the class is defined inside the curly brackets and terminated either by a semicolon
or a list of declarations at the end.
al

¾¾ The class body contains the declaration of its members (Data member and Member functions).
.k

¾¾ The class body has three access specifiers (private, public and protected)
The General Form of a class definition
w

class class-name
w

{
private:
w

variable declaration;
function declaration;
protected:
variable declaration;
function declaration;
public:
variable declaration;
function declaration;
};
XII Std Computer Science 62

12th Computer science_RCM_EM_Without day.indd 62 8/14/2021 12:39:59 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

Teacher Activity 2

Class Access Specifiers


Data hiding is one of the important features of object oriented programming which allows
preventing the functions of a program to access directly the internal representation of class type. The
access restriction to the class members is specified by public, private, and protected sections within the
class body. The keywords public, private, and protected are called access specifiers. The default access
specifier for members is private.

The Public Members

A public member is accessible from anywhere outside the class but within a program. You can set
and get the value of public data members even without using any member function.

in
The Private Members

s.
A private member cannot be accessed from outside the class. Only the class member functions can
access private members. Default member of the class is private.

s
re
The Protected Members

A protected member cannot be accessed from outside the class, however, they can be accessed in
p
inherited classes. 
ex

Example.
vi

class student
al

{
.k

private:
w

char name[10]:
w

int rollno,mark1,mark2.total;
w

protected:
void accept();
void compute();
public:
void display();
};

63 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 63 8/14/2021 12:39:59 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

Student Activity

1. The students are asked to specify the access specifier of the variables name,regno and total in the
following program code.

class student
{
char name[10];
int regno;
public:
int total;
void getdatat();
void display();
};

in
s.
Evaluation

s
re
1. Find out the errors of the underlined statement in the following code fragment
class student;
p
{
ex

Private
vi

char name[10];
al

int rollno,mark1,mark2,total;

protected:
.k

void accept();
w

void compute;
w

public:
w

void display(); };

XII Std Computer Science 64

12th Computer science_RCM_EM_Without day.indd 64 8/14/2021 12:39:59 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

26 Classes and Objects –


Class Members
Learning Outcomes

After learning this topic the students will be able


™™ To understand the definition of class members.
™™ To know how to create an object and access the class members.

in
Teacher Activity 1

s.
What are the class members?
Data members and member functions.

s
Definition of class members

re
Class members are classified as Data Members and Member functions.
Data members are the data variables that represent the features or properties of a class. Data mem-
bers are also called as attributes.
p
ex

Member functions are the functions that perform specific tasks in a class. Member functions are
called as methods.
vi
al
.k
w
w

Defining methods of a class


w

The member functions of a class can be defined in two ways.


(1) Inside the class definition
(2) Outside the class definition
(1) Inside the class definition
When a member function is defined inside a class, it behaves like inline functions. These are called
Inline member functions.
(2) Outside the class definition
When Member function defined outside the class just like normal function definition then it is
called as outline member function or non-inline member function. Scope resolution operator (::) is
used for this purpose.

65 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 65 8/14/2021 12:39:59 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

Teacher Activity 2
Objects Creation and Accessing:
The class variables are called object. Objects are also called as instance of class. The members of
a class are accessed by using the object of the class followed by the dot operator and the name of the

in
member.
Syntax for accessing Class members

s.
Object_name . function_name(actual parameter);

s
Example

Stud . execute();
p re
Membner function
Dot operator
Object name
ex

Objects can be created in two methods,


vi

(1) Global object


(2) Local object
al

(1) Global Object


If an object is declared outside all the function bodies or by placing their names immediately after
.k

the closing brace of the class declaration then it is called as Global object. These objects can be used by
any function in the program
w

(2) Local Object


w

If an object is declared with in a function then it is called local object. It cannot be accessed from
outside the function.
w

Eg.
class add
{
int a,b;
public:
int sum;
void getdata()
{
a=5;
b=10;
sum = a+b;
}
} a1; //global object

XII Std Computer Science 66

12th Computer science_RCM_EM_Without day.indd 66 8/14/2021 12:40:00 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

add a2; //global object


int main()
{
add a3; // Local object
a1.getdata();
a2.getdata();
a3.getdata();
cout<<a1.sum;
cout<<a2.sum;
cout<<a3.sum;
return 0;
}

Student Activity
1. The students are asked to categorize the global object and local object in the following program

in
code and present their tasks to the class
class subtract

s.
{
int m1,m2;

s
public:
int sub;


void getdata()

m1=10;
{
p re
m2=5;
ex
sub = m1- m2;
}
} s1;
vi

int main()
{
al

subtract s2;
s1.getdata();
.k

s2.getdata();
cout<<s1.sub;
cout<<s2.sub;
w

return 0;
}
w
w

Evaluation
1. Identify class name,object name,data members and member functions in the following program code.
class student
{
private:
char name[10];
int rollno,total;
public:
void accept();
void display();
}s1,s2;

67 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 67 8/14/2021 12:40:00 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

27 CONSTRUCTORS

Learning Outcomes
After learning this topic, the students will be able to
™™ Understand the purpose and functions of constructors.
™™ Construct C++ programs using classes with constructors.

Teacher Activity 1

in
Introduction to Constructors:

s.
The definition of a class only creates a new user defined data type. The instances of the class type

s
should be instantiated (created and initialized). Instantiating object is done using constructor. The
constructor function initializes the class object.
Declaration and Definition :
p re
When an instance of a class comes into scope, a special function called the constructor gets
executed. The constructor function name has the same name as the class name. The Constructors
ex

return nothing. It can be defined either inside or outside the class definition.
class sample
vi

{
int i,j ;
al

public :
sample( ) --------------- Constructor
.k

{
i=j=0;
w

}
};
w

Functions of Constructor:
w

1. To allocate memory space to the object.


2. To initialize the data member of the class object.
Characteristics of Constructors:
¾¾ The name of the constructor must be same as that of the class
¾¾ No return type can be specified for constructor
¾¾ A constructor can have parameter list
¾¾ The constructor function can be overloaded
¾¾ They cannot be inherited but a derived class can call the base class constructor
¾¾ The compiler generates a constructor, in the absence of a user defined constructor.
¾¾ Compiler generated constructor is public member function
¾¾ The constructor is executed automatically when the object is created
¾¾ A constructor can be used explicitly to create new object of its class type

XII Std Computer Science 68

12th Computer science_RCM_EM_Without day.indd 68 8/14/2021 12:40:00 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

Teacher Activity 2
Illustration of Constructor in a class
#include<iostream>
using namespace std;
class data
{
int i,j;
public:
data() ----------------------------- Constructor without parameter
{
cout<< ” Non-Parameterized Constructor ”;
i=0;
j=0;
}
data(int a, int b) --------------------- Constructor with parameters

in
{
cout<< ” Parameterized Constructor ”;
i=a;

s.
j=b;
}

s
void display() ----------------------- member function
{
cout<<i<<j;
}
};
int main()
p re
ex
{
data d1, d2(10,20);
d1.display();
vi

d2.display();
return 0;
}
al

Student Activity
.k

1. The students sit in groups and discuss about the purpose and Characteristics of Constructors. Each
w

group constructs C++ programs using class with constructors.


w

Evaluation
w

1. 1.Identify the Constructor in the following C++ code.


class simple
{
int i,j;
public:
simple()
{
i=j=0;
}
void display()
{
cout<< i<<j;
}
2. How constructor is differs from normal member function?
69 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 69 8/14/2021 12:40:00 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

28 DESTRUCTORS

Learning Outcomes
After learning this topic, the students will be able to
™™ Understand the purpose and characteristics of destructors.
™™ Construct C++ programs using classes with destructors.

in
Teacher Activity 1
Introduction to Destructors:

s.
When a class object goes out of scope, a special function called the destructor gets executed. The

s
destructor has the same name as the class tag but prefixed with a ~ (tilde). Destructor function return

re
nothing and it does not associated with any data type.
Declaration and Definition :
p
A destructor is a special member function that is called when the lifetime of an object ends and
destroys the object constructed by the constructor. Normally declared under public.
ex

class add
{
vi

int a, b ;
public :
add( ) ----------------- Constructor
al

{
a=b=0;
.k

}
~add() --------------- Destructor
w

{
cout<<”Destructor”;
w

}
};
w

Need of Destructors:
The purpose of the destructor is to free the resources that the object may have acquired during
its lifetime. A destructor function removes the memory of an object which was allocated by the
constructor at the time of creating an object.
Characteristics of Destructors:
¾¾ The destructor has the same name as that class prefixed by the tilde character ‘~’.
¾¾ The destructor cannot have arguments
¾¾ It has no return type
¾¾ Destructors cannot be overloaded
¾¾ In the absence of user defined destructor, it is generated by the compiler

XII Std Computer Science 70

12th Computer science_RCM_EM_Without day.indd 70 8/14/2021 12:40:00 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

¾¾ Th
 e destructor is executed automatically when the control reaches the end of class scope to
destroy the object
¾¾ They cannot be inherited

Teacher Activity 2
The Teacher explains the Destructor in the following program.
#include<iostream>
using namespace std;
class simple Output:
{
int i,j; Constructor of class simple
public:
Destructor is executed to destroy
simple ( )
{ the object

in
i=j=0;
cout<<”Constructor of class simple”<<endl;

s.
}
~ simple ( ) ----------------------------- Destructor
{

s
cout<<” \n Destructor is executed to destroy the object”;
}
};

{
int main ()
p re
ex
simple s;
return 0;
}
vi

Student Activity
al

1. The students prepare concept map for the purpose and characteristics of Destructors.
.k

2. The students are asked to write the destructor for the following C++ code.
class test
w

{
int a,b,sum;
w

public:
test()
w

{
cout<<”Constructor”;
}
};

Evaluation
1. What is destructor?
2. When are destructor called?
3. How destructor is differs from normal member function?

71 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 71 8/14/2021 12:40:00 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

29 Computer Ethics and


Cyber Security
Learning Outcomes
After learning this topic, the students will be able
™™ To know about cyber-crimes.
™™ To understand the guidelines and need for ethics in the cyber-world.
™™ To know the need of cyber security and firewall.

in
Teacher Activity 1

s.
Introduction
Internet is a communication media which is easily accessible and open to all. Information

s
Technology is widespread through computers, mobile phones and internet. There is a lot of scope and
possibility for misuse of Information Technology.p re
Computer systems in general are vulnerable. They play an important role in the daily lives of
individuals and businesses. Special care must be taken explicitly in order to ensure that the valuable
data do not get into wrong hands. Hence, the data need to be protected. A cyber-crime is a crime
ex
which involves computer and network. This is becoming a growing threat to society and is caused
by criminals or irresponsible action of individuals who are exploiting the widespread use of Internet.
It presents a major challenge to the ethical use of information technologies. Cyber-crime also poses
vi

threats to the integrity, safety and survival of most business systems.


Computer Ethics:
al

Ethics means “What is wrong and What is Right”. It is a set of moral principles that rule the behavior
.k

of individuals who use computers. An individual gains knowledge to follow the right behavior, using
morals that are also known as ethics. Morals refer to the generally accepted standards of right and
w

wrong in the society. Similarly, in cyberworld, there are certain standards such as
¾¾ Do not use pirated software
w

¾¾ Do not use unauthorized user accounts


¾¾ Do not steal others’ passwords
w

¾¾ Do not hack

Teacher Activity 2

Ethical Issues :
Cyber crime:
Cyber crime is a criminal activity that uses a computer, computer network or a network device.
Those who commit such crimes generally manipulate the computer system in an intelligent manner.
Example:
Illegal money transfer via the internet.
Morphing the image, text or video content.

XII Std Computer Science 72

12th Computer science_RCM_EM_Without day.indd 72 8/14/2021 12:40:00 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

Software piracy:
Software piracy is the copyright violation of software created originally by an individual or an
institution. It is also called “unauthorized copying of software”.
Example:
Duplicating and selling copyrighted programs.
Downloading software illegally through the network.
Hacking:
Hacking is intruding into a computer system to steal personal data without the owner’s permission
or knowledge. It is also gaining unauthorized access to a computer system and altering its contents. It
may be a criminal activity or may be a hobby.
Cracking:
Cracking means trying to get into a computer system in order to steal or corrupt data. Crackers
may send official email requesting some sensitive information. A cracker is a malicious or criminal
hacker.

in
Example:  Using a password cracking algorithm to gain access to a computer system.

s.
Teacher Activity 3

s
Cyber security:
p re
Cyber attacks cause significant damage to a computer system or for stealing important informa-
tion from an individual or an organization. Cyber security is a collection of various technologies,
processes and measures that reduces the risk of cyber attacks and protects the organizations and indi-
viduals from computer based threats.
ex

Example:  Network Security, Secure Coding


Types of Network Security
vi

Firewall:
Firewall is a computer network security based system that monitors and controls incoming and
al

outgoing network traffic based on predefined security rules. A firewall commonly establishes a block
between a trusted internal computer network and entrusted computers outside the network.
.k

Encryption and Decryption


Encryption and Decryption are the processes that ensure confidentiality that only authorized
w

persons can access the information.


w

Encryption is the process of translating the plain text data into random data called ciphertext.
Decryption is the reverse process of converting the ciphertext back to a plain text.
w

Example:  WhatsApp text message

Student Activity
1. The students sit in groups and do the sketch noting in a chart about the various cyber crimes and
Computer Ethics , and present them one by one to the class in their turn.

Evaluation

1. Write any five ethics that you have to follow while using internet.

73 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 73 8/14/2021 12:40:00 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

30 Tamil Computing

Learning Outcomes
After learning this topic, the students will be able to
™™ Know how to use modern technology through the internet.
™™ Know the uses of Tamil in Social media.

in
Teacher Activity 1

s.
Tamil in Internet:

s
re
¾¾ Internet is the best information technological device through which we get information.
Internet today plays a vital role in every man’s life.
p
¾¾ I n 2017 a Singapore based organisation KPMA along with Google reported that, Tamil topped
the list among the most widely used languages in India where 42% are using the internet in
ex

Tamil.
¾¾ A
 s per study, among the Indian language users of the internet, 74% of people will be using
vi

Tamil by 2021 and it will be in the top usage of the internet in India.
al

Search engines in Tamil


¾¾ Search engines are used to search any information from cyberspace.
.k

¾¾ Google, Bing and Yahoo are the top search engines used by the users.
w

¾¾ Google and Bing provide searching facilities in Tamil.


w

¾¾ T
 o use the search engine Google, we can use https://www.google.com and for Yahoo, we can use
w

https://in.yahoo.com.

Teacher Activity 2

E-Governance
Getting government services through the internet is known as e-governance. The Government of
Tamilnadu has been giving its services through the internet.
Web Address and its E-governance.
1. http://www.tn.gov.in/ta Official Website of Govt. of Tamilnadu
2. http://www.aed.tn.gov.in/ Department of Agricultural Engineering

XII Std Computer Science 74

12th Computer science_RCM_EM_Without day.indd 74 8/14/2021 12:40:00 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

3. http://www.dge.tn.nic.in/ Directorate of Govt. Examinations


4. http://www.tnhealth.org/ Tamilnadu Health Department

E-library
E-libraries are portal or website of collection of e-books. Tamil E-library services provide thousands
of Tamil books as e-books mostly at free of cost. It is the most useful service to Tamil people who live
far away from their homeland.
Web Address and its E-library
1. http://www.textbooksonline.tn.nic.in/ Tamilnadu School Textbooks
2. http://tamildigitallibrary.in/ Tamil Digital Library
3. http://www.chennailibrary.com/ Chennai Library

in
4. http://www.thamizhagam.net/parithi/parithi.html Thamizhagam

s.
Teacher Activity 3

s
Tamil typing and interface software p re
Tamil is mostly used to type documents in word processors and search information on the internet.
Typing Tamil using Tamil interface software is a familiar one among the different methods of typing
Tamil in both computers and smartphones.
ex

Example:  Desktop: NHM Writer, e-Kalappai and Lipikar,


vi

Smart phone: Sellinam and ponmadal.


Tamil Translation Application
al

Thamizpori (தமிழ்பொறி) is a Tamil Tranlation Application having more than 30000 Tamil words
.k

equalent to English words. Using this application, we can translate small English sentences into Tamil.
Google also gives an online translation facility, using this online facility we can translate from Tamil to any
w

other language and vice versa.


w

Tamil Programming Language


w

Programming languages to develop software in computers and smart phones are available only
in English. Now, efforts are taken to develop programming languages in Tamil. Based on Python
programming language, the first Tamil programming language “Ezhil” (எழில்) is designed. With the
help of this programming language, we can write simple programs in Tamil.
Tamil Operating System
An operating system is needed to access electronic systems such as computer and smart phone.All
operating systems used in computers and smart phones are offered in Tamil environment. Windows
Tamil Environment interface should be downloaded and installed from the internet. It displays all
window elements such as Taskbar, desktop elements, names of icons and commands in Tamil.

75 XII Std Computer Science

12th Computer science_RCM_EM_Without day.indd 75 8/14/2021 12:40:01 PM


Send Your Material &Question Answer Our Email ID [email protected]
www.kalviexpress.in www.kalviexpress.in

Tamil Virtual Academy


With the objectives of spreading Tamil to the entire world through internet, Tamil Virtual
University was established on 17th February 2001 by the Govt. of Tamilnadu. Now, this organisation
functions with the name of “Tamil Virtual Academy”. It offers different courses in Tamil language,
Culture, heritage etc., from kindergarten to under graduation level.
Website: http://www.tamilvu.org/index.php
Tamil Wikipedia
Wikipedia is a open source encyclopedia where any person can write an article about any subject.
There are more than One lakh articles in Tamil Wikipedia. Web Site: https://ta.wikipedia.org/

Student Activity

in
1. The teacher provides website address to each student and the students perform the task of
downloading the material through the web site address given to them.

s s.
Evaluation
p re
1. Type a short paragraph about yourself in WordPad by using Tamil font.
ex
vi
al
.k
w
w
w

XII Std Computer Science 76

12th Computer science_RCM_EM_Without day.indd 76 8/14/2021 12:40:01 PM


Send Your Material &Question Answer Our Email ID [email protected]

You might also like