Informatics Practices
Textbook   for   Class XII
                                2024-25
Prelims.indd 1                                    11/26/2020 12:30:29 PM
                   12149 – INFORMATICS PRACTICES                                       ISBN 978-93-5292-361-8
                   Textbook for Class XII
                  First Edition
                                                                              ALL RIGHTS RESERVED
                  December 2020 Agrahayana 1942
                                                            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
                  Reprinted                                  without the prior permission of the publisher.
                  January 2023 Pausha 1944                  This book is sold subject to the condition that it shall not, by
                                                             way of trade, be lent, re-sold, hired out or otherwise disposed
                  March 2024 Chaitra 1946                    of without the publisher’s consent, in any form of binding or
                                                             cover other than that in which it is published.
                                                            The correct price of this publication is the price printed on
                                                             this page, Any revised price indicated by a rubber stamp or
                                                             by a sticker or by any other means is incorrect and should
                  PD 50T SU                                  be unacceptable.
                                                            OFFICES OF THE PUBLICATION
                                                            DIVISION, NCERT
                                                             NCERT Campus
                                                             Sri Aurobindo Marg
                  © National Council of                      New Delhi 110 016                Phone : 011-26562708
                  Educational Research and                   108, 100 Feet Road
                  Training, 2020                             Hosdakere Halli Extension
                                                             Banashankari III Stage
                                                             Bengaluru 560 085                Phone : 080-26725740
                                                             Navjivan Trust Building
                                                             P.O.Navjivan
                                                             Ahmedabad 380 014                Phone : 079-27541446
                                                             CWC Campus
                                                             Opp. Dhankal Bus Stop
                                                             Panihati
                                                             Kolkata 700 114                  Phone : 033-25530454
                                                             CWC Complex
                                                             Maligaon
                   205.00                                    Guwahati 781 021                 Phone : 0361-2674869
                                                          Publication Team
                                                          Head, Publication               :   Anup Kumar Rajput
                                                          Division
                                                          Chief Editor                    :   Shveta Uppal
                                                          Chief Production                :   Arun Chitkara
                  Printed on 80 GSM paper                 Officer
                                                          Chief Business                  :   Amitabh Kumar
                  Published at the Publication Division
                                                          Manager (In charge)
                  by the Secretary, National Council of
                  Educational Research and Training,      Assistant Production            :   Sunil Kumar
                  Sri Aurobindo Marg, New Delhi 110016    Officer
                  and printed at Young Printing Press,
                                                                        Cover and Layout
                  S-119, Site-II, Harsha Compound,
                  Mohan Nagar Industrial Area,                      DTP Cell, Publication Division
                  Ghaziabad (UP)
                                                          2024-25
Prelims.indd ii                                                                                                                 3/11/2024 10:14:42 AM
                 Foreword
                 Information Technology has continuously been crossing the barriers of
                 access and communication and reaching more and more people. The number
                 of internet users in India has been on the rise. The tremendous growth in
                 computer science, telecommunications and information technology has
                 resulted in automation of various tasks and contributed to the ease of
                 living. Technology has made continuous inroads into diverse areas—be it
                 business, commerce, science, sports, health, transportation or education.
                 Today, we are living in an interconnected world where computer based
                 applications influence the way we learn, communicate, commute, or even
                 socialise.
                     With so many users of Information and Communication Technology
                 (ICT), huge volumes of data are continuously generated at an unprecedented
                 rate. Many innovative business models are being evolved which utilise such
                 data to reach potential customers in a more targeted way. Government
                 agencies are also using data to deliver services and fast track progress
                 of different programmes, strengthen accountability and to make more
                 informed decisions. This has been creating better opportunities for our
                 youth not only to enter the field of technical education but also in the
                 world of work. NCERT, for the first time, has developed a textbook on
                 ‘Informatics Practices’ to develop skill sets in students to make use of the
                 opportunities provided by ICT.
                     This book focuses on the fundamental concepts related to handling of
                 data while opening a window to the emerging areas of data processing. It
                 seeks to address the dual challenges of reducing curricular load as well as
                 introducing the latest development in the field of ICT.
                     As an organisation committed to systemic reforms and continuous
                 improvement in the quality of its curricular material, NCERT welcomes
                 comments and suggestions to enable us to bring about necessary changes
                 in its further publications.
                    						
                 							                                                Hrushikesh Senapaty
                                                                                     Director
                 New Delhi 					                              National Council of Educational
                 August 2020					                                      Research and Training
                                                    2024-25
Prelims.indd 3                                                                                  11/26/2020 12:30:29 PM
                 2024-25
Prelims.indd 4             11/26/2020 12:30:29 PM
                 Preface
                    In the present education system of our country, specialised and
                 discipline based courses are introduced at the higher secondary stage.
                 This stage is crucial as well as challenging because of the transition
                 from general to discipline-based curriculum. The syllabus at this stage
                 needs to have sufficient rigour and depth while remaining mindful of the
                 comprehension level of the learners. Further, the textbook should not be
                 heavily loaded with content.
                     We are living in an era where information drives many of our socio
                 economic decisions. Millions of people are accessing internet round the
                 clock for availing various services and thereby generating vast amount of
                 data. Processing of data is becoming a key skill with applications across the
                 disciplines. Thus, study of basic concepts of data handling and analysis
                 is becoming more and more desirable. There are courses offered in the
                 name of Computer Science, Information and Communication Technology
                 (ICT), Information Technology (IT), etc. by various boards and schools up
                 to secondary stage, as optional. These mainly focus on using computer for
                 word processing, presentation tools and application software.
                    Informatics Practices (IP) at the higher secondary stage of school
                 education is also offered as an optional subject. At this stage, students
                 can take up IP with the aim of pursuing a career in data science or related
                 areas after going through professional courses at higher levels. Therefore,
                 at higher secondary stage, the curriculum of IP introduces basics of
                 database management systems and data processing. The book has seven
                 chapters covering the following broader themes:
                    •   SQL Queries: Querying database using the Structured Query
                        Language by applying SQL functions including aggregate functions.
                    •   Data Handling: The popular Python library called Pandas has been
                        introduced. The important data structures of Pandas – Series and
                        DataFrame have been covered in details and basic data handling
                        and data analysis using Pandas are included.
                    •   Data Visualisation: The Pandas library called Pyplot is introduced.
                        It demonstrates how to generate high quality graphs and charts
                        from Python using the Pyplot tool.
                    •   Internet and Web: Introduction to the concepts of Computer
                        networks are given, followed by a brief overview of Internet, its
                        application are given. The concept of web, website, and its hosting
                        is also included.
                    •   Societal Impact: Awareness of digital footprints, data privacy and
                        protection, cyber crime, etiquettes, copyright and plagiarism,
                        E-waste in a digital society and their implications on security,
                        privacy, piracy, ethics, values and health concerns.
                                                    2024-25
Prelims.indd 5                                                                                   11/26/2020 12:30:29 PM
                                                        vi
                       Each chapter has two additional components — (i) activities and
                 (ii) think and reflect for self assessment while learning as well as to generate
                 further interest in the learner. A number of hands-on examples are given to
                 gradually explain methodology to solve different types of problems across
                 the Chapters. The programming examples as well as the exercises in the
                 chapters are required to be solved in a computer and verify with the given
                 outputs.
                     Box items are pinned inside the chapters either to explain related
                 concepts or to describe additional information related to the topic covered
                 in that section. However, these box-items are not to be assessed through
                 examinations.
                     Project Based Learning given at the end includes exemplar projects
                 related to real-world problems. Teachers are supposed to assign these or
                 similar projects to be developed in groups. Working in such projects may
                 promote peer-learning, team spirit and responsiveness.
                     The chapters have been written by involving practicing teachers as well
                 as subject experts. Several iterations have resulted into this book. Thanks
                 are due to the authors and reviewers for their valuable contribution. I would
                 like to place on record appreciation for Professor Om Vikas for leading the
                 review activities of the book as well as for his guidance and motivation
                 to the development team throughout. Comments and suggestions
                 are welcome.
                 New Delhi       Dr. Rejaul Karim Barbhuiya
                 31 August 2020		         Assistant Professor
                                          Central Institute of
                                     Educational Technology
                                                      2024-25
Prelims.indd 6                                                                                      11/26/2020 12:30:29 PM
                 Textbook Development Committee
                 Members
                 Anamika Gupta, Assistant Professor, Shaheed Sukhdev College of Business
                 Studies, University of Delhi
                 Anju Gupta, Freelance Educationist, Delhi
                 Anuradha Khattar, Assistant Professor, Miranda House, University of Delhi
                 Chetna Khanna, Freelance Educationist, Delhi
                 Harita Ahuja, Assistant Professor, Acharya Narendra Dev College,
                 University of Delhi
                 Mohini Arora, HOD (Computer Science), Air Force Golden Jubilee Institute,
                 Subroto Park, Delhi
                 Naeem Ahmad, Assistant Professor, Madanapalle Institute of Technology
                 and Science, Madanapalle, Andhra Pradesh
                 Naveen Gupta, PGT (Computer Science), St. Marks's Sr Sec Public School,
                 Meera Bagh, Delhi
                 Neeru Mittal, PGT (Computer Science), SRDAV Public School, Dayanand
                 Vihar, Delhi
                 Priti Rai Jain, Assistant Professor, Miranda House, University of Delhi
                 Sangita Chadha, HOD (Computer Science), Ambience Public School,
                 Safdarjung Enclave, Delhi
                 Sharanjit Kaur, Associate Professor, Acharya Narendra Dev College,
                 University of Delhi
                 Sugandha Gupta, Assistant Professor, Sri Guru Gobind Singh College of
                 Commerce, University of Delhi
                 Vineeta Garg, PGT (Computer Science), SRDAV Public School, Dayanand
                 Vihar, Delhi
                 Member-Coordinator
                 Rejaul Karim Barbhuiya, Assistant Professor, Central Institute of
                 Educational Technology, NCERT, Delhi
                                                   2024-25
Prelims.indd 7                                                                               11/26/2020 12:30:29 PM
                 Acknowledgements
                 The National Council of Educational Research and Training acknowledges
                 the valuable contributions of the individuals and organisations involved in
                 the development of Informatics Practices textbook for Class XII.
                     The Council expresses its gratitude to the syllabus development team
                 including MPS Bhatia, Professor, Netaji Subhas Institute of Technology,
                 Delhi; T. V. Vijay Kumar, Professor, School of Computer and Systems
                 Sciences, Jawaharlal Nehru University, New Delhi; Zahid Raza, Associate
                 Professor, School of Computer and Systems Sciences, Jawaharlal Nehru
                 University, New Delhi; Vipul Shah, Principal Scientist, Tata Consultancy
                 Services, and the CSpathshala team; Aasim Zafar, Associate Professor,
                 Department of Computer Science, Aligarh Muslim University, Aligarh;
                 Faisal Anwer, Assistant Professor, Department of Computer Science,
                 Aligarh Muslim University, Aligarh; Smruti Ranjan Sarangi, Associate
                 Professor, Department of Computer Science and Engineering, Indian
                 Institute of Technology, Delhi; Vikram Goyal, Associate Professor,
                 Indraprastha Institute of Information Technology (IIIT), Delhi; and Mamur
                 Ali, Assistant Professor, Department of Teacher Training and Non-formal
                 Education (IASE), Faculty of Education, Jamia Millia Islamia, New Delhi.
                    The Council is thankful to the following resource persons for providing
                 valuable inputs in developing this book — D.N. Sansanwal, Retd. Professor,
                 Devi Ahilya Vishwavidyalaya, Indore; Veer Sain Dixit, Assistant Professor,
                 Atma Ram Sanatan Dharma College, University of Delhi; Mukesh Kumar,
                 DPS RK Puram, Delhi; Aswin K. Dash, Mother’s International School,
                 Delhi; Purvi Kumar, Co-ordinator, Computer Science Department, Ganga
                 International School, Rohtak Road, Delhi; Mudasir Wani, Assistant
                 Professor, Govt. College for Women, Nawakadal, Srinagar, Jammu and
                 Kashmir; Sajid Yousuf Bhat, Assistant Professor, University of Kashmir,
                 Jammu and Kashmir; Professor Om Vikas, Formerly Director, ABV-IIITM,
                 Gwalior, MP.
                     The council is grateful to Sunita Farkya, Professor and Head, Department
                 of Education in Science and Mathematics, NCERT and Amarendra P. Behera,
                 Professor and Joint Director, CIET, NCERT for their valuable cooperation
                 and support throughout the development of this book.
                        The Council also gracefully acknowledges the contributions of
                 Meetu Sharma, Graphic Designer cum DTP Operator; Kanika Walecha,
                 DTP Operator; Pooja, Junior Project Fellow in shaping this book. The
                 contributions of the office of the APC, DESM and Publication Division,
                 NCERT, New Delhi, in bringing out this book are also duly acknowledged.
                     The Council also acknowledges the contribution of Ankeeta Bezboruah
                 Assistant Editor (Contractual), Publication Division, NCERT for copy
                 editing this book. The efforts of Rajshree Saini, DTP Operator (Contractual),
                 Publication Division, NCERT are also acknowledged.
                                                    2024-25
Prelims.indd 8                                                                                   11/26/2020 12:30:29 PM
                 Contents
                 Foreword		                                                         iii
                 Chapter 1 Querying     and   SQL Functions                          1
                          1.1    Introduction		                                      1
                          1.2    Functions in SQL                                    4
                          1.3    GROUP BY in SQL                                    14
                          1.4    Operations on Relations                            16
                          1.5    Using Two Relations in a Query                     19
                 Chapter 2 Data Handling       using   Pandas - I                   27
                           2.1 Introduction to Python Libraries          27
                           2.2 Series                                    29
                           2.3 DataFrame                                 40
                           2.4 Importing and Exporting Data between CSV		
                               Files and DataFrames                      55
                           2.5 Pandas Series Vs NumPy ndarray            57
                 Chapter 3 Data Handling       using   Pandas - II                  63
                           3.1 Introduction                               63
                           3.2 Descriptive Statistics                     65
                           3.3 Data Aggregations                          75
                           3.4 Sorting a DataFrame                        77
                           3.5 Group by Functions                         79
                           3.6 Altering the Index                         82
                           3.7 Other DataFrame Operations                 84
                           3.8 Handling Missing Values                    89
                           3.9 Import and Export of Data between Pandas 			
                               and MySQL                                  98
                 Chapter 4 Plotting Data      using    Matplotlib                  105
                           4.1   Introduction                                      105
                           4.2   Plotting using Matplotlib                         106
                           4.3   Customisation of Plots                            108
                           4.4   The Pandas Plot Function (Pandas Visualisation)   112
                                                 2024-25
Prelims.indd 9                                                                            11/26/2020 12:30:29 PM
                                                    x
                  Chapter 5 Internet    and   Web                              137
                            5.1   Introduction to Computer Networks            137
                            5.2   Types of Networks                            139
                            5.3   Network Devices                              142
                            5.4   Networking Topologies                        146
                            5.5   The Internet                                 148
                            5.6   Applications of Internet                     149
                            5.7   Website                                      153
                            5.8   Web Page                                     154
                            5.9   Web Server                                   156
                           5.10   Hosting of a Website                         157
                           5.11   Browser                                      158
                  Chapter 6 Societal Impacts                                   167
                            6.1   Introduction                                 167
                            6.2   Digital Footprints                           168
                            6.3   Digital Society and Netizen                  169
                            6.4   Data Protection                              174
                            6.5   Creative Commons                             178
                            6.6   Cyber Crime                                  179
                            6.7   Indian Information Technology Act (IT Act)   182
                            6.8   E-waste: Hazards and Management              183
                            6.9   Impact on Health                             186
                  Chapter 7 Project Based Learning                             195
                            7.1   Introduction                                 195
                            7.2   Approaches for Solving Projects              196
                            7.3   Teamwork                                     197
                            7.4   Project Descriptions                         199
                                                 2024-25
Prelims.indd 10                                                                      11/26/2020 12:30:29 PM