Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
100% found this document useful (1 vote)
221 views

Textbook - Informatics With Python

A very good manual for teachers teaching Computer Science or Informatics in schools of any boards.

Uploaded by

KOUSIK BISWAS
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
221 views

Textbook - Informatics With Python

A very good manual for teachers teaching Computer Science or Informatics in schools of any boards.

Uploaded by

KOUSIK BISWAS
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 55

TEACHER’S MANUAL

INFORMATICS PRACTICES
(CLASS XI)

Chapter 1: Computer System


1. A computer is an electronic device that takes input from the user in the form of data and instructions,
processes this data and produces the result (output) as information.

2. Arithmetic Logic Unit (ALU): All calculations and comparisons are made in this unit. The ALU
performs the arithmetic (+, -, *, /) and logical (AND, OR, NOT, XOR) operations. It receives input data
from the memory, performs specific operations (addition, subtraction, etc.) and the result is returned to
the memory.

3. Control Unit (CU): CU controls the flow of data from input devices to memory and from memory
to output devices. It controls and guides the interpretation, flow and manipulation of all data and
information. It does not process the data; instead, it sends control signals to ALU and memory for
carrying out the required operations.

4. Software is a set of programs that are designed to perform a well-defined function. A program is a
sequence of instructions written to solve a particular problem and to make the hardware run. All the
programs used in a computer to perform specific tasks are called software.

5. Here are some examples of hardware components commonly found in computer equipment:
(a) Central Processing Unit (CPU) – the ‘brain’ of the computer that processes data and instructions.
(b) Random Access Memory (RAM) – a type of memory that temporarily stores data and instructions
for the CPU to access quickly.
(c) Hard Disk Drive (HDD) – a storage device that stores data and programs even when the computer
is turned off.
(d) Motherboard – a circuit board that connects all computer components.
(e) Display – a monitor or screen that displays the output of the performed operation.
(f) Keyboard – an input device that allows the user to input text and commands.
(g) Mouse – an input device that allows the user to control the cursor and navigate the computer.
6. (a) To output audio: Speakers
(b) To enter textual data: Keyboard
(c) To make a hard copy of a text file: Printer
(d) To display the data or information: Monitor, projector
(e) To enter the audio-based command: Microphone
(f) To build 3D models: 3D printer
(g) To assist a visually impaired individual in entering data: Braille keyboard

7. Hardware and software are two essential components of a computer system and are interdependent.
Hardware refers to the physical components of a computer system, such as the CPU, memory, hard drive,
keyboard, mouse and monitor. On the other hand, software refers to the programs and applications that
run on the hardware.

Without hardware, the software cannot be used. Software needs hardware to run and perform its
functions. For example, a software application like Microsoft Word needs the hardware components
of a computer, such as the CPU, RAM and hard drive, to run and operate. Without these hardware
components, the software cannot function.
2 Teacher’s Manual—Informatics Practices with Python–XI

Similarly, hardware is of no use without software. Hardware needs software to control and manage
its operations. For example, the hardware components of a printer, such as the print head and ink
cartridges, need software drivers to operate and communicate with the computer. Without the software
drivers, the printer cannot function.

8. The software can be broadly classified into four types depending on their functions and user requirement:
(a) System Software
(b) Application Software
(c) Utility Software
(d) Programming Tools
• System software: System software manages and controls a computer system's hardware and
other software components. Examples include operating systems like Windows, macOS and
Linux.
• Application software: Application software is designed to perform specific tasks or functions,
such as word processing, accounting, or graphics. Examples include Microsoft Office, Adobe
Photoshop and QuickBooks.
• Utility software: Utility software is used to maintain and optimize the performance of a
computer system. Examples include antivirus software, disk cleaners and file compression
tools like WinZip.
• Programming tools: Programming software is used to write, debug and develop software
programs. Examples include compilers, debuggers and integrated development environments
(IDEs) like Visual Studio and Eclipse.

9. An operating system (OS) is a program that acts as an interface between the user and the hardware of
the computer. The OS helps to manage the resources of the computer and optimize its performance. An
OS is the first program to be executed on a computer after the BIOS (Basic Input Output System). OS
performs all basic tasks such as identifying basic input/output devices, accepting input from the input
devices, sending results to the output devices, keeping track of files and directories on the disk and
controlling other peripheral devices such as disk drives and printers.

Two popular operating systems are:


(a) Microsoft Windows
(b) Apple macOS

10. UNITS OF MEMORY


S. No. Unit Description
(i) Bit Binary Digit = 1 Bit
(ii) Byte 1 Byte = 8 Bits
(iii) Kilobyte (KB) 1 KB = 1024 Bytes
(iv) Megabyte (MB) 1 MB = 1024 KB
(v) Gigabyte (GB) 1 GB = 1024 MB
(vi) Terabyte (TB) 1 TB = 1024 GB
(vii) Petabyte (PB) 1 PB = 1024 TB
(viii) Exabyte (EB) 1 EB = 1024 PB
(ix) Zettabyte (ZB) 1 ZB = 1024 EB
(x) Yottabyte (YB) 1 YB = 1024 ZB
(xi) Brontobyte (BB) 1BB = 1024 YB
(xii) Geopbyte 1 Geop Byte = 1024 BB

11. The output unit is formed by the output devices attached to the computer. Output devices produce the
output generated by the CPU in human-readable form. These devices can also be used to store the
result for further use.
Teacher’s Manual—Informatics Practices with Python–XI3

Here are some examples of output devices:


(a) Monitor: A visual display unit that shows the output in the form of text, images and videos.
(b) Printer: An output device that prints text or graphics on paper.
(c) Speaker: An audio output device that produces sound.
(d) Plotter: A specialized output device that produces high-quality graphics and designs on paper.

12. Impact printers are a type of printer that works by physically striking an inked ribbon against the
paper to create an image or text. They are often used in environments that require multipart forms or
where carbon copies are needed.

Here are some types of impact printers:


(a) Dot-matrix printers
(b) Daisy-wheel printers
(c) Line printers

13. A laser printer is a type of non-impact printer that uses laser technology to produce high-quality text
and graphics on paper. It works by using a laser beam to create an electrostatic image or pattern on
a photosensitive drum, which is then developed with toner particles and transferred onto paper. The
toner is then fused onto the paper with heat and pressure to create a permanent image.

14. Touch Screen: This type of display screen allows interaction with a computer through a touch-sensitive
transparent panel covering the entire screen without any intermediate device. The touch screen uses a
technology that enables the user to touch the screen with their fingers to select objects. Touch screens
are mostly found in systems such as ATMs and mobile devices where the user needs to choose from a
given list. Such systems are also being used at shopping malls, amusement parks and airports.

15. Plotters are the output devices that are used for producing good-quality images and drawings. Unlike
printers, they support the printing of large-sized papers. They are mainly used in Computer-aided
Designing (CAD).

Here are some different types of plotters:


(a) Pen plotters
(b) Electrostatic plotters
(c) Inkjet plotters
(d) Thermal plotters
(e) Cutting plotters

16. Secondary storage devices are used to store a large amount of data permanently which is not possible
by using the primary or main memory. The amount of data a disk can hold is defined as disk capacity,
which is measured in terms of bytes, kilobytes (KB), megabytes (MB) and so on. Some of the common
secondary storage devices are as follows:
(a) Blu-ray Disc (BD
(b) Compact Disc
(c) USB/Pen Drive
(d) Memory Cards
(e) Hard Disk

17. The major difference between optical and magnetic discs is in the way they store data.

Optical discs use a laser to read and write data, while magnetic discs use magnetic fields to store and
retrieve data. The laser on an optical disc reads tiny bumps and valleys on the surface of the disc that
represent binary code. The most common types of optical discs are CD, DVD and Blu-ray discs.
4 Teacher’s Manual—Informatics Practices with Python–XI

Magnetic discs, on the other hand, use magnetic fields to store data on a spinning disk. The read/write
head on a magnetic disk writes data to the disk by magnetizing tiny areas of the disk surface in specific
patterns. The most common types of magnetic disks are hard disk drives (HDDs).

18. Compact Disc (CD): It is a thin optical disc which is commonly used to store audio and video data. The
capacity of a standard 120 mm CD is 700 MB. Originally, CD-ROM drives had a transfer rate of only
150 KB/s which was very low. The latest CD-ROM drives can transfer up to 72x, i.e., 10,800 KB/sec.

19. The statement "Functioning of a computer is similar to the way the human brain functions" suggests
that there are similarities between the way a computer processes information and the way the human
brain works.

Computers and human brains both receive and process information through a series of interconnected
pathways. In the case of computers, this is done through electrical signals that travel through circuits
and wires, while in the case of the human brain, it is done through neural pathways and connections
between neurons.

Both computers and human brains can store and retrieve information. In the case of computers, this
is done through hard drives and other storage devices, while in the case of the human brain, it is done
through the process of memory.

20. The basic architecture of a computer consists of the following components:


(a) Central Processing Unit (CPU): The CPU is the "brain" of the computer and is responsible
for executing instructions. It consists of an arithmetic and logic unit (ALU), a control unit and
registers.
(b) Memory: The memory is used to store data and instructions that the CPU needs to access quickly.
There are two types of memory – primary memory (RAM) and secondary memory (hard disk, SSD).
(c) Input devices: Input devices, such as a keyboard, mouse, or touchpad, allow users to interact with
the computer by providing input.
(d) Output devices: Output devices, such as a monitor or printer, display or print the results of the
computer's processing.
(e) Storage devices: Storage devices, such as hard disks, SSDs, or USB drives, are used to store data
and programs.

21. An input unit is a device that allows the user to input data or instructions into a computer. This data
can be in various forms such as text, images, audio, or video. Examples of input devices include a
keyboard, mouse, touchpad, scanner, microphone and camera.

The significance of an input unit is that it enables the user to interact with the computer and provide
it with the necessary instructions and data. Without an input unit, the computer would not be able to
receive any input from the user, making it impossible to perform any useful task.

22. Central Processing Unit (CPU) is the control centre or brain of a computer. It guides, directs, controls
and governs all the processing that takes place inside the computer. The CPU consists of three
components— ALU, CU and Registers.
(a) Arithmetic Logic Unit (ALU): All calculations and comparisons are made in this unit. The ALU
performs the arithmetic (+, -, *, /) and logical (AND, OR, NOT, XOR) operations. It receives the
input data from the memory, performs specific operations (addition, subtraction, etc.) and the result
is returned to the memory. The result of the logical operations is either true or false and helps the
computer in decision-making.
(b) Control Unit (CU): CU controls the flow of data from input devices to memory and from memory
to output devices. It controls and guides the interpretation, flow and manipulation of all data and
information. It does not process the data; instead, it sends control signals to ALU and memory for
carrying out the required operations.
Teacher’s Manual—Informatics Practices with Python–XI5

(c) Registers: Registers are high-speed temporary storage areas found in the CPU. Registers work
as per the instructions given by the control unit (CU), storing instructions and data, immediately
required for operation.

23. CU controls all the functions like input, output, storage and process. It instructs ALU which operation
is to be carried out. So, the control unit is referred to as the central controller of a computer.

24. An Arithmetic and Logic Unit (ALU) in a computer works in coordination with other units, primarily
the control unit and the memory unit.

The ALU is responsible for performing arithmetic and logical operations, such as addition, subtraction,
multiplication, division and comparison. However, it does not function independently as it needs
instructions and data from memory and the control unit directs its operations.

The control unit retrieves instructions from memory and sends them to the ALU to perform the
appropriate operation. After the operation is completed, the result is stored back in memory or sent to
the output unit for display.

25. Data is defined as raw facts and figures that does not have any meaning. In other words, data refers to
raw facts, numbers, symbols or characters that are not organized or processed in any meaningful way.
However, this data can be organized or processed to transform it into useful information.

Information is defined as a collection of data that is organized in a particular manner to generate some
meaning. In other words, information provides knowledge, meaning and relevance to the data, making
it valuable and useful to users.

26. The main difference between an impact and a non-impact printer is the way they print.

An impact printer uses a physical impact mechanism to transfer ink or toner onto the paper. It has a
print head that strikes a ribbon to create an image on the paper. Dot matrix printers and line printers
are examples of impact printers.

A non-impact printer does not use a physical impact to transfer ink or toner onto the paper. It uses
various methods such as inkjet, laser, or thermal printing to create an image. Non-impact printers
are generally faster and quieter than impact printers. Examples of non-impact printers include inkjet
printers, laser printers and thermal printers.

27. (a) Light Pen: A light pen is a pointing device that is used to select and manipulate objects on a
computer screen. It is a light-sensitive stylus that is held like a pen and is pointed at the screen.
When the pen is pointed at a particular area of the screen, it emits a signal that is detected by the
computer.
(b) CD-ROM: A CD-ROM (Compact Disc Read-Only Memory) is a type of optical storage device that is
used to store data, software, music and video. It looks like a regular CD but can hold much more
data. A CD-ROM drive is required to read the data stored on a CD-ROM and the data can only be
read and not written or erased. CD-ROMs were widely used in the 1990s and early 2000s but have
largely been replaced by other forms of storage such as DVDs and USB drives.
(c) DVD: A DVD (Digital Versatile Disc) is a type of optical storage device that is used to store high-
quality video, audio and other digital data. It is similar in appearance to a CD but can store much
more data, up to 8.5 GB for a dual-layer DVD. A DVD drive is required to read and write data to
a DVD. DVDs are commonly used to distribute movies, TV shows, software and games. DVDs have
largely been replaced by Blu-ray discs and digital streaming services, but they are still widely used
for data backup and storage.
6 Teacher’s Manual—Informatics Practices with Python–XI

28. Hardware components are physical entities that can be touched and seen. They are tangible and can be
upgraded, replaced or repaired if they become faulty. Hardware components can be divided into internal
and external components. Internal components are those that are housed inside the computer case,
such as the motherboard, CPU, memory and hard drive. External components include devices that are
connected to the computer system, such as printers, scanners and other peripherals.

Software components are intangible and cannot be touched. They are programs and instructions that
are stored on the hard drive or other storage devices. Software components can be classified into system
software and application software. System software includes the operating system, device drivers and
utilities that are necessary for the computer to operate. Application software includes programs that
perform specific tasks, such as word processing, spreadsheets, graphics design and multimedia editing.

29. Freeware software refers to computer software that is available for free, without any cost or obligation
to pay. This type of software can be downloaded, installed and used by anyone without any restrictions
and can be used for personal or commercial purposes.

30. The various categories of printers are as follows:


(a) Dot Matrix Printer
(b) Inkjet/Desk Jet/Bubble Jet Printers
(c) Laser Printers

31. The need for RAM arises because the processor (CPU) in a computer can access data from RAM much
faster than it can access data from the hard drive or other types of storage. This means that having
more RAM can significantly improve the performance of a computer, allowing it to run more programs
at once and perform tasks more quickly.

RAM differs from ROM (Read-Only Memory) in several ways. ROM is a type of memory that is used
to store data that is essential for the computer to function, such as the firmware that controls the
computer's boot process. Unlike RAM, ROM is non-volatile, which means that it retains its data even
when the computer is turned off.

32. Proprietary software and freeware software are two different types of computer software. Here are the
main differences and two examples of each:
(a) Proprietary software: Proprietary software is developed by a company and is typically licensed
for use for a fee. The source code is not available to the public and users are not allowed to modify
or distribute the software without permission. Examples of proprietary software include:
• Microsoft Windows: A widely used operating system developed by Microsoft that is licensed for
use for a fee.
• Adobe Photoshop: A popular image editing software developed by Adobe that is available for
purchase.
(b) Freeware software: Freeware software is available for free, without any cost or obligation to pay.
The software can be downloaded, installed and used by anyone without any restrictions. Examples
of freeware software include:
• Mozilla Firefox: A popular web browser developed by the Mozilla Foundation that is available
for free download.
• VLC Media Player: A media player that can play a wide range of audio and video formats,
developed by the VideoLAN project and available for free download.
Teacher’s Manual—Informatics Practices with Python–XI7

33. Memory cards are small, portable storage devices used to store digital data, such as photos, videos
and music files. They are commonly used in cameras, smartphones, tablets and other portable devices.
Memory cards use flash memory technology to store data and come in various sizes, capacities and
formats. In this response, we will discuss the different types of memory cards.
(a) Secure Digital (SD) Cards
(b) MicroSD Cards
(c) CompactFlash (CF) Cards

34. To convert these into bytes, we will use the following conversion factors:

1 MB = 1,048,576 bytes
1 GB = 1,073,741,824 bytes
1 TB = 1,099,511,627,776 bytes
(a) 2 MB = 2 x 1,048,576 bytes = 2,097,152 bytes
(b) 3.7 GB = 3.7 x 1,073,741,824 bytes = 3,978,742,712 bytes
(c) 1.2 TB = 1.2 x 1,099,511,627,776 bytes = 1,319,587,573,504 bytes

35. When we throw away electronic gadgets that are non-functional, several security threats can arise.
Some of these security threats include:
(a) Data theft
(b) Identity theft
(c) Environmental damage
(d) Counterfeit and fraud

36. (a) To store data permanently – Hard Disk


(b) To execute the program – RAM
(c) To store the instructions which cannot be overwritten – ROM

Chapter 2: Getting Started with Python


1. Python was first released on February 20, 1991, by its creator, Guido van Rossum. The initial release
was Python 0.9.0, which was a successor to the ABC language.

2. Python was developed by Guido van Rossum, a Dutch programmer, in the late 1980s and early 1990s.

The design of Python was influenced by two programming languages: ABC and Modula-3. ABC was a
language designed for teaching programming concepts and it had an easy-to-learn syntax and interactive
shell. Modula-3, on the other hand, was a systems programming language that had a strong module
system and support for low-level programming.

3. Python is free and open source means that anyone can download, use, modify and distribute the Python
programming language without any licensing fees or legal restrictions. This means that Python's source
code is available for anyone to access, modify and distribute as per their requirements.

4. Yes, Python is a case-sensitive programming language, which means that it distinguishes between
uppercase and lowercase letters. For example, the variable name and Name are two different variables
in Python.

5. IDLE is a simple Integrated Development Learning Environment that comes with Python. The most
important feature of IDLE is that it is a program that allows the user to edit, run, browse and debug a
Python program from a single interface.

6. In Python, displaying and printing are two ways to output information to the user. Here are the main
differences between these two methods:
8 Teacher’s Manual—Informatics Practices with Python–XI

(a) Displaying refers to outputting information directly to the console or terminal. This can be done
using the print() function, which writes the specified data to the standard output stream. The data
can be a string, number, or other object that can be converted to a string.
(b) Printing refers to sending output to a physical printer device.

7. Salient Features of Python are:


(a) Simple and Easy: Python is a simple language that is easy to learn.
(b) Free/Open Source: Anybody can use Python without the need to purchase a license.
(c) High-level Language: Being a high-level language, it can be easily understood by the user without
the need to be concerned with low-level details.
(d) Portable: Python codes are machine and platform independent.
(e) Extensible and Embeddable: Python programs support the usage of C/C++ codes.
(f) Standard Library: Python standard library contains pre-written tools for programming.

8. Cross-platform software is software that can run on multiple operating systems or platforms without
requiring modification. In the context of Python, it means that Python programs can be written once
and run on multiple platforms, such as Windows, Linux and macOS, without making any changes to
the code.

9. Python offers the following advantages:


(a) Platform-Independent: It is platform-independent and can run across different operating
systems/platforms like Windows, Linux/Unix, macOS and other operating systems.
(b) Readability: Python programs use clear, simple, concise and English-like instructions that are
easy to read and understand even by non-programmers or people with no substantial programming
background.
(c) Object-Oriented Programming Language: It is an interactive, interpreted and object-oriented
programming language
(d) Higher Productivity: Since Python is a simple language with small codes and extensive libraries,
it offers higher productivity to programmers than languages like C++ and Java. So, you write less
and get more done.
(e) Less Learning Time: Because of a simple and shorter code, lesser time is required to understand
and learn Python programming.
(f) GUI Programming: Python supports GUI applications that can be created and ported to many
system calls, libraries and Windows systems such as Windows MFC (Microsoft Foundation Class
Library), Macintosh and the X Window system of Unix.
(g) Ample Availability of Libraries: It provides large standard libraries to solve a task.
(h) Syntax Highlighting: It allows distinguishing between input, output and error messages by
different color codes.

10. There are two main ways to work in Python:


(a) Interactive Mode: In this mode, you can execute Python code interactively, line by line and see
the results immediately. You can run Python in interactive mode by opening a Python interpreter,
which allows you to enter Python commands and see their output immediately. Interactive mode is
useful for testing and experimenting with small code snippets.
(b) Script Mode: In this mode, you can write a Python program in a script file, save it and then
execute it using the Python interpreter. You can create a Python script using a text editor or an
integrated development environment (IDE) such as PyCharm, Visual Studio Code or IDLE. Script
mode is useful for writing larger programs or scripts that need to be executed multiple times.

11. Advantages of working in Interactive mode in Python:


(a) Immediate feedback: You can get immediate feedback for each line of code you enter, which
allows for quick experimentation and testing.
Teacher’s Manual—Informatics Practices with Python–XI9

(b) Easy debugging: It is easy to debug code in interactive mode, as you can quickly test different
inputs and see the results.
(c) Interactive data analysis: Interactive mode is useful for data analysis, as you can quickly explore
data and test different hypotheses.
(d) Learning: An interactive mode is a great tool for learning Python as it allows you to experiment
and see the results immediately.

Disadvantages of working in Interactive mode in Python:


(a) Limited scalability: Interactive mode is best suited for small to medium-sized projects and it can
be tedious for larger projects.
(b) No code reusability: Code written in interactive mode is not easily reusable in other projects or
scripts.
(c) No persistent storage: Data entered in interactive mode is not stored permanently, so you need
to save it manually or copy it to a file.
(d) Limited editing capabilities: Editing code in interactive mode can be tedious and error-prone,
especially for larger programs.

12. Limitations of Python:


(a) Speed: Python is slower than C or C++. However, Python is a high-level language unlike C or C++;
it is not closer to hardware.
(b) Mobile Development: Python is not a very good language for mobile development. It is seen as a
weak language for mobile computing. This is the reason very few mobile applications are built into
it.
(c) Memory Consumption: Python is not a good choice for memory-intensive tasks. Due to the
flexibility of the data types, Python’s memory consumption is also high.
(d) Runtime Errors: Python programmers have cited several issues with the design of the language.
Because the language is dynamically typed, it requires more testing and has errors that only show
up at run-time.

13. The main differences between script mode and interactive mode:
(a) In interactive mode, the user types input directly into the interpreter, while in script mode, input
is read from a file.
(b) In interactive mode, the interpreter displays output immediately after the user types a command.
In script mode, the output is displayed after the entire program has finished running.
(c) In interactive mode, each command is executed immediately, while in script mode, the code can be
executed repeatedly by running the script again.
(d) In interactive mode, it is difficult to edit or reuse previous commands. In script mode, the code can
be edited and reused easily.

14. (a) To display the sum of 3, 8.0, 6*12:


(i) Open Python in interactive mode.
(ii) Type "3 + 8.0 + 6*12" and press enter.
(iii) The sum, which is 77.0, will be displayed on the screen.
(b) To print the sum of 16, 5.0, 44.0:
(i) Open Python in interactive mode.
(ii) Type "print (16 + 5.0 + 44.0)" and press enter.
(iii) The sum, which is 65.0, will be printed on the screen.

15. Output:

2 5
10 Teacher’s Manual—Informatics Practices with Python–XI

16. (a) Open Python in interactive mode.


(b) Type the following commands and press enter after each line:
(i) print("Python is easy to learn and write.")
(ii) print("It allows us to work in two modes: Interactive mode and Script
mode.")
(iii) print("Interactive mode is also known as Python Shell and Script mode is
known as Python Editor. It is a platform-independent language.")
(iv) print("We find it interesting to work with Python.")
(c) The output will be displayed on the screen.

Instructions in Script mode:


(a) Open a text editor such as Notepad.
(b) Type the following code and save the file with a .py extension:
(i) print("Python is easy to learn and write.")
(ii) print("It allows us to work in two modes: Interactive mode and Script
mode.")
(iii) print("Interactive mode is also known as Python Shell and Script mode is
known as Python Editor. It is a platform-independent language.")
(iv) print("We find it interesting to work with Python.")
(c) Open a Command Prompt or Terminal and navigate to the directory where the file is saved.
(d) Type "python filename.py" and press enter, where the filename is the name of the file we
saved in step 2.

The output will be displayed on the screen.

17. Do it yourself.

18. (a) print(n=17)


Output:
This code will produce an error.
(b) print(8+9)


Output:
17
(c) print(4.2, "hello", 6-2, "world", 15/2.0)


Output:

4.2 hello 4 7.5

19. (a) 46
(b) 100

20. Output:
• Python is easy to learn and write.
• 21.99113
• I am a class XI student
• I m
• class XI student
• I'm 16 years old
Teacher’s Manual—Informatics Practices with Python–XI11

Chapter 3: Python Programming Fundamentals


1. Python command to display your name:

>>>print("type your name here")


2. school = input("Enter Your School Name : ")


class = input("Enter Your Class: ")
section = input("Enter Your Section : ")
print(school, "-", class, "-", section)

Output:

Enter Your School Name: Doon Public School


Enter Your Class: 11
Enter Your Section: B
Doon Public School - 11 – B

3. (a) (2 + 3) ** 3 – 6 / 2
= 5 ** 3 – 6 / 2
= 125 – 3
= 122
(b) (2 + 3) * 5//4 + (4 + 6)/ 2
= 5 * 5//4 + 10/2
= 25//4 + 5
= 6 + 5
= 11
(c) 12 + (3 * 4 – 6)/3
= 12 + (12 – 6)/3
= 12 + 2
= 14
(d) 12 + (3 * *4 – 6)// 2
= 12 + (81 – 6)//2
= 12 + 75//2
= 12 + 37
= 49
(e) 12 * 3 % 5 + 2 * 6//4
= 36 % 5 + 2 * 6//4
= 1 + 3
= 4
(f) 12 % 5 *3 + (2*6)//4
= 2 * 3 + 3
= 9

4. (a) (2 + 3) ** 3 – 6 / 2
>>> (2 + 3) ** 3 – 6 / 2
122.0
(b) (2 + 3) * 5//4 + (4 + 6)/ 2
>>> (2 + 3) * 5//4 + (4 + 6)/ 2
11.0
12 Teacher’s Manual—Informatics Practices with Python–XI

(c) 12 + (3 * 4 – 6)/3
>>> 12 + (3 * 4 – 6)/3
14.0
(d) 12 + (3 ** 4 – 6)// 2
>>> 12 + (3 ** 4 – 6)// 2
49
(e) 12 * 3 % 5 + 2 * 6//4
>>> 12 * 3 % 5 + 2 * 6//4
4
(f) 12 % 5 3 + (26)//4
>>> 12 % 5 * 3 + (2 * 6)//4
9

5. Three runtime errors that occur during Python program execution are:
• division by zero
• performing an operation on incompatible types
• using an identifier which has not been defined

6. The difference between an error and an exception:


Error: Errors occur when the code violates the rules of the programming language.


Exception: An exception is an event that occurs during the execution of a program that disrupts the
normal flow of control. An exception is also known as a run time error.

7. The difference between a syntax error and a runtime error:


Syntax Error: An error in the syntax of a sequence of characters or tokens that are intended to be
written in a particular programming language. These types of errors are generated when we violate the
syntax of a programming language. Syntax errors are the most common type of easily traceable errors.
These errors can be corrected by the user as the reason for the error and an appropriate message about
what is wrong in the program is displayed. For example—


Runtime Error: A runtime error occurs after the Python interpreter interprets the code you write and
the computer begins to execute it. Runtime errors come in different types and some are hard to find.
You know you have a runtime error when the application suddenly stops running and displays an error
dialog box or when the user complains about erroneous output. It usually results in abnormal program
termination during execution. For example,

8. The invalid variable names and their reasons:


(a) if: This is an invalid variable name because it is a reserved keyword in Python and cannot be used
as a variable name.
(b) S.I.: This is an invalid variable name because it contains a special character (.) that is not allowed
in Python variable names.
Teacher’s Manual—Informatics Practices with Python–XI13

(c) #tag: This is an invalid variable name because it starts with the # symbol, which is used for
comments in Python and cannot be used as part of a variable name.
(d) tag$: This is an invalid variable name because it contains a special character ($) that is not allowed
in Python variable names.
(e) 9a: This is an invalid variable name because it starts with a number, which is not allowed in
Python variable names.
(f) for: This is an invalid variable name because for is a reserved keyword in Python and cannot be
used as a variable name.

9. Output:
(a) 8 5
(b) 0 2
(c) 20 300
(d) 66.66 126.66
(e) 4 – 10 7
(f) 8 8 0

10. Python expressions are equivalent to the following arithmetic/algebraic expressions:


(a) a + b/2
(b) (3**2+9**3)/2
(c) 3**2 + 9**3 / 5
(d) a ** (1/2) + (a+2)/b
(e) 8 – 6 + (6* sum)/ 7 – var ** ½
(f) u * t + (1/2) *a*t**2

11. (a) result = 8 * 3 + 8 % 3


print(result)
Output: 26
(b) import math
result = math.sqrt(8 + 43)
print(result)
Output: 7.14142842854285
(c) import math
result = math.sqrt(8) + math.sqrt(43)
print(result)
Output: 10.480949082616429
(d) result = 100 // 32
print(result)
Output: 3

12. Operators are special symbols or tokens which represent computation or perform various mathematical
or logical operations. They are applied to operand(s), which can be values or variables. The same
operator can behave differently on different data types. Operators when applied to operands form an
expression.


Unary and Binary operators: An operator can be termed as unary or binary depending upon the
number of operands it takes. A unary operator takes only one operand and a binary operator takes two
operands.

For example, in the expression –6 * 2 + 8 – 3, the first minus sign is a unary minus and the second
minus sign is a binary minus. The multiplication and addition operators in the above expression are
binary operators.
14 Teacher’s Manual—Informatics Practices with Python–XI

13. An expression is a combination of value(s), i.e., constant, variable and operators. It generates a single
value, which by itself is an expression. Operands contain the values an operator uses and operators are
the special symbols which represent simple calculations like addition, subtraction, multiplication, etc.

A statement is a complete line of code that performs an action or defines a value. Statements can be
simple, such as an assignment statement that sets the value of a variable, or complex, such as a loop or
conditional statement that controls program flow.

14. A Python program can contain the following components:


(a) Statements: A Python program is composed of one or more statements that perform a specific
action or create a value.
(b) Variables: Variables are used to store data and are assigned values using the assignment
operator (=).
(c) Data types: Python supports a variety of data types, including integers, floating-point numbers,
complex numbers, strings, booleans, lists, tuples, sets and dictionaries.
(d) Functions: Functions are blocks of code that perform a specific task and can be reused throughout
a program. Functions are defined using the def keyword and can take parameters and return
values.
(e) Modules: Modules are collections of functions, variables and other definitions that can be imported
into a program to extend its functionality.
(f) Comments: Comments are used to add explanatory text to a program and are ignored by the
Python interpreter. Comments are preceded by the # symbol.
(g) Whitespace: Python uses indentation to define blocks of code, such as functions, loops and
conditional statements.

15. A variable is like a container that stores values that you can access or change. Variable, as the name
suggests, has been derived from the word “vary” which means that a variable may vary during the
execution of a program, i.e., the value of a variable keeps changing during the program execution.

Variables are important for a program for several reasons:


(a) Data storage
(b) Data manipulation
(c) Control flow
(d) Readability
(f) Reusability

16. Dynamic typing is a feature of Python that allows variables to change their data type during the
execution of a program. This means that a variable can be assigned a value of one data type and then
later be assigned a value of a different data type. The data type of a variable is determined at runtime,
rather than being explicitly declared by the programmer.

For example, if a variable x is assigned the value 5, then x is considered to be an integer. If x is later
assigned the value "hello", then x is considered to be a string.

17. Different types of data type will be used to represent the following data values.
(a) Number of months in a year: Integer data type will be used to represent this data value, as it is
a whole number that cannot be fractional.
(b) Resident of Delhi or not: Boolean data type will be used to represent this data value, as it can
only have two possible values: true or false.
(c) Mobile number: String data type will be used to represent this data value, string data type for a
mobile number also allows for flexibility in handling different formats of mobile numbers, such as
including country codes, area codes or special characters like dashes or parentheses.
Teacher’s Manual—Informatics Practices with Python–XI15

(d) Pocket money: Float or double data type will be used to represent this data value, as it can be a
decimal value.
(e) Volume of a sphere: Float or double data type will be used to represent this data value, as it can
be a decimal value.
(f) Perimeter of a square: Integer or float data type will be used to represent this data value, as it
can be a whole number or a decimal value.
(g) Name of the student: String data type will be used to represent this data value, as it consists of
a sequence of characters.
(h) Address of the student: String data type will be used to represent this data value, as it consists
of a sequence of characters. However, it may be further broken down into multiple components
such as house number, street name, city, state and pin code, which may be represented by different
data types depending on the requirements of the program.

18. def calculate_area(base, height):


area = 1/2 * base * height
return area
area = calculate_area(5, 3)
print(area)

19. def calculate_area(base, height, shape_type):


if shape_type == 'triangle':
area = 0.5 * base * height
elif shape_type == 'rectangle':
area = base * height
else:
print('Invalid shape type')
return None
return area
area = calculate_area(5, 3, 'triangle')
print(area)
area = calculate_area(5, 3, 'rectangle')
print(area)
area = calculate_area(5, 3, 'circle')
print(area)

20. def dollar_to_rupee(amount, conversion_rate):


rupees = amount * conversion_rate
return rupees
amount_in_dollars = float(input('Enter the amount in dollars: '))
conversion_rate = float(input('Enter the dollar-to-rupee conversion rate: '))
amount_in_rupees = dollar_to_rupee(amount_in_dollars, conversion_rate)
print('Amount in rupees:', amount_in_rupees)

21. The code a = b = 70 assigns the value 70 to both a and b.

This is an example of a multiple assignment statement, where the same value is assigned to multiple
variables at the same time. The assignment happens from right to left: first, the value 70 is assigned to
b and then b's value of 70 is assigned to a.

22. The following code assigns a single value of 6 to two variables z and p. However, it is expecting two
values to unpack, so it will raise a ValueError with the message "not enough values to unpack (expected
2, got 1)".
16 Teacher’s Manual—Informatics Practices with Python–XI

23. Errors:
(a) The code has a syntax error: Print should be in lowercase print and enclosed in parentheses.
(b) There are two errors in this code. First, b has not been initialized, so we cannot add it to a. Second,
And is not a valid operator in Python.
(c) Invalid syntax error. The fourth line should use commas to separate the values of a, b and c, not
semicolons.
(d) The code is trying to assign a value to the constant 4, which is not allowed in Python.
(e) The code has a syntax error: Print should be in lowercase print and there should be a comma
between the string and the variable.

24. Output
(a) 15 13 22
(b) 2 3 6 236
(c) 7 49

25. Comments are an essential part of programming that can help developers understand and maintain
their code better. They are lines of text in a program that are ignored by the compiler or interpreter
and exist purely for the benefit of the developer. In this way, comments are useful because they provide
context and explanations about the code, making it easier to read, understand and modify.

Here are a few examples of how comments can enhance the readability and understandability of a
program:
(a) Provide a brief overview: Comments can be used to provide a summary of what the code is
trying to achieve. For example,
# This program calculates the area of a circle.
(b) Explain complex logic: Comments can be used to explain complex algorithms or calculations. For
example,
# This loop is used to find the highest value in the list.

26. (a) No error


(b) There are two errors in this code fragment. The first is that "Print" should be changed to "print"
(Python is case-sensitive). The second error is that the concatenation operator '+' is used to
concatenate two different types (a string and an integer). To fix this, we can convert the integer to
a string before concatenating.
(c) The variable A is used in a mathematical expression with the operator '/', which is not allowed for
strings.

27. (20, 81) 41

28. 50 30

29. 12 6.0 24

30. 25 13 16

31. No Error

32. There is a missing comma in the second line, which is causing a syntax error. Also, we need to convert
the input to an integer before performing arithmetic operations.

33. Python program that accepts the radius of a circle and prints its area:
radius = float(input("Enter the radius of the circle: "))

# calculate the area using the formula A = pi * r^2
area = 3.14159 * radius ** 2
print("The area of the circle with radius”, radius, “is”, area)
Teacher’s Manual—Informatics Practices with Python–XI17

34. mark1 = float(input("Enter marks for subject 1: "))


mark2 = float(input("Enter marks for subject 2: "))
mark3 = float(input("Enter marks for subject 3: "))
mark4 = float(input("Enter marks for subject 4: "))
mark5 = float(input("Enter marks for subject 5: "))
# Calculate the average of the marks
average = (mark1 + mark2 + mark3 + mark4 + mark5) / 5
print("The average marks are: ", average)

35. base = float(input("Enter the base of the triangle: "))


height = float(input("Enter the height of the triangle: "))
# Calculate the area of the triangle using the formula A = 0.5 * base * height
area = 0.5 * base * height
print("The area of the triangle with base",base, “and height”,height,“is”,area)

36. num = int(input("Enter a number: "))


# Calculate the first five multiples of the number
multiple1 = num * 1
multiple2 = num * 2
multiple3 = num * 3
multiple4 = num * 4
multiple5 = num * 5
# Output the first five multiples of the number
print("The first five multiples of",num, “are:”,multiple1, multiple2, multiple3,
multiple4, multiple5")

37. name = input("Enter the student's name: ")


class_name = input("Enter the class: ")
age = input("Enter the student's age: ")
# Print the student's details on the same line
print("Student's Details: Name –",name, “Class –”, class_name, “Age –”,age)
# Print the student's details on separate lines
print("Student's Details:")
print("Name – ",name)
print("Class –",class_name)
print("Age – "age)

38. num1 = int(input("Enter the first number: "))


num2 = int(input("Enter the second number: "))
num3 = int(input("Enter the third number: "))
# Swap the first two variables with the sums of the first and second and second
and third numbers
num1, num2 = num1 + num2, num2 + num3
print("After swapping, the value of num1 is", num1, “and the value of num2
is”,num2)
18 Teacher’s Manual—Informatics Practices with Python–XI

39. Python codes for the following statements:


(a) a=10
(b) a = b = c = 10
(c) x=20
x = x-5
y = x

Chapter 4: Conditional and Looping Constructs


1. A compound statement is a statement which comprises a group of statements. The compound statements
usually execute when a condition is satisfied or a code block is called directly or through a function call.

Compound statements are spread into multiple logical lines or several single statements but aligned
together into a single unit. Its syntax is:

<compound statement header>:


<multiple simple statements/compound statements
indented at same level>

2. Logical expression to represent each of the following conditions:


(a) (Mark >= 100) and (Mark < 70)
(b) (Num > 0) and (Num < 5) and (Num != 2)
(c) (Answer == 'N') or (Answer == 'n')
(d) (Age >= 18) and (gender == 'male')
(e) (City == 'Kolkata') or (City == 'Mumbai')

3. (a) In the line with the if statement, the equality operator should be == instead of =. The = operator is
used for assignment, whereas == is used for comparison.
(b) The string values "w" and "r" should be enclosed in quotes to indicate that they are strings.
(c) The print statements should be in lowercase.

Here is the corrected code:

code = input("Enter season code: ")


if code == "w":
print("Winter season")
elif code == "r":
print("Rainy season")
else:
print("Summer season")

4. (a) num1 += num2 + num3


(i) Output: 9
(b) num1 = num1 ** (num2 + num3)
Output: 729
(c) num1 **= num2 + c
Output: NameError: name 'c' is not defined
(d) num1 = '5' + '5'
Output: '55'
(e) print(4.00/(2.0+2.0))
Output: 1.0
Teacher’s Manual—Informatics Practices with Python–XI19

(f) num1 = 2+9*((3*12)-8)/10


Output: 27.4
(g) num1 = float(10)
Output: 10.0
(h) num1 = int(float('3.14'))
Output: 3
(i) print(10 != 9 and 20 >= 20)
Output: True
(j) print(5 % 10 + 10 < 50 and 29 <= 29)
Output: True

5. else and elif are two different constructs used in the if statement for different purposes.

The else statement is used in conjunction with the if statement to execute a block of code if the if
statement is False. The else statement doesn't check for any additional condition. It is always executed
if the if condition is False. For example,

num = 5
if num > 10:
print("Num is greater than 10")
else:
print("Num is less than or equal to 10")


elif is a shorthand for "else if". It is used when you want to check for multiple conditions one after
another. If the first condition is False, the next condition is checked and so on until a True condition is
found. The code block associated with the first True condition is executed and the rest of the conditions
are skipped. For example,

num = 10

if num > 10:
print("Num is greater than 10")
elif num == 10:
print("Num is equal to 10")
else:
print("Num is less than 10")

6. Output:
(a) 20
22
24
26
28
(b) I
N
D
I
A
(c) 12
20 Teacher’s Manual—Informatics Practices with Python–XI

7. (a) guru99 1
guru99 2
guru99 3
(b) 100
200
300
(c) 20
16
(d) 1 1
2 1
2 2
3 1
3 2
3 3
4 1
4 2
4 3
4 4
5 1
5 2
5 3
5 4
5 5
(e) 10
11
12
13
14
(f) 11
13
15
17
19
8. The output of the program, with x = 50, would be:
ok
average
9. Output:
o +
o o
10. for num in range(10, 21):
# Check if the number is even
if num % 2 == 0:
print(num)

11. num1 = float(input("Enter the first number: "))


num2 = float(input("Enter the second number: "))
print("Select operation:")
Teacher’s Manual—Informatics Practices with Python–XI21
print("1. Addition")
print("2. Subtraction")
print("3. Multiplication")
print("4. Division")
choice = int(input("Enter your choice (1/2/3/4): "))
if choice == 1:
result = num1 + num2
print(num1, "+", num2, "=", result)
elif choice == 2:
result = num1 - num2
print(num1, "-", num2, "=", result)
elif choice == 3:
result = num1 * num2
print(num1, "*", num2, "=", result)
elif choice == 4:
if num2 == 0:
print("Error: Cannot divide by zero")
else:
result = num1 / num2
print(num1, "/", num2, "=", result)
else:
print("Invalid input")
12. binary = input("Enter a binary number: ")
decimal = 0
power = len(binary) - 1
for the digit in binary:
decimal += int(digit) * 2 ** power
power -= 1
print("The decimal equivalent of", binary, "is", decimal)
13. num = int(input("Enter a number: "))
sum = 0
while num > 0:
digit = num % 10
sum += digit
num //= 10
print("Sum of digits:", sum)
14. def display_primes():
for num in range(2, 30):
is_prime = True
for i in range(2, num):
if num % i == 0:
is_prime = False
break
if is_prime:
print(num)
22 Teacher’s Manual—Informatics Practices with Python–XI

15. import math


def exponential_series(x, n):
sum = 1
fact = 1
for i in range(1, n+1):
fact *= i
term = (-1)**(i+1) * (x**i) / fact
sum += term
return sum
x = float(input("Enter the value of x: "))
n = int(input("Enter the number of terms to be summed: "))
result = exponential_series(x, n)
print("The sum of the exponential series is:", result)
16. import math
def exponential_series(x, n):
sum = 1
fact = 4
sign = -1
for i in range(1, n+1):
fact *= (2*i) * (2*i - 1)
term = sign * (x**i) / fact
sum += term
sign = -sign
return sum
x = float(input("Enter the value of x: "))
n = int(input("Enter the number of terms to be summed: "))
result = exponential_series(x, n)
print("The sum of the exponential series is:", result)
17. n = int(input("Enter the value of n: "))
sum = 0
for i in range(1, n+1):
for j in range(1, i+1):
sum += j
print("Sum of the series:", sum)
18. (a) for i in range(1, 6):
for j in range(i):
print("*", end=" ")
print()
(b) for i in range(65, 70):
for j in range(i-64):
print(chr(i), end=" ")
print()
(c) for i in range(1, 6):
for j in range(i, 0, -1):
print(j, end=" ")
print()
Teacher’s Manual—Informatics Practices with Python–XI23

Chapter 5: Lists in Python


1. There are several ways to create a list in Python:
(a) Creating a List using square brackets: The list can be created by enclosing the elements inside
square brackets, separating them with commas. For example,
my_list = [1, 2, 3, 4, 5]
(b) Creating a list from existing sequence: The list() method in Python is used to create a list from
an existing sequence data type objects. For example,
>>> list1=list('Computer')
>>> list1
['C','o','m','p','u','t','e','r' ]
(c) Creating a list through user input using list() method: You can create a new list by extracting
the elements from the user through command prompt and using built-in method list() as shown
below:
>>> list1 = list(input(“Enter the List Data:“))
>>> Enter the List Data: Computer
>>> print(list)
['C','o','m','p','u','t','e','r' ]
(d) Creating a List from an existing list: We can create a new list from an already existing list. For
example,
>>> list1= [10, 20, 30, 40, 50]
>>>list6 = list1[1:4]
print(list6)
Output: [20, 30, 40]
2. Strings and lists are both data structures in Python and they have some similarities in the way they
can be accessed and manipulated:
(a) Indexing
(b) Slicing
(c) Iteration
(d) Concatenation
(e) Length
3. Lists are mutable, i.e., values in the list can be modified, which means that Python will not create a new
list when you make changes to an element of a list. Elements in a list need not be of the same type. In
other words, we say that lists are heterogeneous (of multiple types) in nature.
Example: we can add an element to the end of a list using the append() method. We can remove an
element from a list using the remove() method and we can modify an element in a list by accessing it
using its index and assigning a new value to it.
4. (a) len(): This function is used to find the length of a list or a string. It returns the number of elements
in the list or the number of characters in the string.
my_list = [1, 2, 3, 4, 5]
print(len(my_list))
Output: 5
(b) append(): This function is used to add an element to the end of a list. It takes one argument,
which is the element to be added to the list.
my_list = [1, 2, 3]
my_list.append(4)
print(my_list)
Output: [1, 2, 3, 4]
24 Teacher’s Manual—Informatics Practices with Python–XI

(c) extend(): This function is used to add elements from another list to the end of an existing list. It
takes one argument, which is the list of elements to be added.
my_list = [1, 2, 3]
my_list.extend([4, 5, 6])
print(my_list)
Output: [1, 2, 3, 4, 5, 6]
(d) pop(): This function is used to remove and return the last element from a list. It takes an optional
argument, which is the index of the element to be removed. If no index is specified, it removes the
last element.
my_list = [1, 2, 3, 4, 5]
last_element = my_list.pop()
print(last_element)
Output: 5
print(my_list)
Output: [1, 2, 3, 4]
(e) remove(): This function is used to remove the first occurrence of an element from a list. It takes
one argument, which is the element to be removed.
my_list = [1, 2, 3, 4, 5]
my_list.remove(3)
print(my_list)
Output: [1, 2, 4, 5]
(f) del: This keyword is used to delete an element or a slice from a list. It takes one or two arguments,
which are the index or the slice to be deleted.
my_list = [1, 2, 3, 4, 5]
del my_list[2]
print(my_list)
Output: [1, 2, 4, 5]
my_list = [1, 2, 3, 4, 5]
del my_list[1:3]
print(my_list)
Output: [1, 4, 5]
(g) sort(): This function is used to sort a list in ascending order. It takes several optional arguments
that can be used to customize the sorting behaviour.
my_list = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5]
my_list.sort()
print(my_list)
Output: [1, 1, 2, 3, 3, 4, 5, 5, 5, 6, 9]
(h) sorted(): This function is used to sort a list and return a new sorted list. It takes the list to be
sorted as an argument.
my_list = [4, 2, 5, 1, 3]
sorted_list = sorted(my_list)
print(sorted_list)
Output: [1, 2, 3, 4, 5]
print(my_list)
Output: [4, 2, 5, 1, 3]
(i) copy() method: This is a method that creates a new copy of a list.
my_list = [1, 2, 3]
Teacher’s Manual—Informatics Practices with Python–XI25
new_list = my_list.copy()
print(new_list)
Output: [1, 2, 3]
(j) count() method: This is a method that returns the number of occurrences of an element in a list.
list.count(element)
list.count(element)
(k) max(): The max() function is a built-in Python function that is used to find the maximum value in
a list. The syntax for the max() function is as follows:
max(list)
(l) min(): The min() function is a built-in Python function that is used to find the minimum value in
a list. The syntax for the min() function is as follows:
min(list)
(m) sum(): The sum() function is a built-in Python function that is used to add up all the values in a
list. The syntax for the sum() function is as follows:
sum(list)
5. The insert() and append() methods are both used to add elements to a list in Python, but there is a key
difference between the two:

insert(): The insert() method inserts item into the list at the specified index. When an item is inserted
into a list, the list is expanded in size to accommodate the new item. The item that was previously at a
specified index and all the items after it are shifted by one position towards the end of the list.
Example:
my_list = [1, 2, 3]
my_list.insert(1, 4)
print(my_list)

Output: [1, 4, 2, 3]


append(): The append() method is used to add an element to the end of a list. It takes a single argument,
which is the element to be added to the end of the list.
Example:

my_list = [1, 2, 3]
my_list.append(4)
print(my_list)
Output: [1, 2, 3, 4]

6. (a) ['Good'].
(b) [10, 3].
(c) [['few', 'facts', 'fun']].
(d) "facts".

7. The output will be:


(a) [1, 2, 3, '4', '5'].
(b) 3
(c) [1]
(d) [4, 5, 6]
26 Teacher’s Manual—Informatics Practices with Python–XI

8. Output:
(a) [10, 12, 26, 32, 65, 80]
(b) [12, 32, 65, 26, 80, 10]
(c) [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
(d) 5
9. The output of the given code segment will be:
1
3
5
7
9
10. Output:
(a) [1, 2, 3]
(b) [6, 7, 8, 9, 10]
(c) [2, 4, 6, 8, 10]
11. Output:
['CC', 'a', 'm', '@', 'D', '22', 'D', '*']
12. Both append() and extend() are methods of the list class in Python, used to add elements to a list.
However, there is a subtle difference between them:

append(): This method is used to add a single element to the end of a list. The element can be of any
data type, including another list (in which case, the entire list is added as a single element).
Example:
my_list = [1, 2, 3]
my_list.append(4)
print(my_list)
Output: [1, 2, 3, 4]


extend(): This method is used to add multiple elements to the end of a list. The elements must be
iterable, such as a list, tuple, string or another iterable object. When the extend() method is called with
an iterable object as an argument, each element of the iterable is added as a separate element to the
list.

Example:
my_list = [1, 2, 3]
my_list.extend([4, 5])
print(my_list)
Output: [1, 2, 3, 4, 5]

13. n = int(input("Enter the number of integers: "))


numbers = []
positive_numbers = []
negative_numbers = []
for i in range(n):
num = int(input("Enter an integer: "))
numbers.append(num)
if num >= 0:
positive_numbers.append(num)
Teacher’s Manual—Informatics Practices with Python–XI27
else:
negative_numbers.append(num)
print("Original list:", numbers)
print("Positive numbers:", positive_numbers)
print("Negative numbers:", negative_numbers)
Output:
Enter the number of integers: 10
Enter an integer:2
Enter an integer:3
Enter an integer: 10
Enter an integer: 99
Enter an integer: 101
Enter an integer:9
Enter an integer:11
Enter an integer: 100
Enter an integer: 98
Enter an integer: 3114
Original list: [-2, -3, 10, 99, 101, -9, -11, 100, 98, 3114]
Positive numbers: [10, 99, 101, 100, 98, 3114]
Negative numbers: [-2, -3, -9, -11]
14. elements = [5, 12, 8, 15, 6, 9]
largest = None
second_largest = None
for element in elements:
if largest is None or element > largest:
second_largest = largest
largest = element
elif second_largest is None or element > second_largest:
second_largest = element
print("Largest element:", largest)
print("Second largest element:", second_largest)
Output:
Largest element: 15
Second largest element: 12
15. n = int(input("Enter the number of integers: "))
numbers = []
for i in range(n):
num = int(input("Enter an integer: "))
numbers.append(num)
numbers.sort()
if n % 2 == 0:
median1 = numbers[n//2]
median2 = numbers[n//2 - 1]
median = (median1 + median2) / 2
else:
median = numbers[n//2]
print("Median:", median)
28 Teacher’s Manual—Informatics Practices with Python–XI

Output:
Enter the number of integers: 5
Enter an integer: 2
Enter an integer: 3
Enter an integer: 4
Enter an integer: 5
Enter an integer: 6
Median: 4
Enter the number of integers: 4
Enter an integer: 2
Enter an integer: 4
Enter an integer: 6
Enter an integer: 9
Median: 5.0

16. elements = input("Enter the list of elements separated by commas: ").split(",")


unique_elements = list(set(elements))
print("Modified list without duplicates:", unique_elements)

Output:

Enter the list of elements separated by commas: 10,10,2,31,14,5


Modified list without duplicates: ['5', '2', '31', '14', '10']

17. elements = [1, 2, 3, 4, 5]


new_element = input("Enter the new element to insert: ")
position = int(input("Enter the position to insert the new element: "))
elements.insert(position, new_element)
print("Modified list with new element:", elements)

Output:

Enter the new element to insert: 2


Enter the position to insert the new element: 2
Modified list with new element: [1, 2, '2', 3, 4, 5]

18. elements = input("Enter the elements of the list, separated by spaces: ").split()
elements = [int(e) for e in elements]
position = int(input("Enter the position of the element to be deleted: "))
del elements[position]
value = int(input("Enter the value of the element to be deleted: "))
elements.remove(value)
print("Modified list:", elements)

Output:

Enter the elements of the list, separated by spaces: 3 6 9 12 15


Enter the position of the element to be deleted: 1
Enter the value of the element to be deleted: 12
Modified list: [3, 9, 15]
Teacher’s Manual—Informatics Practices with Python–XI29

19. def sum_odd_values(S):


total = 0
for x in S:
if x % 2 == 1:
total += x
return total
S = [1, 2, 3, 4, 5, 6, 7, 8, 9]
print("Sum of odd values in S:", sum_odd_values(S))

Output:

Sum of odd values in S: 25

20. def mean(numbers):


if len(numbers) == 0:
return None
total = sum(numbers)
return total / len(numbers)
numbers = [1, 2, 3, 4, 5]
print("Mean of the numbers:", mean(numbers))

Output:

Mean of the numbers: 3.0

21. def delete_duplicates(lst):


unique_list = []
for element in lst:
if element not in unique_list:
unique_list.append(element)
return unique_list
lst = [5, 2, 4, -5, 12, 2, 7, 4]
print("Original list:", lst)
unique_list = delete_duplicates(lst)
print("List without duplicates:", unique_list)
Output:
Original list: [5, 2, 4, -5, 12, 2, 7, 4]
List without duplicates: [5, 2, 4, -5, 12, 7]
22. def find_minimum(numbers):
minimum = numbers[0]
for number in numbers[1:]:
if number < minimum:
minimum = number
return minimum
numbers = [3, 5, 1, 9, 2, 7]
minimum = find_minimum(numbers)
print("The minimum value is:", minimum)
Output:
The minimum value is: 1
30 Teacher’s Manual—Informatics Practices with Python–XI

23. def calculate_total_percentage(marks):


total_marks = sum(marks)
max_marks = len(marks) * 100 # Assuming each subject has 100 maximum marks
percentage = (total_marks / max_marks) * 100
return (total_marks, percentage)
marks = [85, 90, 95, 80, 75]
total_marks, percentage = calculate_total_percentage(marks)
print("Total marks:", total_marks)
print("Percentage:", percentage)
Output:
Total marks: 425
Percentage: 85.0
24. def multiply_odd_index(lst):
for i in range(len(lst)):
if i % 2 == 1 and type (lst[i]) == int):
lst[i] *= 2
return lst
my_list = ['a', 1, 'b', 3, 'c', 5]
result = multiply_odd_index(my_list)
print(result)
Output:
['a', 2, 'b', 6, 'c', 5]
25. def count_frequency(lst, element):
count = 0
for item in lst:
if item == element:
count += 1
return count
my_list = [1, 2, 3, 4, 2, 3, 2, 1, 2, 5]
frequency = count_frequency(my_list, 2)
print(frequency)
Output:
4

26. def shift_list(lst):
first_element = lst.pop(0)
lst.append(first_element)
return lst
my_list = [10, 20, 30, 40]
shifted_list = shift_list(my_list)
print(shifted_list)
Output:
[20, 30, 40, 10]
Teacher’s Manual—Informatics Practices with Python–XI31

27. def swap_divisible_by_five(arr):


for i in range(len(arr)-1):
if arr[i] % 5 == 0:
continue
for j in range(i+1, len(arr)):
if arr[j] % 5 == 0:
arr[i], arr[j] = arr[j], arr[i]
break
return arr
my_arr = [3, 25, 13, 6, 35, 8, 14, 45]
swapped_arr = swap_divisible_by_five(my_arr)
print(swapped_arr)
Output:

[25, 3, 13, 35, 6, 8, 45, 14]

28. stRecord = ['Raman','A-36',[56,98,99,72,69], 78.8]


percentage = stRecord[3]
print("Percentage:", percentage)
fifth_subject_marks = stRecord[2][4]
print("Marks in fifth subject:", fifth_subject_marks)
max_marks = max(stRecord[2])
print("Maximum marks:", max_marks)
roll_no = stRecord[1]
print("Roll No.:", roll_no)
stRecord[0] = "Raghav"
print("Modified stRecord:", stRecord)

Output:

Percentage: 78.8
Marks in fifth subject: 69
Maximum marks: 99
Roll No.: A-36
Modified stRecord: ['Raghav', 'A-36', [56, 98, 99, 72, 69], 78.8]

Chapter 6: Dictionary
1. A key-value pair is a fundamental concept in dictionaries in Python. It refers to a single item or entry
in a dictionary, where a key is associated with a corresponding value. The key is used to identify and
access the associated value in the dictionary.

In a dictionary, the keys are unique and immutable objects such as strings, numbers, or tuples. The
values associated with the keys can be of any data type, including strings, numbers, lists, tuples, sets
or even other dictionaries.

For example, consider the following dictionary that stores the prices of some fruits:

fruit_prices = {'apple': 1.50, 'banana': 0.50, 'orange': 1.00}

2. The main differences between strings and dictionaries:


(a) Strings are used to represent a sequence of characters, whereas dictionaries are used to store key-
value pairs.
32 Teacher’s Manual—Informatics Practices with Python–XI

(b) Strings are a data type in Python, whereas dictionaries are a data structure that consists of multiple
data types (keys and values).
(c) Strings are indexed using integers to access individual characters or substrings, while dictionaries
are indexed using keys to access their corresponding values.
(d) Strings are immutable, which means that their contents cannot be changed once they are created.
Dictionaries are mutable, which means that their contents can be modified.
(e) Strings are created using quotation marks (either single or double), while dictionaries are created
using curly braces and colons to separate keys and values.
(f) The length of a string is determined by the number of characters it contains, while the length of a
dictionary is determined by the number of key-value pairs it contains.

3. (a) The dictionary should have 7:70 instead of 7,70:


d1 = {1:10, 2.5:20, 3:30, 4:40, 5:50, 6:60, 7:70}
(b) The dictionary should be accessed using square brackets instead of parentheses:
d1[9] = 90
(c) The del keyword should be followed by square brackets when deleting a key-value pair from a
dictionary:
del d1[2]
(d) The correct syntax to remove an item with key 4 from the dictionary d1 using the pop method is:
d1.pop(4)
(e) The items method should be used instead of item to get a list of key-value pairs:
d1.items()
(f) The keys method should be used instead of key to get a list of keys:
d1.keys()
(g) The values method should be used instead of value to get a list of values:
d1.values()
(h) The get method should be used instead of gets to get the value associated with a key and we should
provide a default value of 80 to return if the key is not found:
d1.get(4,80)
(i) The correct syntax to get the number of key-value pairs in the dictionary d1 using the len function
is:
len(d1)
(j) The clear method should be used instead of clears to remove all key-value pairs from the dictionary:
d1.clear()
4. (a) >>> d1.items()
dict_items([(1, 'one'), (2, 'two'), (3, 'three'), (4, 'four')])
>>> d1.keys()
dict_keys([1, 2, 3, 4])
>>> d1.values()
dict_values(['one', 'two', 'three', 'four'])
>>> d1.update(d2)
>>> print(d1)
{1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five', 6: 'six'}
>>> len(d1)
6
(b) Output:
>>> del d1[3]
>>> print(d1)
{1: 'one', 2: 'two', 4: 'four', 5: 'five', 6: 'six'}
Teacher’s Manual—Informatics Practices with Python–XI33
>>> d1.pop(4)
'four'
>>> print(d1)
{1: 'one', 2: 'two', 5: 'five', 6: 'six'}
>>> d1[8]='eight'
>>> print(d1)
{1: 'one', 2: 'two', 5: 'five', 6: 'six', 8: 'eight'}
>>> d1.clear()
>>> print(d1)
{}

5. my_dict = {'a': 10, 'b': 5, 'c': 20, 'd': 30, 'e': 25}
# Get a list of the dictionary values and sort it in descending order
sorted_values = sorted(my_dict.values(), reverse=True)
# Get the first two highest values
highest1 = sorted_values[0]
highest2 = sorted_values[1]
# Find the keys corresponding to the highest values
highest1_keys = [k for k, v in my_dict.items() if v == highest1]
highest2_keys = [k for k, v in my_dict.items() if v == highest2]
# Print the result
print("The highest two values in the dictionary are:", highest1, "and", highest2)
print("The keys corresponding to the highest value", highest1, "are:", highest1_
keys)
print("The keys corresponding to the second highest value", highest2, "are:",
highest2_keys)

Output:

The highest two values in the dictionary are: 30 and 25


The keys corresponding to the highest value 30 are: ['d']
The keys corresponding to the second highest value 25 are: ['e']

6. n = int(input("Enter the number of classes: "))


classes = {}
for i in range(n):
class_name = input("Enter the name of class", i+1)
teacher_name = input("Enter the name of the class teacher for", class_name)
classes[class_name] = teacher_name
print("\nClass Teacher Details:")
for class_name, teacher_name in classes.items():
print("Class:" class_name, "Teacher:", teacher_name)
class_name = input("\nEnter the name of a class to display its teacher: ")
if class_name in classes:
print("Teacher of", class_name, classes[class_name])
else:
print("No information found for", class_name)
34 Teacher’s Manual—Informatics Practices with Python–XI

Output:

Enter the number of classes: 3


Enter the name of class 1: A
Enter the name of the class teacher for A: John
Enter the name of class 2: B
Enter the name of the class teacher for B: Lisa
Enter the name of class 3: C
Enter the name of the class teacher for C: David
Class Teacher Details:
Class: A, Teacher: John
Class: B, Teacher: Lisa
Class: C, Teacher: David
Enter the name of a class to display its teacher: B
Teacher of B class is Lisa

7. n = int(input("Enter the number of students: "))


students = {}
for i in range(n):
name = input("Enter the name of student", i+1)
percentage = float(input("Enter the percentage of", name, "in the exam:")
students[name] = percentage
print("\nStudent Details:")
for name, percentage in students.items():
print(name, percentage)
name_to_delete = input("\nEnter the name of student to be deleted: ")
if name_to_delete in students:
del students[name_to_delete]
print("Student", name_to_delete, "has been deleted.")
else:
print("No information found for student", name_to_delete)
print("\nUpdated Student Details:")
for name, percentage in students.items():
print(name, percentage)

Output:

Enter the number of students: 3


Enter the name of student 1: John
Enter the percentage of John in the exam: 85.5
Enter the name of student 2: Lisa
Enter the percentage of Lisa in the exam: 92.0
Enter the name of student 3: David
Enter the percentage of David in the exam: 76.8
Student Details:
John: 85.5%
Lisa: 92.0%
David: 76.8%
Teacher’s Manual—Informatics Practices with Python–XI35
Enter the name of student to be deleted: Lisa
Student Lisa has been deleted.
Updated Student Details:
John: 85.5%
David: 76.8%

8. n = int(input("Enter the number of customers: "))


customers = {}
for i in range(n):
name = input("\nEnter the name of customer", i+1)
items = input("Enter the items bought by", name)
cost = float(input("Enter the total cost of items bought by", name)
phone = input("Enter the phone number of" name)
customers[name] = {'items': items, 'cost': cost, 'phone': phone}
print("\nCustomer Details:")
print('Name', 'Items Bought', 'Total Cost', 'Phone Number')
print("-" * 70)
for name, details in customers.items():
print(name, details['items'], details['cost'], details['phone'])

Output:

Enter the number of customers: 2


Enter customer name: John
Enter items bought: T-shirt
Enter cost: 25
Enter phone number: 1234567890
Enter customer name: Jane
Enter items bought: Jeans
Enter cost: 50
Enter phone number: 9876543210
Customer Details:
Name Items Bought Cost Phone Number
John T-shirt 25 1234567890
Jane Jeans 50 9876543210

9. The keys in a dictionary can be of any immutable data type. This means that we can use objects like
integers, floats, strings, tuples and even custom classes (as long as they are immutable) as keys.

10. The ‘in’ operator checks whether a particular key is there in the dictionary. It returns True if specified
key appears in the dictionary, otherwise returns False.

>>> A={"mon":"monday","tue":"tuesday","wed":"wednesday","thu":"thursday"}
>>> 'thu' in A
True
>>> 'fri' in A
False
>>> 'fri' not in A
True
36 Teacher’s Manual—Informatics Practices with Python–XI

11. clear(): It removes all items from the particular dictionary and returns an empty dictionary.

Syntax: d.clear() # d is dictionary

Example:

>>> D={1:'one',2:'two',3:'three',4:'four'}
>>> print(D)
{1: 'one', 2: 'two', 3: 'three', 4: 'four'}
>>> D.clear()
>>> print(D)
{}

del: The keyword ‘del’ is used to delete the key present in the dictionary.

Syntax: del dictname[key]

Example:

>>> A={"mon":"monday","tue":"tuesday","wed":"wednesday", "thu":"thursday"}


>>> del A['wed']
>>> print(A)
{'mon': 'monday', 'tue': 'tuesday', 'thu': 'thursday'}

12. The error in the given code is that a list [1, "a"] is being used as a key in the dictionary d1. Lists are
mutable and therefore not hash able, so they cannot be used as dictionary keys. Only immutable objects
like strings, numbers and tuples can be used as dictionary keys.

To correct the code, we need to replace the list [1, "a"] with a tuple that contains the same elements.
The corrected code:

d1 = {"a": 1, 1: "a", (1, "a"): "two"}

13. dict_keys([5, 'a'])

dict_values([[6, 7, 8], (1, 2, 3)])

14. Output:
(a) 1
(b) 1

15. # initialize an empty dictionary


friend_dict = {}
# add friends and phone numbers to the dictionary
while True:
name = input("Enter friend's name (or 'quit' to exit): ")
if name == 'quit':
break
phone = input("Enter friend's phone number: ")
friend_dict[name] = phone
(a) Display all friends and phone numbers
print("All Friends and Phone Numbers:")
for name, phone in friend_dict.items():
print(f"{name}: {phone}")
Teacher’s Manual—Informatics Practices with Python–XI37

(b) Add a new friend and phone number


new_name = input("Enter new friend's name: ")
new_phone = input("Enter new friend's phone number: ")
friend_dict[new_name] = new_phone
print("Modified Dictionary:")
print(friend_dict)
(c) Delete a friend
delete_name = input("Enter the name of the friend to delete: ")
if delete_name in friend_dict:
del friend_dict[delete_name]
print(delete_name, “deleted from the dictionary.")
else:
print(delete_name, “not found in the dictionary.")
(d) Modify a phone number
modify_name = input("Enter the name of the friend to modify: ")
if modify_name in friend_dict:
new_phone = input("Enter new phone number: ")
friend_dict[modify_name] = new_phone
print(modify_name, “phone number has been updated to”, new_phone)
else:
print(modify_name ,”not found in the dictionary.")
(e) Check if a friend is present
check_name = input("Enter the name of the friend to check: ")
if check_name in friend_dict:
print(check_name, “is present in the dictionary with phone number”,
friend_dict[check_name])
else:
print(check_name,“is not present in the dictionary.")
(f) Display sorted dictionary
sorted_dict = sorted(friend_dict.items())
print("Sorted Dictionary:")
for name, phone in sorted_dict:
print(f"{name}: {phone}")
Output:
Enter friend's name (or 'quit' to exit): Dev
Enter friend's phone number: 0987654321
Enter friend's name (or 'quit' to exit): Davendra
Enter friend's phone number: 1234567890
Enter friend's name (or 'quit' to exit): Raj
Enter friend's phone number: 5432167890
Enter friend's name (or 'quit' to exit): quit
All Friends and Phone Numbers:
Dev: 0987654321
Davendra: 1234567890
Raj: 5432167890
Enter new friend's name: Rahul
38 Teacher’s Manual—Informatics Practices with Python–XI
Enter new friend's phone number: 0987612345
Modified Dictionary:
{'Dev': '0987654321', 'Davendra': '1234567890', 'Raj': '5432167890', 'Rahul':
'0987612345'}
Enter the name of the friend to delete: Rahul
Rahul deleted from the dictionary.
Enter the name of the friend to modify: Raj
Enter new phone number: 0987612345
Raj's phone number has been updated to 0987612345.
Enter the name of the friend to check: Dev
Dev is present in the dictionary with phone number 0987654321.
Sorted Dictionary:
Davendra: 1234567890
Dev: 0987654321
Raj: 0987612345

16. (a) 35000


(b) dict_keys(['LCD', 'Laptop', 'Home Theatre', 'Microwave Oven', 'Electric
Iron', 'Speaker'])
(c) dict_values([25000, 35000, 80000, 18000, 2800, 55000])
(d) dict_items([('LCD', 25000), ('Laptop', 35000), ('Home Theatre', 80000),
('Microwave Oven', 18000), ('Electric Iron', 2800), ('Speaker', 55000)])
(e) 6
(f) True
(g) 25000
(h) {'LCD': 25000, 'Laptop': 35000, 'Microwave Oven': 18000, 'Electric Iron':
2800, 'Speaker': 55000}

17. # initialize an empty dictionary


products = {}
# prompt user for product names and prices
while True:
name = input("Enter product name (or 'quit' to exit): ")
if name == 'quit':
break
price = input("Enter product price: ")
products[name] = price
# search for a product and display its price
search_name = input("Enter product name to search for: ")
if search_name in products:
print("The price of”,search_name, “is”, products[search_name])
else:
print(search_name, "is not found in the dictionary.")

Output:

Enter product name (or 'quit' to exit): Milk


Enter product price: 65
Teacher’s Manual—Informatics Practices with Python–XI39
Enter product name (or 'quit' to exit): Butter
Enter product price: 600
Enter product name (or 'quit' to exit): quit
Enter product name to search for: Butter
The price of Butter is 600.

18. # initialize dictionary


my_dict = {'a': 1, 'b': 2, 'c': 3, 'd': 1, 'e': 2, 'f': 3}
# get value to search for from user
search_value = int(input("Enter a value to search for: "))
# search for value in dictionary
if search_value in my_dict.values():
# initialize variables for key and frequency
key = None
frequency = 0
# loop through dictionary items to find key and frequency of search value
for k, v in my_dict.items():
if v == search_value:
key = k
frequency += 1
# print key and frequency
print("The value, search_value, “is present in the dictionary with key”,
key, “and frequency”, frequency)
else:
print("The value”,search_value, “is not present in the dictionary.")

Output:

Enter a value to search for: 2


The value 2 is present in the dictionary with key 'e' and frequency 2.

Chapter 7: Database Concepts


1. Data is a collection of facts, observations or measurements that are represented in a structured or
unstructured format. It can take many forms, including text, numbers, images, audio and video.

2. Information is the result of processing and analyzing data in a meaningful way to extract insights
or knowledge. It is a more refined and organized version of data that is useful for decision-making,
communication and understanding.

3. Data and information are related but distinct concepts.

Data refers to raw facts, observations, or measurements that have not been organized, structured or
interpreted in any meaningful way. Data can take many forms, such as text, numbers, images, audio or
video.

Information, on the other hand, is the result of processing and analyzing data in a meaningful way to
extract insights or knowledge. Information is a more refined and organized version of data that is useful
for decision-making, communication and understanding.

4. A database is defined as an organized collection of data about an entity or things.

A database system is a software system that enables the creation, maintenance and use of databases.
40 Teacher’s Manual—Informatics Practices with Python–XI

The various components of a database system are:


(a) Data
(b) Hardware
(c) Users
(d) Database Management System (DBMS)

5. The database system is used to eliminate the problems of data redundancy and data inconsistency
that were found in flat file systems. The database system does not maintain separate files for different
applications. Rather, it works on the centrally maintained database which means that the data is kept
at one place and all the applications that require the data may refer to this database. Whenever any file
gets updated, the updated version of the file is available to all applications using the database system.
So, data redundancy and data inconsistency are controlled to a large extent.

6. Database Management Systems are specially designed applications to create a connection between the
user and the program and to store data in an organized manner. The purpose of DBMS software is to
allow the user to create, access, modify and control a database.

We need a DBMS for several reasons:


(a) Data organization
(b) Data integrity
(c) Security
(d) Data sharing
(e) Scalability
(f) Data backup and recovery

7. (a) The main differences between a database and a file are:


• Structure: A database is structured, whereas a file is often unstructured.
• Organization: A database is organized into tables, which are related to one another, while a
file may not have any particular organization.
• Retrieval: Retrieving data from a database is typically faster and more efficient than
retrieving data from a file, particularly when dealing with large amounts of data.
(b) The main differences between data and a file are:
• Data is unstructured and has no particular organization, while a file is typically organized in
some manner.
• Data has no meaning or significance until it is interpreted or analyzed in some way, while a
file may have a specific purpose or use.
• Data can be stored in a variety of formats, such as a database, spreadsheet or text file, while
a file is a specific type of data storage format.

8. The various components of a database system are described below:


(a) Users: Users can be of varied types – Database administrators or DBAs (who design, write and
take care of computer database systems so that the right person can get the needed information at
the right time), System or Application developers and end-users.
(b) Database Application: Database applications may be personal, departmental, commercial and
internal. It may be general purpose or customized as per the needs of a user.
(c) DBMS: Software that allows users to define, create, access and manage database(s) is termed as a
DBMS, for example, MySQL, Oracle, etc.
(d) Database: Database is an organized collection of logically related data.

9. Advantages of a DBMS
(a) Control of data redundancy
(b) Data consistency
Teacher’s Manual—Informatics Practices with Python–XI41

(c) Sharing of data


(d) Reduced programming effort
(f) Privacy and security

Disadvantages of a DBMS
(a) Cost
(b) Complexity
(c) Performance
(d) Data corruption
(e) Dependence

10. Database Administrator (DBA) is the person who is responsible for the security and functioning of the
database.

11. Data redundancy means duplication of data. Duplicate data is stored at different locations which
violates the integrity of the database and causes wastage of storage space.

Data redundancy can be controlled through the use of normalized database design, views and data
validation rules. By controlling data redundancy, we can improve data quality, reduce storage costs and
enhance data integrity.

12. A major purpose of a database system is to provide users with an abstract view of the data, i.e., the
system hides certain details of how the data is stored and maintained. Data abstraction is a process
of hiding the implementation details and representing only the essential features to simplify users’
interaction with the system.

Different levels of abstraction are:


(a) Physical/Internal Level
(b) Logical/Conceptual Level
(c) View Level/External Level

13. Data independence is the ability to change the physical or logical structure of a database without
affecting the way that applications access or use that data. This is important for maintaining a flexible
and adaptable database system that can meet the changing needs of an organization.

14. (a) Table


(b) Metadata
(c) Primary key
(d) Null value
(e) Candidate key
(f) Relational database management system (RDBMS)

15. Foreign keys are allowed to have NULL values because in some cases, it is possible that a row in the
child table does not have a corresponding row in the parent table. In such cases, the foreign key value in
the child table can be set to NULL to indicate that there is no matching record in the parent table. For
example, consider a database that stores information about orders and customers. The orders table has
a foreign key column that references the customer table to identify the customer who placed the order.
Now, suppose a new order is placed by a customer who is not yet registered in the system. In this case,
the foreign key value in the orders table cannot reference any existing record in the customer table, so
it must be set to NULL. Later, when the customer registers in the system, a new record will be added
to the customer table and the foreign key value in the orders table can be updated to reference the new
record.
42 Teacher’s Manual—Informatics Practices with Python–XI

16. (a) Database and table:


• Database is a collection of organised data that allows easy management and manipulation of
data. It is a collection of multiple tables and other functions like view, index, etc.
• Table: A table is a data structure within a database that organizes data into rows and columns.
Each table holds data regarding a particular entity like students, products, etc.
(b) Primary key and foreign key:
• A primary key is a column or a set of columns in a table that uniquely identifies each row in
that table. It is used to enforce data integrity and ensure that no two rows in the table have
the same values in the primary key columns.
• A foreign key is a column or a set of columns in one table that refers to the primary key of
another table. It establishes a relationship between two tables and is used to enforce referential
integrity, which means that a row cannot be inserted or updated in the child table if there is
no corresponding row in the parent table.
(c) Degree and cardinality of a relation:
• The degree of a relation is the number of attributes or columns in a table or relation.
For example, a table with three columns has a degree of 3.
• The cardinality of a relation refers to the number of rows or records in a table or relation. It
is also called the size of the relation. For example, a table with 100 rows has a cardinality
of 100.

17. A database management system (DBMS) uses a variety of techniques to avoid redundancy in data and
ensure data consistency across the database. This is in contrast to a file system, which typically stores
data in separate files without any built-in mechanisms for managing data redundancy.

Here are some ways in which a DBMS avoids data redundancy:


(a) Data normalization
(b) Constraints
(c) Transactions
(d) Views

18. (a) The most likely key for the primary key is the CUST-ID column, assuming that each customer has
a unique ID.

(b) • Candidate key: A candidate key is a column or a set of columns that can uniquely identify each
row in a table. In this case, there are several candidate keys:
(i) CUST-ID
(ii) PHONE number (assuming that each customer has a unique phone number)
(iii) STREET and CITY (assuming that each customer lives on a unique street in a unique city)
(iv) STREET and STATE (assuming that each customer lives on a unique street in a unique
state)

• Alternate key: An alternate key is a candidate key that is not chosen as the primary key. In

this case, the alternate keys are:
(i) PHONE number (if CUST-ID is chosen as the primary key)
(ii) CUST-ID (if PHONE number is chosen as the primary key)

19. (a) Relation: A relation is a table that consists of a set of named columns and an arbitrary number of
rows. Each column represents an attribute of the relation, while each row represents a tuple or a
record.
(b) Domain: A domain is the set of allowable values for a particular attribute in a relation.
For example: a domain for an attribute representing a person's age might be "positive integers".
Teacher’s Manual—Informatics Practices with Python–XI43

(c) Tuple: Each row in a table is known as a tuple. It is also called a row/record. A single entry in a
table is called a record or row. A record in a table represents a set of related data.
(d) Attribute: An attribute is a named column of a relation that represents a characteristic or property
of the objects or entities represented by the relation.
For example, in a relation representing a customer database, the attributes might include the
customer’s name, address and phone number.
(e) Degree: The degree of a relation is the number of attributes or columns in the relation.
For example, a relation representing a customer database might have a degree of 4 if it includes
attributes for customer ID, name, address and phone number.
(f) Cardinality: The cardinality of a relation is the number of tuples or rows in the relation.
For example, a relation representing a customer database might have a cardinality of 1000 if it
includes information for 1000 customers.

20. (a) Primary Key: A primary key is a set of one or more attributes/fields which uniquely identifies a
tuple/row in a table. The salient features of a primary key are as follows:
• It is always unique in nature, i.e., non-redundant. It does not have duplicate values in a
relation.
• It arranges the table in its own order.
• It cannot be re-declared or left null.
• One table can have only one primary key.
(b) Candidate key: A candidate key is a column or set of columns in a database table that can be
used as a primary key. Like a primary key, it must be unique and not null, but it is not currently
designated as the primary key of the table. A table may have multiple candidate keys and one of
them can be selected as the primary key.
Alternate Key = Candidate Keys – Primary Key
(c) Alternate Key: A candidate key that is not the primary key is called an alternate key. In other
words, any attribute that is a candidate for the primary key, i.e., which is capable of becoming a
primary key but is not a primary key, is an alternate key.
Candidate key = Primary Key + Alternate Key
(d) Foreign key: A foreign key is a column or set of columns in a database table that refers to the
primary key of another table. It is used to establish a relationship between two tables, where
the values in the foreign key column(s) of one table correspond to the values in the primary key
column(s) of another table. This allows data to be shared between the two tables and ensures that
the data is consistent and accurate.

21. The major differences between a relation and a traditional file are:
(a) In a traditional file, data is stored in a linear structure, whereas in a relation, data is stored in a
tabular format with columns and rows.
(b) In a traditional file, data redundancy is common, as the same data may be stored in multiple
locations. In a relation, redundancy is minimized through normalization, which reduces duplication
of data.
(c) A relation enforces data integrity through the use of constraints, such as primary keys, foreign
keys and check constraints, while a traditional file does not provide such mechanisms.
(d) In a traditional file, data manipulation is often performed using custom code, while in a relation,
data manipulation is performed using a structured query language (SQL), which allows for efficient
and powerful data retrieval and modification.

22. Tables in a database are designed to be related to one another through the use of keys, such as primary
keys and foreign keys, which enable data to be shared and accessed across tables. In this way, the
relationship between tables within a database is essential to the efficient and effective management of
data.
44 Teacher’s Manual—Informatics Practices with Python–XI

23. DBMS stands for Database Management System. It is a software system that enables users to define,
create, maintain and control access to a database.

The two popular DBMS are Oracle Database and Microsoft SQL Server.

24. Data is organized in a table in a structured and organized way. A table consists of rows and columns,
also known as records and fields, respectively.

Each row in a table represents a specific instance of data, while each column represents a specific
attribute or property of the data. The intersection of a row and a column is a cell, which contains a
single value of data.

25. A primary key is a field or a combination of fields in a table that uniquely identifies each row in the
table. Its function is to ensure that each row in the table is uniquely identified and that the data in the
table is well-organized and consistent.

26. (a) Row and Column:


• A row, also known as a record, is a horizontal entity in a table that represents a single instance
of data or information.
• A column, also known as a field, is a vertical entity in a table that represents a specific
attribute or property of the data.
(b) Database and Table:
• A database is a collection of interrelated data that is managed and stored in a single location.
It consists of one or more tables, as well as other components such as views, indexes and
stored procedures.
• A table is a collection of related data organized in rows and columns within a database.

Chapter 8: Structured Query Language (SQL)


1. Alternate Key: A candidate key that is not the primary key is called an alternate key. In other words,
any attribute that is a candidate for the primary key, i.e., which is capable of becoming a primary key
but is not a primary key, is an alternate key.
Candidate key = Primary Key + Alternate Key
2. Define the following terms:
(a) Relation: A relation is a table that consists of a set of named columns and an arbitrary number of
rows. Each column represents an attribute of the relation, while each row represents a tuple or a
record.
(b) Tuple: Each row in a table is known as a tuple. It is also called a row/record. A single entry in a
table is called a record or row. A record in a table represents a set of related data.
(c) Attribute: An attribute is a named column of a relation that represents a characteristic or property
of the objects or entities represented by the relation.
Example: in a relation representing a customer database, the attributes might include customer’s
name, address and phone number.
(d) Domain: A domain is the set of allowable values for a particular attribute in a relation.
Example: a domain for an attribute representing a person's age might be "positive integers".
3. In relational databases, a candidate key is a column or set of columns in a table that can uniquely
identify each row in the table. In other words, a candidate key is a set of attributes that can be used as
a primary key.
An alternate key, also known as a secondary key, is a candidate key that is not selected as the primary
key for a given table. Therefore, an alternate key is a column or set of columns that can also uniquely
identify each row in a table but is not used as the primary key.
Teacher’s Manual—Informatics Practices with Python–XI45

4. SQL (Structured Query Language) is a standard language for accessing and manipulating databases.
SQL commands are used to create, transform and retrieve information from Relational Database
Management Systems (RDBMS) and also to create an interface between the user and database. By
using SQL commands, one can create database and perform other functions like creating tables, adding
records, modifying data, searching data, removing rows, dropping tables, etc.
The different categories of commands available in SQL are as follows:
(a) Data Definition Language (DDL) Commands
(b) Data Manipulation Language (DML) Commands
(c) Data Control Language (DCL) Commands
(d) Data Query Language (DQL) Commands
(e) Transaction Control Language (TCL) Commands
5. A database system is a collection of interrelated data and software programs that allow users to store,
manage, retrieve and analyze data in an organized and efficient manner. It is a software system that is
designed to manage large amounts of data and provide access to that data to multiple users.
The need for a database system arises due to the following reasons:
(a) Data management
(b) Data security
(c) Data sharing
(d) Data consistency

6. Differentiate between DDL and DML commands

DDL Commands
(a) DDL stands for Data Definition Language.
(b) These commands allow us to perform tasks related to data definition, i.e., related to the structure
of the database objects (relations/databases).
(c) Examples of DDL commands are Create, Alter, Drop, etc.
(d) DDL is not further classified.

DML Commands
(a) DML stands for Data Manipulation Language.
(b) These commands are used to manipulate data, i.e., records or rows in a table or relation.
(c) Examples of DML commands are Insert into, Update, Delete, etc.
(d) DML is further classified into two types:
(i) Procedural DMLs
(ii) Non-procedural DMLs

7. Data type: Data type is an attribute of data that specifies the type of value that can be stored in a
column of a table. Data types define the size, format and range of values that can be stored in a column.
In MySQL, some of the commonly used data types are:
(a) INTEGER
(b) FLOAT
(c) NUMERIC
(d) DECIMAL
(e) CHARACTER (fixed length)
(f) CHARACTER (variable length)
(g) DATE
(h) TIME
46 Teacher’s Manual—Informatics Practices with Python–XI

8. Difference between CHAR and VARCHAR Data types

CHAR
(a) CHAR data type provides fixed-length memory storage. It specifies a fixed-length character string.
(b) The CHAR data type can store a maximum of 0 to 255 characters.
(c) CHAR data type is used when the data entries in a column are expected to be of the same size.
(d) CHAR(x) will reserve x characters of storage even if you enter less than x characters in that column.
(e) If a value entered is shorter than its length x, then blanks are added.
(f) CHAR data type takes memory space of 1 byte per character.
(g) Search operation is faster with CHAR data type column.
(h) For example, name char(10); name=”anu”; Here, the name field occupies 10 bytes, with the first
three bytes with values and the rest with blank data.

VARCHAR
(a) VARCHAR data type provides variable-length memory storage. It specifies a variable-length string
(changeable).
(b) The VARCHAR data type can store a maximum of 65,535 characters.
(c) VARCHAR data type is used when the data entries in a column are expected to vary considerably
in size.
(d) VARCHAR(x) will reserve only the required storage for the actual number of characters entered in
that column.
(e) No blanks are added if the length is shorter than the maximum length x.
(f) VARCHAR takes up memory space of 1 byte per character, +2 bytes to hold variable length
information.
(g) Search operation works slower in VARCHAR data type column as compared to CHAR type.
(h) For example, name varchar(10); name=”anu”; Here, name occupies only 3+2=5 bytes, with the first
three bytes for value and the other two bytes for variable-length information.
9. In SQL, the concat() function is used to concatenate two strings in a query result.
10. In SQL, we can calculate the product of two numbers, such as 13 and 15, by using the multiplication
operator (*). The syntax for this calculation is as follows:
SELECT 13 * 15;
11. DISTINCT keyword is used to remove duplicate rows from the results of a SELECT statement. It is
used to retrieve only unique values for a column in the table. The DISTINCT keyword can be used only
once with a given SELECT statement. Syntax:
SELECT DISTINCT <column_name> from <table_name>;
12. (a) SELECT * FROM Product WHERE prod_id > 100;
(b) SELECT * FROM Product WHERE prod_name = 'Almirah';
(c) SELECT * FROM Product WHERE price BETWEEN 200 AND 500;
(d) SELECT prod_name FROM Product WHERE quantity IS NULL;
(e) SELECT * FROM Product;
13. (a) Database: A database is defined as an organized collection of data (information) about an entity
(something that exists) or things. It is a shared collection of related data/information used to
support the activities and decision-making of a particular organization. It also allows the users to
enter, access and analyze their data quickly and easily. It serves as a container which may contain
various database objects. Database is integrated as well as shared.
Teacher’s Manual—Informatics Practices with Python–XI47

(b) Data inconsistency: data inconsistency is a condition in which the same piece of data is represented
differently in different parts of a database or in different databases. It can also occur when data is
entered incorrectly or incompletely, resulting in incorrect or incomplete information being stored in
the database.
(c) Primary Key: A primary key is a set of one or more attributes/fields which uniquely identifies a
tuple/row in a table. The salient features of a primary key are as follows:
• It is always unique in nature, i.e., non-redundant. It does not have duplicate values in a
relation.
• It arranges the table in its own order.
• It cannot be re-declared or left null.
• One table can have only one primary key.
(d) Candidate key: A candidate key is a column or set of columns in a database table that can be
used as a primary key. Like a primary key, it must be unique and not null, but it is not currently
designated as the primary key of the table. A table may have multiple candidate keys and one of
them can be selected as the primary key.
Alternate Key = Candidate Keys – Primary Key
14. (a) ALTER Change the name of a column
(b) UPDATE Update existing information in a table
(c) DELETE Delete an existing row from a table
(d) INSERT INTO Insert the values in a table
(e) CONSTRAINTS Restrictions on columns
(f) DESCRIBE Table Table definition
(g) CREATE Create a database

15. (a) ALTER and UPDATE


(i) The ALTER command is used to modify the structure of a table by modifying the definition of
its columns. The ALTER command is used to perform the following operations:
• To add a column to an existing table
• To rename any existing column
• To change the data type of any column or to modify its size
• To remove or physically delete a column
(ii) Update command: To modify data in a table or to make changes for some or all of the values
in the existing records in a table, we use the UPDATE command. The UPDATE command
specifies the rows to be modified using the WHERE clause and the new data is written into
the respective record using the SET keyword.
(b) DELETE and DROP
(i) DELETE command is used to remove one or more rows from a table based on a condition. It
is used to remove specific data from a table while keeping the table structure intact.
(ii) DROP command is used to remove an entire table, index, or view from the database. It
completely removes the table and all its associated data from the database.

16.(i) SELECT * FROM Store;


(ii) SELECT ItemNo, ItemName FROM Store WHERE Rate > 15;
(iii) SELECT * FROM Store WHERE SupplierCode = 22 OR QuantityInStore > 110;
(iv) TotalValue
880

17. (i) SELECT e.Name as EmployeeName, d.DependentName


FROM EMPLOYEE e
JOIN DEPENDENT d
ON e.EmpID = d.EmpID;
48 Teacher’s Manual—Informatics Practices with Python–XI

(ii) SELECT AadhaarNo, Name, Address, Department, EmpID


FROM EMPLOYEE
WHERE Department = 'PRODUCTION';
(iii) SELECT e.Name
FROM EMPLOYEE e
LEFT JOIN DEPENDENT d
ON e.EmpID = d.EmpID
WHERE d.DependentName IS NULL;
(iv) SELECT e.Name
FROM EMPLOYEE e
JOIN DEPENDENT d
ON e.EmpID = d.EmpID
WHERE e.Department = 'SALES'
GROUP BY e.EmpID, e.Name
HAVING COUNT(*) = 2;

18. (i) SELECT *


FROM BOOKS
WHERE Publishers = 'FIRST PUBL.' AND author_name = 'J. Mukhi';
(ii) SELECT SUM(Price) as TotalCost
FROM BOOKS
WHERE Publishers = 'FIRST PUBL.';
(iii) UPDATE BOOKS
SET Price = Price * 0.95
WHERE Publishers = 'EPB';
(iv) SELECT Book_name, Price
FROM BOOKS
WHERE qty > 3
GROUP BY book_id, Book_name, Price
HAVING COUNT(*) > 3;
(v) SELECT *
FROM BOOKS
WHERE qty > 30;

19. (a) Select * from PRODUCTS where STOCK > 110;


(b) Select COMPANY from PRODUCTS where WARRANTY > 2;
(c) Select STOCK + PRICE as ‘Stock’ from PRODUCTS where COMPANY = “BPL”;
(d) Select COUNT(PNAME) from PRODUCTS Group by COMPANY;
(e) Select PNAME from PRODUCTS where (sysdate- MANUFACTURE >= “2020/09/20”;

20. DDL is the acronym for the Data Definition Language. DML is the acronym for Data Manipulation
Language. DDL is used to create database schema and also define constraints as well. DML is used to
delete, update and update data in the database.

21. A primary key is a set of one or more columns that uniquely identify a row in a table and a candidate
key refers to all the attributes in a relation that are capable of becoming a primary key. A relation can
only have one primary key while multiple candidate keys (two or more) can take place in a table.
Teacher’s Manual—Informatics Practices with Python–XI49

22. Cardinality is defined as the number of rows in a table while a degree is the number of columns in a
table.

23. DDL (Data Definition Language) and DML (Data Manipulation Language) are two types of SQL
commands used in relational databases. The main differences between DDL and DML are:

DDL (Data Definition Language): DDL commands are used to define the database schema and to create
and modify database objects such as tables, indexes and constraints. For example, Create Table, Alter
Table commands.

DML (Data Manipulation Language): DML commands are used to manipulate the data in the database,
such as inserting, updating, deleting and querying data. The two basic commands in DML are Insert
Into and Update.

24. (a) SELECT *


FROM SchoolBus
WHERE Capacity > 70;
(b) SELECT Area_Covered
FROM SchoolBus
WHERE Distance > 20 AND Charges < 4000;
(c) SELECT Transporter, SUM(Charges) as TotalCharges
FROM SchoolBus
GROUP BY Transporter;
(d) SELECT Rtno, Area_Covered, (Charges/Noofstudents) as AvgCostPerStudent
FROM SchoolBus
WHERE (Charges/Noofstudents) = (SELECT AVG(Charges/Noofstudents) FROM SchoolBus);
(e) INSERT INTO SchoolBus (Rtno, Area_Covered, Capacity, Noofstudents, Distance,
Transporter, Charges)
VALUES (11, 'Motibagh', 35, 32, 10, 'Kisan Tours', 3500);

25. (a) Select * from FURNITURE where PRICE > 10000;


(b) Select ITEM, Price from FURNITURE where DISCOUNT BETWEEN 10 and 20;
(c) Delete from FURNITURE where DISCOUNT = 30;
(d) Select PRICE from FURNITURE where TYPE = “BabyCot”;
(e)
TYPE

DoubleBed
BabyCot

OfficeTable

26. (a) Select NAME from GRADUATE order by NAME where RANK=1;
(b) Select NAME from GRADUATE where AVERAGE > 65;
(c) Select NAME from GRADUATE where SUBJECT = “COMPUTER” AND AVERAGE > 60;
(d) SELECT NAME FROM GRADUATE;
(e)
S NO NAME STIPEND SUBJECT AVERAGE RANK

1 KARAN 400 Physics 68 1
5 GAURAV 500 Physics 70 1
9 PUJA 500 Physics 62 1
50 Teacher’s Manual—Informatics Practices with Python–XI

(f) RANK
1
1
2
1
1
2
1
1

27. (a) A candidate key refers to all the attributes in a relation that are candidates or are capable of
becoming a primary key.
Alternate Key: A candidate key that is not the primary key is called an alternate key. In other
words, any attribute that is a candidate for the primary key, i.e., which is capable of becoming a
primary key but is not a primary key, is an alternate key.
Alternate Key = Candidate Keys – Primary Key
(b) The degree of the table is 5 and the cardinality of the table is 10.
(c) (i) CREATE TABLE STUDENT (ROLLNO INT PRIMARY KEY, SNAME VARCHAR(25) NOT
NULL, GENDER CHAR(1) NOT NULL, DOB DATE NOT NULL, FEES INT NOT NULL,
HOBBY VARCHAR(15));
(ii) ALTER TABLE STUDENT MODIFY SNAME VARCHAR(30) NOT NULL;
(iii) ALTER TABLE STUDENT DROP COLUMN HOBBY;
(iv) INSERT INTO STUDENT (ROLLNO, SNAME, GENDER, DOB, FEES) VALUES (1, 'John
Doe', 'M', '2000-01-01', 5000);

28. (i) Select ProductName, Price from PRODUCT where Price between 50 and 150;
(ii) Select * from PRODUCT where Manufacture IN (“XYZ”, “ABC”);

Or
Select * from PRODUCT where Manufacture = “XYZ” or Manufacture= “ABC”;
(iii) Select ProductName, Manufacture, Price from PRODUCT where Discount IS NULL;
(iv) Select ProductName, Price from PRODUCT;
(v) Select ClientName, City, P_ID, ProductName From Client Where City = “Delhi”;
(vi) P_ID column can be used as a Foreign key in CLIENT table.

29.(i) Select Name from HOSPITAL where Dateofadm > “1998/01/15”;


(ii) Select Name from HOSPITAL where
Department = “ENT” and Sex = “F”;
(iii) Select Name, Dateofadm from HOSPITAL order by Dateofadm;
(iv) Select Name, Charges, Age from HOSPITAL where Sex = “F”;

Chapter 9: Emerging Trends


1. Artificial Intelligence (AI) is a field of computer science that involves the creation of intelligent machines
that can perform tasks that normally require human intelligence, such as recognizing speech, making
decisions and learning from experience. In today's world, AI is playing an increasingly important role
in many aspects of our lives. Here are some of the ways in which AI is significant:
(a) Automation
(b) Personalization
Teacher’s Manual—Informatics Practices with Python–XI51

(c) Healthcare
(d) Finance
(e) Education

2. Internet of Things or IoT refers to connecting many devices through hardware or software that
communicate with each other as well as with human beings through the internet to work in collaboration
and assist each other and form Internet of Things. Potential applications of IoT:
(a) Smart Home
(b) Wearables
(c) Smart City
(d) Smart Grids
(e) Industrial Internet

3. (a) Cloud computing is a technology of distributed data processing in which some scalable information
resources and capacities are provided as a service to multiple external customers through the
internet technology. It allows storing, accessing data and programs using the internet.
(b) The term Big Data refers to a huge volume of data that cannot be stored and processed by any
traditional data storage or processing units. Big data is generated on a very large scale and used
by many multinational companies to process and analyze in order to uncover insights and improve
the business of many organizations.
Characteristics of Big Data:
(i) Volume
(ii) Velocity
(iii) Variety
(iv) Veracity
(v) Value

4. AI traditionally refers to an artificial creation of human-like intelligence that can learn, reason, plan,
perceive or process natural language. The two words Artificial and Intelligence, where Artificial means
‘man-made’ and Intelligence means ‘thinking power’, together mean ‘a man-made thinking power’.

Some of the applications of AI include:


(a) Natural Language Processing (NLP)
(b) Computer Vision (CV)
(c) Robotics
(d) Predictive Analytics

Machine Learning is an application of Artificial Intelligence (AI). It focuses on providing systems which
enable the computer to automatically learn and improve without being explicitly programmed. Machine
Learning focuses on development of computer programs that can access data and use it themselves and
learn from it. Some of the applications of Machine Learning are:
(a) Image recognition
(b) Text and speech recognition
(c) Online fraud detection
(d) Email spam filtering
(e) Virtual personal assistant

5. Cloud computing and grid computing are both distributed computing models, but they have different
approaches and applications. Cloud computing involves delivering computing resources over the internet
on demand, while grid computing involves sharing computing resources across multiple locations or
organizations for large-scale computing projects.
52 Teacher’s Manual—Informatics Practices with Python–XI

Here are some examples of cloud computing and grid computing:

Cloud computing example: Amazon Web Services (AWS) is a popular cloud computing platform that
offers a wide range of services, including computing, storage and databases. For example: Netflix uses
AWS to stream videos to its customers.

Grid computing example: The Large Hadron Collider (LHC) at CERN is an example of a grid computing
project. The LHC involves a distributed computing model that allows researchers from around the
world to collaborate on experiments that require massive amounts of computing power. The computing
resources are shared across multiple locations, allowing researchers to analyze and process data from
the experiments.

6. The type of cloud computing model that fits the given requirements is Platform as a Service (PaaS).

7. Home automation refers to the use of technology to automate and control various household functions,
such as lighting, heating, air conditioning, security and entertainment systems. Home automation
systems typically consist of a central hub or control panel, smart devices that can be remotely controlled
and a network or communication protocol that connects them.

Here are some examples of home automation systems and devices:


(a) Smart lighting
(b) Smart thermostats
(c) Smart security systems
(d) Smart entertainment systems

8. On-demand service is one of the main features of cloud computing which allows the user to use resources
of the cloud as and when needed. The resources (software, hardware (servers), databases, storage, etc.)
of cloud computing are provided by companies called cloud service providers which usually charge on a
pay-per-use basis, like the way we pay for electricity usage.

9. Here are some ways in which each of the following can be implemented to transform a Regional
Engineering College into an IoT-enabled smart college:
(a) E-textbooks: E-textbooks can be made available to students through a web-based platform or a
mobile app. This platform can be integrated with IoT sensors to track student engagement with the
textbook, such as the amount of time spent on each page or the number of notes taken. This data
can then be used to provide personalized learning recommendations to students.
(b) Smart boards: Smart boards can be used to display digital content, such as presentations, videos
and interactive learning materials. These boards can be connected to the internet and integrated
with IoT sensors to provide real-time feedback on student engagement, such as the amount of time
spent on each task or the level of participation in group activities.
(c) Online tests: Online tests can be administered through a web-based platform that is integrated
with IoT sensors. These sensors can be used to monitor student behaviour during the test, such
as the time spent on each question and the number of attempts made. This data can be used to
improve the test-taking experience and to provide feedback to students on their performance.
(d) Wi-fi sensors on classroom doors: Wi-fi sensors can be installed on classroom doors to track
student attendance and movement within the college. These sensors can be integrated with a
centralized attendance system that is accessible to teachers and college administrators.
(e) Sensors in buses to monitor their location: IoT sensors can be installed on buses to monitor
their location in real-time. This data can be used to provide students with real-time updates on bus
schedules and to improve the efficiency of the college's transportation system.
(f) Wearables (watches or smart belts) for attendance monitoring: Wearables such as smart
watches or belts can be used to monitor student attendance and movement within the college.
These wearables can be integrated with IoT sensors and a centralized attendance system that is
Teacher’s Manual—Informatics Practices with Python–XI53

accessible to teachers and college administrators. This system can also be used to track student
engagement in physical activities and to promote healthy habits among students.

10. (a) Two examples of Augmented Reality are:


(i) Pokémon Go: It is a popular mobile game that uses augmented reality technology to allow
players to catch virtual Pokemon in real-world locations.
(ii) IKEA Place: It is an augmented reality app that allows users to preview how furniture would
look in their homes before making a purchase.
(b) The name of an Indian humanoid is “Mitra.” It is developed by Bengaluru-based Invento Robotics
and its purpose is to serve as a receptionist and customer service assistant. Mitra is equipped
with natural language processing and computer vision capabilities, allowing it to understand and
respond to customer queries in real-time. It is also capable of recognizing faces and providing
personalized greetings to returning customers. Mitra has been deployed in several locations in
India, including banks, airports and retail stores, to enhance customer service and engagement.
(c) (i) IoT: Internet of Things (IoT) is a network of devices that have an embedded hardware and
software to communicate (connect and exchange data) with other devices on the same network.
(ii) WoT: Web of Things (WoT) allows the use of web services to connect anything in the physical
world, besides human identities, on the web. It paves the way for creating smart homes, smart
offices, smart cities and so on.

You might also like