A PRACTICAL WORKBOOK FOR COMPUTER SCIENCE (C++) CLASS XI
A PRACTICAL WORKBOOK FOR COMPUTER SCIENCE (C++) CLASS XI (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 BANGALORE CHENNAI COCHIN GUWAHATI HYDERABAD JALANDHAR KOLKATA LUCKNOW MUMBAI RANCHI INDIA USA GHANA KENYA
A PRACTICAL WORKBOOK FOR COMPUTER SCIENCE (C + +) XI 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 T11-8858-125-PRAC WORKBK COMP SC C++ XI ISBN 978-93-5138-065-8 Price: ` 125.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. PUBLISHED IN INDIA BY Laxmi Publications (P) Ltd. 113, GOLDEN HOUSE, DARYAGANJ, NEW DELHI - 110002, INDIA Telephone : 91-11-4353 2500, 4353 2501 Fax : 91-11-2325 2572, 4353 2528 www.laxmipublications.com info@laxmipublications.com Branches & 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 & Hyderabad 040-27 55 53 83, 27 55 53 93 & Jalandhar 0181-222 12 72 & Kolkata 033-22 27 43 84 & Lucknow 0522-220 99 16 & Mumbai 022-24 91 54 15, 24 92 78 69 & Ranchi 0651-220 44 64 C Printed at:
CONTENTS Syllabus-Class XI (Practical)... (xi) Unit 1 : Control Structures Sequential, Conditional and Iterative Statements... 1 26 1. Roots of a Quadratic Equation... 3 2. Electricity Bill Generation... 5 3. Area Calculator Usiug Switch... 7 4. Summation of Series... 9 5. Number Game... 12 6. Summation Using Do while... 16 7. Fibonacci Series... 18 8. Decimal to Binary Conversion... 19 9. Pattern Generation... 21... 24... 25 Additional Questions... 26 UNIT 2 : ARRAYS... 27 38 1. Array of Employees... 27 2. Array Manipulation... 29 3. 2D Array Manipulation... 33... 37... 37 Additional Questions... 38 UNIT 3 : STRINGS... 39 45 1. Counting Vowels... 40 2. Sorting an Array of Strings... 41 3. Palindrome... 43... 45... 45 Additional Questions... 45 UNIT 4 : FUNCTIONS... 46 52 1. Four Function Calculator Using Functions... 46 2. Functions and Default Arguments... 49... 51... 52 Additional Questions... 52 ( v )
( vi ) UNIT 5 : EVENT DRIVEN PROGRAMMING... 53 62 1. Guessing Number Game Program... 53 2. Cows and Bulls... 55 3. Hangman... 58... 62... 62 UNIT 6 : STRUCTURES... 63 72 1. Employee Structure... 63 2. Complex Numbers... 67... 71... 72 UNIT 7 : SAMPLE PROJECTS... 73 98 1. Alien Code Generator Lorrinator... 73 2. Modern Periodic Table... 84 APPENDIX A : INSTALLING AND EXECUTING PROGRAMS IN C++... 99 112 APPENDIX B: COMMON ERRORS AND SUGGESTIONS TO CORRECT... 113 114
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 2 nd in class 10 and got a state 3 rd 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 11. It would also help a novice to learn the basics of C++ language. 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 11 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. Providing 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 7 units. Unit 1 deals with control structures of C++. It has 9 programs. These programs explain if else structure, switch construct, for, while and do while loops. They also explain pattern generation using nested loops. Unit 2 deals with arrays. It has 4 programs which explain insertion, deletion, searching, sorting, maximum and minimum in 1D array. It also explains 2D array manipulation. Unit 3 deals with strings. It has 3 programs. It has programs for counting vowels, palindrome and sorting an array of strings. Unit 4 explains functions. It demonstrates four function calculator using functions and functions with default arguments. Unit 5 explains event-driven programming has 3 programs: A guessing number game, cows and bulls and Hangman. Unit 6 deals with Structures. It explains an employee structure and complex number arithmetic using structures. Unit 7 deals with sample projects. Project 1 is an encryption algorithm using strings, functions and arrays. Project 2 is a simulation of a Modern periodic table using structures. Appendix 1 explains the step-by-step installation of Visual C++ software. It also explains how to create a simple C++ application. Appendix 2 lists some common errors in programming and suggestions to correct it. This book is intended to be simple yet effective for class 11 students who would use this ready reference for better preparation. All programs have been thoroughly tested and screenshots are provided after 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 and my brother-in-law Mr.Bharani Rajan, for the technical review of the book. I got a good critic in them, and thanks to them, 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 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 XI (Practical) 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 Note: The types of problems to be given will be of application type from the following topics 2. Project Work (10) 1. Preamble 1.1 The academic course in Computer Science includes one Project each year. The purpose behind this is to consolidate the concepts and practices imparted during the course and to serve as a record of competence. 1.2 A group of two/three students as team may be allowed to work on one project. 2. Project content 2.1 Project can be selected from one of the topics given in event programming. Theme of the project can be: Any subsystem of a System Software or Tool Any Scientific or a fairly complex algorithmic situation. Business oriented problems like Banking, Library information system, Hotel or Hospital management system, Transport query system Quizzes/Games; Tutor/Computer Aided Learning Systems 2.2 The aim of the project is to highlight the abilities of algorithmic formulation, modular programming, optimized code preparation, systematic documentation and other associated aspects of Software Development. 2.3 The assessment would be through the project demonstration and the Project Report, which should portray Programming Style, Structured Design, Minimum Coupling, High Cohesion, Good documentation of the code to ensure readability and ease of maintenance. 3. Practical file (05) Must have minimum 15 programs from the topics covered in class XI course. 4. Viva voce (05) Viva will be asked from syllabus covered in class XI and the project developed by the student. ( xi )
A Practical Workbook For Computer Science (C++) Class 11th New 2014 40% OFF Publisher : Laxmi Publications ISBN : 9789351380658 Author : Pavithra Karthik Type the URL : http://www.kopykitab.com/product/4 356 Get this ebook