Sei sulla pagina 1di 11

A PRACTICAL WORKBOOK

FOR CBSE
COMPUTER SCIENCE (C++ and SQL)
CLASS XII
A PRACTICAL WO
PRACTICAL RKBOO
WORKBOO
RKBOOKK
FOR CBSE
COMPUTER SCIENCE (C++ and SQL)
COMPUTER
CLASS XII

(Strictly according to new curriculum prescribed by CBSE)

By
Pavithra Karthik,
B.Tech, MS (IT)
Lecturer,
Arsha Vidya Mandir Senior Secondary School,
Chennai, Tamil Nadu


LAXMI PUBLICATIONS (P) LTD


"!.'!,/2% ∑ #(%..!) ∑ #/#(). ∑ '57!(!4) ∑ (9$%2!"!$
*!,!.$(!2 ∑ +/,+!4! ∑ ,5#+./7 ∑ -5-"!) ∑ 2!.#() ∑ NEW DELHI
).$)! ∑ 53! ∑ '(!.!
∑ +%.9!
A PRACTICAL WORKBOOK FOR CBSE COMPUTER SCIENCE (C++ AND SQL)

Copyright © by Laxmi Publications (P) Ltd.


All rights reserved including those of translation into other languages. In accordance with the Copyright (Amendment) Act, 2012,
no part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic,
mechanical, photocopying, recording or otherwise. Any such act or scanning, uploading, and or electronic sharing of any part of this
book without the permission of the publisher constitutes unlawful piracy and theft of the copyright holder’s intellectual property.
If you would like to use material from the book (other than for review purposes), prior written permission must be obtained from
the publishers.

Printed and bound in India


Typeset at Excellent Graphics, Delhi
New Edition
T12-8981-150-A PRAC WB COMP SC C++ XII
ISBN : 978-93-5138-129-7
Price: ` 150.00

Limits of Liability/Disclaimer of Warranty: The publisher and the author make no representation or warranties with respect to the
accuracy or completeness of the contents of this work and specifically disclaim all warranties. The advice, strategies, and activities
contained herein may not be suitable for every situation. In performing activities adult supervision must be sought. Likewise,
common sense and care are essential to the conduct of any and all activities, whether described in this book or otherwise. Neither
the publisher nor the author shall be liable or assumes any responsibility for any injuries or damages arising herefrom. The fact that
an organization or Website if referred to in this work as a citation and/or a potential source of further information does not mean
that the author or the publisher endorses the information the organization or Website may provide or recommendations it may
make. Further, readers must be aware that the Internet Websites listed in this work may have changed or disappeared between
when this work was written and when it is read.
All trademarks, logos or any other mark such as Vibgyor, USP, Amanda, Golden Bells, Firewall Media, Mercury, Trinity, Laxmi
appearing in this work are trademarks and intellectual property owned by or licensed to Laxmi Publications, its subsidiaries or
affiliates. Notwithstanding this disclaimer, all other names and marks mentioned in this work are the trade names, trademarks or
service marks of their respective owners.

& Bangalore 080-26 75 69 30


& Chennai 044-24 34 47 26, 24 35 95 07
& Cochin 0484-237 70 04, 405 13 03
& Guwahati 0361-254 36 69, 251 38 81
Branches

& Hyderabad 040-27 55 53 83, 27 55 53 93


& Jalandhar 0181-222 12 72

Published in India by & Kolkata 033-22 27 43 84


& Lucknow 0522-220 99 16
& Mumbai 022-24 91 54 15, 24 92 78 69

Laxmi Publications (P) Ltd. & Ranchi 0651-220 44 64


113, GOLDEN HOUSE, DARYAGANJ,
NEW DELHI - 110002, INDIA
Telephone : 91-11-4353 2500, 4353 2501
Fax : 91-11-2325 2572, 4353 2528 C—
www.laxmipublications.com info@laxmipublications.com Printed at:
CONTENTS
Syllabus-Class XII (Practical) ... (xi–xii)
Guidelines to the Instructors ... (xiii)
Guidelines to the Lab Administrator ... (xiii)

UNIT 1: CLASSES, CONSTRUCTORS AND INHERITANCE ... 1–30


1. Student Result Preparation System ... 2
2. Bank Account Simulation Class ... 6
3. Inventory Simulation ... 11
4. Function Overloading ... 13
5. Multiple Inheritance ... 16
6. Multilevel Inheritance ... 18
7. Constructor Overloading ... 23
Practice Problems ... 26
Viva-Voce ... 28

UNIT 2: FILE HANDLING ... 31–43


1. Text File Manipulation ... 31
2. Counting Lines in a Text File ... 34
3. Binary File Manipulation ... 36
Practice Problems ... 41
Viva-Voce ... 42

UNIT 3: DATA STRUCTURES ... 44–85


1. Dynamic Structures ... 44
2. Array Searching ... 48
3. Array Sorting ... 51
4. 2D Array Manipulation ... 54
5. Linked List ... 58
6. Stack—Array Implementation ... 61
7. Stacks—Linked List Implementation ... 64
8. Queues—Array Implementation ... 68
9. Queues—Linked List Implementation ... 72
10. Infix to Postfix Conversion ... 75
11. Circular Queues ... 79
Practice Problems ... 83
Viva-Voce ... 84

UNIT 4: DATABASES AND SQL ... 86–96


DDL Commands ... 87
DML Commands ... 89
(v)
( vi )
Solved Exercises ... 92
Practice Problems ... 95
Viva-Voce ... 96

UNIT 5: PROJECT ... 97–118


1. Automated Quizzing Machine (Classes and Files) ... 97
2. Bookshop (Classes and Databases) ... 103

APPENDIX A: INSTALLING AND EXECUTING PROGRAMS IN C++ ... 119–132

APPENDIX B: INSTALLING AND WORKING WITH SQL SERVER 2008 R2 ... 133–153
FOREWORD
Mrs. Pavithra, obtained her B.Tech from Adhiparasakthi Engineering College, Melmaruvathur. She did her
M.S (by Research) under my guidance at Madras Institute of Technology, Anna University, Chennai. Pavithra was
a constant achiever right from her school days. She stood district 2nd in class 10 and got a state 3rd rank in English
in class 12. She also secured a university gold medal in B.Tech.
She worked with Cognizant technology solutions for over 4 years. Her certifications include Microsoft certified
Programmer (ASP.NET), Java Certificate (SCJP) and webMethods certified professional. A software programmer
by profession, she switched her career to teaching. She now divides her time for tutoring various engineering students
across the globe and works part-time, lecturing students of class 11 and 12 at Arsha Vidya Mandir CBSE School,
Chennai.
This practical book is an excellent work of compilation of relevant C++ programs required for students of
class 12. Practice problems are given at the end of each unit followed by probable viva questions covering the relevant
topics. This book would serve as a practical guide for students preparing for their practical exams.
All the best.
Dr S. Thamarai Selvi
Professor and Dean,
Department of Computer Technology,
Madras Institute of Technology,
Anna University Chennai.

( vii )
PREFACE
This practical workbook is intended to be used by Computer Science students of class 12 in CBSE curriculum.
This workbook provides the requisite background material as well as numerous computing problems covering all
difficulty levels. This book can also be used by students learning the C++ language.
The objectives of this book are:
1. Defining clearly the scope of the course.
2. Bringing uniformity in the way the course is conducted across different schools strictly catering to CBSE
syllabus.
3. Provide ready reference for students while working in the lab.
4. Slow learners can learn the programs already solved while the fast paced learners can improve their
computing skills by trying the practice problems.
This book is organized into 5 units.
Unit 1 deals with the general OOP concepts. It has 7 programs. The first 3 programs explain the concepts of
encapsulation and abstraction using classes and objects. Programs 4 and 5 deal with Polymorphism and the Programs
6 and 7 illustrate inheritance.
Unit 2 explains file handling in C++. It has 3 programs where the first 2 programs deal with reading and
writing to text files. Program 3 explains insertion, deletion, updation, searching of binary files.
Unit 3 explains the data structures and their implementation in C++. It has 11 programs. The first program
explains the dynamic structures. Programs 2 and 3 explain various array searching and sorting techniques. Program 4
explains 2D array operations. Program 5 explains creating and traversing a simple linked list. Programs 6 and 7,
explain the stack data structure and implementing it as an array and linked list. Programs 8 and 9 explain Queues
in a similar fashion. Program 10 is an application of stack and explains the infix to postfix conversion. Program 11
explains circular queues.
Unit 4 deals with databases. A lot of SQL commands with syntax and examples are explained.
Unit 5 explains 2 projects which can be used as a sample by students when designing their projects. Project 1
is an automatic quizzing machine which uses files and classes. Project 2 is bookshop simulation software which uses
databases and queries it from C++.
Appendix 1 explains the step-by-step installation of Visual C++ software. It also explains how to create a
simple C++ application. Appendix 2 explains the step-by-step installation of SQL Server 2008 and creating and
executing queries.
This book is intended to be simple yet effective for class 12 students who would use this ready reference for
better preparation. All programs have been thoroughly tested and screenshots are provided for every program for
better understanding.
—Author

( ix )
ACKNOWLEDGEMENTS
I dedicate this book to my parents, who have been a constant source of inspiration to me right from my
childhood. They have taught me that “Whatever happens, happens for a reason” and have helped me to accept life
in its stride and give my best wherever I am and in whatever I do.
Behind every successful woman, needs to be her husband and this book is a proof of that support. I thank my
husband, Karthik for the technical review of the book. I got a good critic in him, and thanks to him, the book is in a
much better shape now than how it was initially.
A special thanks to my sister-in-law, Kanchan for helping me in designing the flowcharts. I would like to
thank each of my family members, including my kids, who have been instrumental in encouraging me in writing this
book. I thank them from the bottom of my heart for helping me achieve this height.
I thank Laxmi publications for having confidence in me and publishing my very first book. They have brought
my talent to the outside world. Last but not the least; I would like to thank each one of my students who have
encouraged me to write this book. They have helped me in continuous learning and researching and hope my journey
continues.
—Author

(x)
SYLLABUS
Class XII (Practical) C++
Duration: 3 Hours Total Marks: 30
1. Programming in C++ (10)
One programming problem in C++ to be developed and tested in Computer during the examination. Marks
are allotted on the basis of following:
Logic : 5 Marks
Documentation/Indentation : 2 Marks
Output presentation : 3 Marks
Notes: The types of problems to be given will be of application type from the following topics:
• Arrays (One-dimensional and two-dimensional)
• Class(es) and objects
• Stack using arrays and linked implementation
• Queue using arrays (circular) and or linked implementation
• Binary File operations (Creation, Displaying, Searching and modification)
• Text File operations (Creation, Displaying and modification)
2. SQL Commands
Five Query questions based on a particular Table/Reaction to be tested practically on Computer during the
examination. The command along with the result must be written in the answer sheet.
3. Project Work
The project has to be developed in C++ language with Object Oriented Technology and also should have use of
Data files. (The project is required to be developed in a group of 2-4 students)
• Presentation on the computer
• Project report (Listing, Sample, Outputs, Documentation)
• Viva
4. Practical File
Must have minimum 20 programs from the following topics:
• Arrays (One-dimensional and two-dimensional, sorting, searching, merging, delection and insertion of
elements)
• Class(es) and objects
• Stacks using arrays (linear and circular) and linked implementation
• File (Binary and Text) operations (Creation, Updation, Query)
• Any computational Based problems
15 SQL commands along with the output based on any table/relation:
5. Viva-Voce
Viva wil lbe asked from syllabus covered in Class XII and the project developed by student.

( xi )
A Practical Workbook for Computer
Science (C++ and SQL) Class 12th New
2014

40%
OFF

Publisher : Laxmi Publications ISBN : 9789351381297 Author : Pavithra Karthik

Type the URL : http://www.kopykitab.com/product/4 355

Get this eBook

Potrebbero piacerti anche