sample copy. not for distribution.unit-wise marks of computer science of cbse class 12 board :- cbse...

18
Sample Copy. Not For Distribution.

Upload: others

Post on 25-Jun-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Sample Copy. Not For Distribution.Unit-wise marks of Computer Science of CBSE Class 12 Board :- CBSE Type:- Theory Duration: 3 hrs Marks:- 70 Class XII (Practical) C++ - Total Marks:

Sample Copy. Not For Distribution.

Page 2: Sample Copy. Not For Distribution.Unit-wise marks of Computer Science of CBSE Class 12 Board :- CBSE Type:- Theory Duration: 3 hrs Marks:- 70 Class XII (Practical) C++ - Total Marks:

i

CBSE Simplified C++

Sample Copy. Not For Distribution.

Page 3: Sample Copy. Not For Distribution.Unit-wise marks of Computer Science of CBSE Class 12 Board :- CBSE Type:- Theory Duration: 3 hrs Marks:- 70 Class XII (Practical) C++ - Total Marks:

ii

Publishing-in-support-of,

EDUCREATION PUBLISHING

RZ 94, Sector - 6, Dwarka, New Delhi - 110075 Shubham Vihar, Mangla, Bilaspur, Chhattisgarh - 495001

Website: www.educreation.in _____________________________________________________________________________

© Copyright, 2018, Kunal Banerjee

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted, in any form by any means, electronic, mechanical, magnetic, optical, chemical, manual, photocopying, recording or otherwise, without the prior written consent of its writer.

ISBN: 978-1-5457-1854-4

Price: ` 565.00

The opinions/ contents expressed in this book are solely of the author and do not represent the opinions/ standings/ thoughts of Educreation.

Printed in India

Sample Copy. Not For Distribution.

Page 4: Sample Copy. Not For Distribution.Unit-wise marks of Computer Science of CBSE Class 12 Board :- CBSE Type:- Theory Duration: 3 hrs Marks:- 70 Class XII (Practical) C++ - Total Marks:

iii

CBSE Simplified C++

For Class 12

Kunal Banerjee BCA, MSC.IT, B.ED in computer Science

Jamshedpur-831011 (Jharkhand)

EDUCREATION PUBLISHING (Since 2011)

www.educreation.in

Sample Copy. Not For Distribution.

Page 5: Sample Copy. Not For Distribution.Unit-wise marks of Computer Science of CBSE Class 12 Board :- CBSE Type:- Theory Duration: 3 hrs Marks:- 70 Class XII (Practical) C++ - Total Marks:

iv

Sample Copy. Not For Distribution.

Page 6: Sample Copy. Not For Distribution.Unit-wise marks of Computer Science of CBSE Class 12 Board :- CBSE Type:- Theory Duration: 3 hrs Marks:- 70 Class XII (Practical) C++ - Total Marks:

v

About The Author

KUNAL BANERJEE is software professional in FLANDEZ

SOFTWARE SOLUTION with more than 5 years of experience

in software design. More formally, he graduated from Sikkim

Manipal University with an MSC.IT degree in computer science.

He holds multiple professional certifications like honours in

Hardware & networking, Visual studio.net, SAP basis, CCNA,

RHCE.

Apart from work, he enjoys serving the community. Work for

community service through his employers for corporate social responsibility programs.

He was organizing free seminars in Government schools as for motive of basic

fundamental computer education. He is an active speaker, counsellor on a variety of

subjects in all fields.

This Biography was provided by the author or their representatives.

Sample Copy. Not For Distribution.

Page 7: Sample Copy. Not For Distribution.Unit-wise marks of Computer Science of CBSE Class 12 Board :- CBSE Type:- Theory Duration: 3 hrs Marks:- 70 Class XII (Practical) C++ - Total Marks:

vi

Sample Copy. Not For Distribution.

Page 8: Sample Copy. Not For Distribution.Unit-wise marks of Computer Science of CBSE Class 12 Board :- CBSE Type:- Theory Duration: 3 hrs Marks:- 70 Class XII (Practical) C++ - Total Marks:

vii

Dedication

This book is dedicated to MAA, BABA, BHAI (Mrinal), Ankita (Priyo)

&

To everyone who wonders if I am writing for them.

Sample Copy. Not For Distribution.

Page 9: Sample Copy. Not For Distribution.Unit-wise marks of Computer Science of CBSE Class 12 Board :- CBSE Type:- Theory Duration: 3 hrs Marks:- 70 Class XII (Practical) C++ - Total Marks:

viii

Sample Copy. Not For Distribution.

Page 10: Sample Copy. Not For Distribution.Unit-wise marks of Computer Science of CBSE Class 12 Board :- CBSE Type:- Theory Duration: 3 hrs Marks:- 70 Class XII (Practical) C++ - Total Marks:

ix

The book is written strictly according to the syllabus prepared by council for the Central

Board of secondary Education Examination. However, this book will also help the

beginner to understand the basic concept of C++.

Sample Copy. Not For Distribution.

Page 11: Sample Copy. Not For Distribution.Unit-wise marks of Computer Science of CBSE Class 12 Board :- CBSE Type:- Theory Duration: 3 hrs Marks:- 70 Class XII (Practical) C++ - Total Marks:

x

Unit-wise marks of Computer Science of CBSE Class 12

Board :- CBSE

Type:- Theory

Duration: 3 hrs

Marks:- 70

Class XII (Practical) C++ - Total Marks: 30

Programming in C++ (10)

SQL Commands (05)

Project Work (05)

Practical File (06)

Viva Voce (04)

SL. NO UNIT NAME MARKS

1 Object Oriented Programing 30

2 DATA STRUCTURES 14

3 DATABASES AND SQL 08

4 BOOLEAN ALGEBRA 08

5 COMPUTER NETWORKS 10

Sample Copy. Not For Distribution.

Page 12: Sample Copy. Not For Distribution.Unit-wise marks of Computer Science of CBSE Class 12 Board :- CBSE Type:- Theory Duration: 3 hrs Marks:- 70 Class XII (Practical) C++ - Total Marks:

xi

Content List

Sr. No. Content Page

1. Class 1

2. Constructor And Destructor 23

3. Inheritance 36

4. Pointers 51

5. Array 63

6. Data Structure-I (Stack & Queue) 102

7. Data Structure - II Linked List 112

8. File Handling 120

9. Boolean Algebra 153

10. SQL 177

11. Communication Technologies 197

12. Mobile Communication 222

13. Question Bank (Solved & Unsolved) 238

Sample Copy. Not For Distribution.

Page 13: Sample Copy. Not For Distribution.Unit-wise marks of Computer Science of CBSE Class 12 Board :- CBSE Type:- Theory Duration: 3 hrs Marks:- 70 Class XII (Practical) C++ - Total Marks:

xii

Sample Copy. Not For Distribution.

Page 14: Sample Copy. Not For Distribution.Unit-wise marks of Computer Science of CBSE Class 12 Board :- CBSE Type:- Theory Duration: 3 hrs Marks:- 70 Class XII (Practical) C++ - Total Marks:

1

CLASS ________________________________________________________________________

Class is the main concept or the reason for developing C++. C++ stands for C with classes.

Earlier we have studied about structure in C++ so you might have a question that when we

are able to code our program with the help of structure then what is the necessity to use the

concept of class. For that let us first see the differences between structure and class so that we

can understand the benefits that class provides.

Difference between class and structure:

CLASS STRUCTURE

Fully based on OOP‘S concept No OOP‘S concept supported.

By default all data members are private By default all data members are public

Class contains data members and

member functions.

Structure contains data members only

according to C concept.

Class works with object/objects. Structure works with variable/variables.

Class can inherit another class. Structure does not support the inheritance.

So, these are the few basic differences between Class and Structure however there are many

more differences but I have given you few basic general differences to make you understand

why the concept of Class has been created.

Let us see how to declare, call and use the concept of class:-

Whenever you declare a Class you have to use a keyword:- class (in lowercase)

By default class is: private (Access modifier)

What is Access modifier?

C++ uses the three modifiers called public, protected, and private. However the concept of

protected will be discussed later on in the inheritance chapter.

As I told you earlier that C++ works on the concept of OOP‘S so the data hiding and data

accessing is the top most priority for the developers while creating program using the concept

of class. For this reason the access modifier has been developed. Access modifier basically

act as a security barrier and defines how the data will be accessed from the class or from

outside the class.

Sample Copy. Not For Distribution.

Page 15: Sample Copy. Not For Distribution.Unit-wise marks of Computer Science of CBSE Class 12 Board :- CBSE Type:- Theory Duration: 3 hrs Marks:- 70 Class XII (Practical) C++ - Total Marks:

2

Why Class is by default private?

As we know that C++ works on the concept of OOP‘S (object oriented programming) and

the OOP is basically concern with the security. So while using the concept of class in our

program the C++ by default gives you a security that your data members and functions that

you are going to declare inside the class are by default private and hence cannot be accessible

by non-members which means the member that don‘t belongs to that particular Class will not

be able to access those data.

(However you can change the modifier from private to public)

Before going into the details of this chapter let understand what is class and object?

Class: In programming a class is a collection of as many as objects. A class can consist of

functions, data members etc.. A class is basically a user defined data type. According to the

OOPs class is the blueprint/template of an object. It provides the state and behaviour for an

object.

Object: A class provides the blueprints for objects, so basically an object is created from a

class. We declare objects of a class with exactly the same sort of declaration that we declare

variables of basic types.

Now let us take a short example of class and object

We all are familiar with Mobile phones. Now day‘s mobile phones are having lots of

features. With each passing day a new mobile phones are being launched with new and latest

features and versions there are some of the latest features are like:- 4G ,shake features, NFC,

radio transmitter, heart rate sensor, fingerprint sensor etc.

Now if we see this whole scenario in the format of OOPs then what we find is that there is a

mobile with having different functions/ features.

So here the Mobile is a CLASS and its Features are objects, in fact the colour, price, screen

size etc… are all the objects of Mobile.

Now the question is why we have made the features as an object?

We have made the features the object of the Class MOBILE because each and every features

state some behavior of the class MOBILE.

Like: - NFC is used to transfer files or data to other NFC enabled devices.

Shake feature is used to change the wallpaper of the screen as well as music.

Finger print sensor is used to unlock our applications and provides privacy.

Sample Copy. Not For Distribution.

Page 16: Sample Copy. Not For Distribution.Unit-wise marks of Computer Science of CBSE Class 12 Board :- CBSE Type:- Theory Duration: 3 hrs Marks:- 70 Class XII (Practical) C++ - Total Marks:

3

HOW TO DECLARE A CLASS

class <class name>

{

private:

<declaration of members/ functions>

public:

<declaration of members/function>

}object;

Note: - if you have created a private member then you have to declare a public modifier so

that you can use the private data member or function of that class.

Now I am showing you a sample program to add two numbers using the concept of class. I

will show the example in two ways one by declaring data members and function with public

modifier and other example with the help of private modifier so that you can understand the

concept more clearly.

class addition

{

public:

int a,b,c;

void display()

{

c=a+b;

cout<<‖sum is:- ‖<<c;

}

}obj;

class addition

{

private:

int a,b,c;

public:

void display()

{

a=10,b=20;

c=a+b;

cout<<‖sum is:- ‖<<c;

}

Object created

Object creation is

optional but terminator

is mandatory.

Sample Copy. Not For Distribution.

Page 17: Sample Copy. Not For Distribution.Unit-wise marks of Computer Science of CBSE Class 12 Board :- CBSE Type:- Theory Duration: 3 hrs Marks:- 70 Class XII (Practical) C++ - Total Marks:

Get Complete Book

At Educreation Store

www.educreation.in

Sample Copy. Not For Distribution.

Page 18: Sample Copy. Not For Distribution.Unit-wise marks of Computer Science of CBSE Class 12 Board :- CBSE Type:- Theory Duration: 3 hrs Marks:- 70 Class XII (Practical) C++ - Total Marks:

Sample Copy. Not For Distribution.