Computer Science and Python Programming With Practical: CBSE Class XII Textbook
Computer Science and Python Programming With Practical: CBSE Class XII Textbook
net/publication/343125934
Computer Science and Python Programming with Practical: CBSE Class XII
Textbook
CITATIONS READS
0 41,801
2 authors:
Some of the authors of this publication are also working on these related projects:
Design and Development of a Web-Based Learning System with Applications of Fuzzy Logic for Learner’s Performance Evaluation View project
All content following this page was uploaded by Atanu Das on 03 October 2020.
2020
2
Preface
We have the pleasure to bring the book ‘A Textbook of Computer Science and Python Program-
ming with Practical: CBSE Class XII’ for the students of CBSE Class XII who opted the subject
Computer Science (Code No. 083). This course includes both theory and practical as per the attached
syllabus applicable from the academic session 2019-2020.
The book covers both theory and practical works. The whole theory syllabus consisting of four
units (Programming and Computational Thinking – 2, Computer Networks, Data Management - 2,
and Society, Law and Ethics – 2) are grouped into four parts (I-IV) which again divided into sixteen
chapters. Each chapter includes full coverage of the theoretical topics strictly and laboratory works
and assignments as prescribed in the syllabus. Each chapter also includes objectives, a quick recap
(summary), short answer type and descriptive questions with a hint and laboratory worked out as-
signments and exercises. Part V is designed to include solutions to laboratory programming exercises
especially mentioned in the syllabus from Python and SQL programming.
The programming and computational thinking – 2 part is subdivided into nine chapters namely,
Python revision, working with functions, file handling, using Python libraries, recursion, algorithmic
and program efficiency, data visualization using pyplot, data structures I-list, and data structures II-
stack and queue for learning Python programming in more details and data structures using Python.
Computer networks part is subdivided into three chapters namely, introduction to computers net-
works, principles of communications and networking, besides network tools and applications. Data
management – 2 part is subdivided into two chapters namely, SQL commands and Python interfacing,
and web application with Django. Society, law and ethics – 2 part is subdivided into two chapters
namely, ethics and law besides Technology and Society. There are four appendices covering the con-
cepts GUI with Tkinter, concepts of classes and objects in Python, sample model question papers for
periodic tests, midterm (half-yearly), and session ending examinations and five projects implementa-
tions as per practical syllabus.
We have tried to focus on the full coverage of theory and practical syllabus of CBSE-XII (Class 12)
including Python programming, data management, computer networks along with society, law and
ethics with simple and comprehensive illustrations of topics with examples. The illustrations are
mostly self-explanatory, easy to understand, and pedagogically rich with indications of chapter wise
syllabus sections and corresponding chapter objectives. Summary (quick-recap) of presented content
are given at the end of all the chapters and keywords are highlighted (bold) for quick understanding
besides memorizing. Conceptual question-answers are included in each chapter to present tricky con-
cepts. Chapter wise review questions (with hints) following board examination patterns are also given
3
for practice besides inclusion of chapter wise solved practical assignments to promote self-learning.
Solved exercises for practical works are also provided according to practical syllabus. More than 250
solved programs of Python and SQL are incorporated along with projects implementations with Py-
thon & SQL. Model question papers are given for periodic tests, midterm (half-yearly), and session
ending examinations preparation. We have also included two appendices to introduce the concepts of
GUI programming besides classes and objects concepts in Python.
************* ****************
4
Salient Features of this Book
1. Full coverage of theory and practical syllabus of CBSE-XII including Python pro-
gramming, data management, computer networks along with society, law and
ethics.
8. Chapter wise review questions (with hints) following board examination patterns.
14. Model question papers of periodic tests, midterm (half-yearly), and session ending
examinations for practice.
************* ****************
5
Acknowledgment
We would like to thank our students who are our source of inspiration that drive us to develop
this book keeping in mind their academic requirements in changing educational scenario. We would
like to thank our Director and Principal for the opportunity to teach this subject. We would like also
to express our sincere gratitude to all our colleagues for their wonderful academic association and
supports. However, our family member deserves the most gratitude for their sacrifice to make this
project successful. Their sacrifices and cooperation are beyond our expectations.
We hope this book will fulfill the requirements and expectations of our intended students and
their teachers. Even then, if some anomalies appeared, we feel extremely sorry for those unintentional
mistakes. Suggestions for improvement of this book may be sent to the following e-mail addresses.
Atanu Das
E-Mail: atanudas75@gmail.com
Rajkumar Patra
E-Mail: rajkr.patra@gmail.com
2020
************* ****************
6
Syllabus
Computer Science (New)
CLASS-XII (Code No. 083)
2019-20
1. Prerequisites
Computer Science- Class XI
2. Learning Outcomes
1. Understand the concept of functions and recursion.
2. Learn how to create and use Python libraries.
3. Learn file handling.
4. Learn about the concept of efficiency in algorithms and computing in general.
5. Learn basic data structures: lists, stacks, and queues.
6. Get a basic understanding of computer networks: network stack, basic network hardware, basic
protocols, and basic tools.
7. Connect a Python program with an SQL database, and learn aggregation functions in SQL.
8. Have a clear understanding of cyber ethics and cybercrime. Understand the value of technolo-
gy in societies, gender and disability issues, and the technology behind biometric ids.
3. Distribution of Marks
4.1 Unit 1: Programming and Computational Thinking (PCT-2) (80 Theory + 70 Practical)
Revision of the basics of Python
Functions: scope, parameter passing, mutable/immutable properties of data objects, pass
arrays to functions, return values, functions using libraries: mathematical, and string func-
tions.
File handling: open and close a file, read, write, and append to a file, standard input, out-
put, and error streams, relative and absolute paths.
Using Python libraries: create and import Python libraries
Recursion: simple algorithms with recursion: factorial, Fibonacci numbers; recursion on ar-
rays: binary search
Idea of efficiency: performance defined as inversely proportional to the wall clock time,
count the number of operations a piece of code is performing, and measure the time taken
7
by a program. Example: take two different programs for the same problem, and understand
how the efficient one takes less time.
Data visualization using Pyplot: line chart, pie chart, and bar chart.
Data-structures: lists, stacks, queues.
8
5. Practical
9
Open a webpage using the urllib library.
Compute EMIs for a loan using the numpy or scipy libraries.
Take a sample of 10 phishing e-mails and find the most common words.
6. Project
The aim of the class project is to create something that is tangible and useful. This should be done in
groups of 2 to 3 students, and should be started by students at least 6 months before the submission
deadline. The aim here is to find a real world problem that is worthwhile to solve. Students are en-
couraged to visit local businesses and ask them about the problems that they are facing. For example, if
a business is finding it hard to create invoices for filing GST claims, then students can do a project that
takes the raw data (list of transactions), groups the transactions by category, accounts for the GST tax
rates, and creates invoices in the appropriate format. Students can be extremely creative here. They can
use a wide variety of Python libraries to create user friendly applications such as games, software for
their school, software for their disabled fellow students, and mobile applications. Of course to do some
of this projects, some additional learning is required; this should be encouraged. Students should
know how to teach themselves.
If three people work on a project for 6 months, at least 500 lines of code is expected. The committee has
also been made aware about the degree of plagiarism in such projects. Teachers should take a very
strict look at this situation, and take very strict disciplinary action against students who are cheating
on lab assignments, or projects, or using pirated software to do the same. Everything that is proposed
can be achieved using absolutely free, and legitimate open source software.
************* ****************
10
Contents
Chapter 2: Functions
Syllabus and Chapter Objectives
2.1 Introduction
2.2 Function Definition
2.3 Function Call
2.3.1 Flow of Execution in Function Call
2.3.2 Parameters Passing
2.4 Function Arguments
2.4.1 Required Arguments
2.4.2 Keyword Arguments
11
2.4.3 Default Arguments
2.4.4 Variable-length Arguments
2.5 The return Statement
2.6 Variable Scope and Lifetime
2.6.1 Local and Global Variables
2.6.2 Using the Global Statement
2.7 Functional Programming and Lambda Functions
2.7.1 The map() Function
2.7.2 The filter() Function
2.7.3 The reduce() Function
2.8 Mathematical and String Functions
Quick Recap
Conceptual Questions and Answers
Review Questions
Lab Exercises
Chapter 5: Recursion
Syllabus and Chapter Objectives
5.1 Introduction
5.2 Recursive Functions
5.3 How Does Recursion Work?
5.4 Some Recursive Algorithms
5.4.1 Finding Factorial
5.4.2 Fibonacci Numbers
5.4.3 Binary Search
5.5 Tail Recursion
5.6 Recursion vs. Iteration
Quick Recap
Conceptual Questions and Answers
Review Questions
Lab Exercises
16
Chapter 11: Principles of Communications and Networking
Syllabus and Chapter Objectives
11.1 Introduction
11.2 Modulation Techniques
11.2.1 Amplitude Modulation
11.2.2 Frequency Modulation
11.2.3 Phase Modulation
11.3 Access Control Techniques
11.3.1 CSMA
11.3.2 CSMA/CD
11.3.3 CSMA/CA
11.4 Error Detection Techniques
11.4.1 Simple Parity Check
11.4.2 Two-Dimensional Parity Check
11.4.3 Checksum
11.5 Network Addresses
11.5.1 MAC Address
11.5.2 IP Address
11.5.3 Port Address
11.6 Idea of Routing
11.7 Transmission Control Protocol
11.7.1 Error Control in TCP
11.7.2 Congestion Control in TCP
11.8 DNS and URLs
11.8.1 Uniform Resource Locator (URL)
11.8.2 Domain Name System
11.9 Mobile Communication Technologies
11.9.1 1G
11.9.2 2G
11.9.3 3G
11.9.4 4G
11.9.5 5G
11.10 Wi-Fi Technology
Quick Recap
Conceptual Questions and Answers
Review Questions
Lab Exercises
Appendices
Appendix-I: GUI with Tkinter
Appendix-II: Classes and Objects in Python
Appendix-III: Model Question Papers
Appendix-IV: Projects
1. GST Invoice Generation
2. Software for School
3. Software for Disabled
4. Game Development
5. Mobile Application
************* ****************
21
Authors BIOGRAPHY:
Dr. Atanu Das is the HOD, Department of MCA, Netaji Subhash Engineering
College under the Maulana Abul Kalam Azad University of Technology,
West Bengal, India. Formerly, he was HOD, Department of CSE, In-Charge,
Department of IT and Coordinator-M.Tech (CSE) for more than 6 years. He
received his M.Sc. (Gold Medal) degrees from The University of Burdwan
and M.E. and Ph.D. (Engineering) degrees from Jadavpur University, India.
Dr. Das has been teaching at UG and PG courses for more than 19 years along with supervis-
ing M.Tech. and Ph.D. research students. He has more than 57 publications in reputed
refereed journals, edited volumes and conference proceedings, and authored 8 text/reference
books. He serves as a reviewer for many peer-reviewed international journals, international
conferences, and edited book chapters. He is the recipient of Adarsh Vidya Saraswati
Rashtruya Puraskar-2019 and IMFR Best Scientist Award-2019, and InSc Research Excellence
Award-2020, VDGOOD Outstanding Scientist Award-2020. His research interest includes var-
ious fields of computer science including estimation for evolving systems, pedagogies and
learning technologies, multimedia processing, steganography, machine learning, and data sci-
ences.
************* ****************
22