Computer Science: and Python Programming With Practical
Computer Science: and Python Programming With Practical
Computer Science
and Python Programming with Practical
2020
2
Preface
We have the pleasure to bring the book ‘A Textbook of Computer Science and Python Program-
ming with Practical: CBSE Class XI’ for the students of CBSE Class XI 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 (Computer Systems and Organisation, Computational Thinking and Programming, Data Man-
agement - 1, and Society, Law and Ethics – 1) are grouped into four parts (I-IV) which again divided
into eighteen chapters. Each chapter includes full coverage of the theoretical topics strictly and labor-
atory 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 assignments and exercises. Part V is designed to include solutions to laboratory program-
ming exercises especially mentioned in the syllabus from Python and SQL programming.
The Computer Systems and Organisation unit is subdivided into four chapters namely, Computer
System & Organisation, Representation of Data, Boolean Logic, and Program Execution. Computational
Thinking and Programming unit is subdivided into ten chapters for learning Python programming
newly introduced in the syllabus. Python is a simple, high level, interactive, interpreted and object ori-
ented scripting language designed to be highly readable since it uses English keywords frequently
whereas the other languages use punctuations. Moreover, it has fewer syntactical constructions than
other languages. Nonetheless, Python is free open source software with highly rich libraries and
frameworks to facilitate most of the computational problem solving requirements in the present time.
The latest industry accepted this technology and promoting this language so that it already became
number one according to the developer’s choice. The Data Management – 1 unit is subdivided into
three chapters namely, Database Concept, Structured Query Language and MYSQL, and NoSQL Data-
base and MongoDB to present the database concepts and its implementation through SQL and NoSQL
languages. The Society, Law, and Ethics – 1 unit is covered in a single chapter called Cyber Safety.
There are four appendices covering the installation of Python IDEs, MySQL, NoSQL (MongoDB)
software, sample model question papers for periodic tests, midterm (half-yearly), and session ending
examinations, table of EBCDIC, ASCII, and EASCII.
Atanu Das
Rajkumar Patra
3
4
Salient Features of this Book
1. Full coverage of theory and practical syllabus of CBSE-XI including computer or-
ganization, Python programming, data management, and cyber safety.
8. Chapter wise review questions (with hints) following board examination patterns.
12. More than 250 solved programs of Python, SQL and NoSQL.
13. Model question papers for periodic tests, midterm (half-yearly), and session end-
ing examinations.
14. Guidance for installation of Python IDEs, MySQL, NoSQL (MongoDB) software.
************* ****************
5
Acknowledgment
We would like to thank our students who are our source of inspiration that drive us to develop
this bookkeeping 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
************* ****************
6
Syllabus
Computer Science (New)
CLASS-XI (Code No. 083)
2019-20
Learning Outcomes:
1. Ability to understand basic computational thinking.
2. Ability to understand the notion of data types, data structures.
3. Ability to appreciate the notion of an algorithm, and understand its structure, in-
cluding how algorithms handle corner cases.
Unit Periods
Unit Name Marks
No. Theory Practical
1. Computer Systems and Organisation 10 10 2
2. Computational Thinking and Programming 35 60 45
3. Data Management - 1 15 30 23
4. Society, Law, and Ethics - 1 10 10 --
Total 70 110 70
Basic computer organisation: description of a computer system and mobile system, CPU,
memory, hard disk, I/O, battery.
Types of software: application, System, utility.
Memory Units: bit, byte, MB, GB, TB, and PB.
Boolean logic: OR, AND, NAND, NOR, XOR, NOT, truth tables, De Morgan’s laws
Information representation: numbers in base 2, 8, 16, binary addition
Strings: ASCII, UTF8, UTF32, ISCII (Indian script code), Unicode Basic concepts of
Flowchart
Concept of Compiler & Interpreter
Running a program: Notion of an operating system, how an operating system runs a pro-
gram, idea of loading, operating system as a resource manager.
7
Concept of cloud computing, cloud (public/private), introduction to parallel computing.
Familiarization with the basics of Python programming: a simple “hello world" program, the
process of writing a program (Interactive & Script mode), running it, and print statements;
simple data-types: integer, float, string
Features of Python, Python Character Set, Token & Identifiers, Keywords, Literals, Delimit-
ers, operators.
Comments: (Single line & Multiline/ Continuation statements), Clarity & Simplification of
expression.
Introduce the notion of a variable, and methods to manipulate it (a concept of L-value and
R-value even if not taught explicitly).
Knowledge of data types and operators: accepting input from the console, assignment
Conditional statements: if, if-else, if-elif-else; simple programs: e.g.: absolute value, sort 3
numbers, and divisibility.
Notion of iterative computation and control flow: for(range(), len()), while, flowcharts, sug-
Lists, tuples, and dictionary: finding the maximum, minimum, mean; linear search on
list/tuple of numbers, and counting the frequency of elements in a list using a dictionary. In-
troduce the notion of accessing elements in a collection using numbers and names.
Sorting algorithm: bubble and insertion sort; count the number of operations while sorting.
Strings: Traversing, compare, concat, substring.
Introduction to Python modules: Importing math (sqrt, cell, floor, pow, fabs, sin, cos, tan,
random (random, randint, randrange), statistics (mean, median, mode) modules.
8
Unit 3: Data Management
Relational databases: Concept of a database, relations, attributes and tuples, keys- candidate
key, primary key, alternate key, foreign key; Degree and cardinality of a table.
Use SQL – DDL/ DML commands to CREATE TABLE, INSERT INTO,
UPDATE TABLE , DELETE FROM, ALTER TABLE,MODIFY TABLE, DROP TABLE, keys,
and foreign keys; to view content of a table: SELECT-FROM-WHERE-ORDER BY along
with BETWEEN, IN, LIKE, (Queries only on single table).
Aggregate functions – MIN, MAX, AVG, COUNT, SUM.
Basics of NoSQL databases.
Appropriate usage of social networks: spread of rumours, and common social networking
************* ****************
9
Practical
Marks
S Unit Name
(Total=30)
1. Lab Test (12 marks)
Python program (60% logic + 20% documentation + 20% code quality) 8
SQL program (at least 4 queries) 4
2. Report File + viva (10 marks)
Report file: Minimum 20 Python programs and 8 SQL commands 7
Viva voce (based on the report file) 3
Project (that uses most of the concepts that have been learned)
3. 8
(See CS-XII for the rules regarding the projects)
2. Programming in Python: At least the following Python concepts should be covered in the
lab sessions: expressions, conditionals, loops, list, dictionary, and strings. The following are
some representative lab assignments.
o Find the largest and smallest numbers in a list. Find the third largest number in a list.
3. Data Management: SQL Commands At least the following SQL commands should be cov-
ered during the labs: create, insert, delete, select, and join. The following are some
representative assignments.
o Create a student table with the student id, name, and marks as attributes where the stu-
dent id is the primary key.
o Insert the details of a new student in the above table.
o Delete the details of a particular student in the above table.
o Use the select command to get the details of the students with marks more than 80.
o Create a new table (name, date of birth) by joining two tables (student id, name) and
(studentid, date of birth).
o Create a new table (order ID, customer Name, and order Date) by joining two tables
(order ID, customer ID, and order Date) and (customer ID, customer Name, contact
Name, country).
************* ****************
10
Contents
11
2.4.4 Hexadecimal Number System
2.5 Addition and Subtraction of Binary Numbers
2.6 Internal Storage of Characters with Text Codes
2.6.1 BCD and EBCDIC
2.6.2 ASCII and Extended ASCII
2.6.3 Unicode
2.6.4 ISCII
2.7 Data Compression
Quick Recap
Conceptual Questions and Answers
Review Questions
Chapter 9: Lists
Syllabus and Chapter Objectives
9.1 Introduction
9.2 Creating Lists
9.2.1 Creating Lists using list() Function
9.2.2 Creating Lists using User Input
9.3 Accessing Lists
9.3.1 Accessing Lists using Index
9.3.2 Accessing Lists using Slice
9.4 Updating Lists
9.4.1 Updating Lists using Index
9.4.2 Updating Lists using append() Method
9.4.3 Updating Lists using extend() Method
9.4.4 Updating Lists using insert() Method
9.5 Traversing Lists
9.6 Deleting List Elements
9.6.1 Deleting List Elements using del Statement
9.6.2 Deleting List Elements using remove() Method
9.6.3 Deleting List Elements using clear() Method
9.7 Basic Lists Operations
9.7.1 Concatenation
9.7.2 Repetition
9.7.3 Membership
9.8 Lists Functions and Methods
9.8.1 len() function
16
9.8.2 max() function
9.8.3 min() function
9.8.4 sorted() function
9.8.5 count() method
9.8.6 index() method
9.8.7 pop() method
9.8.8 reverse() method
9.8.9 sort() method
9.8.10 copy() method
Quick Recap
Conceptual Questions and Answers
Review Questions
Lab Exercises
Appendices
************* ****************
22
Authors BIOGRAPHY:
************* ****************
23