Textbook - Informatics With Python
Textbook - Informatics With Python
INFORMATICS PRACTICES
(CLASS XI)
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.
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
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.
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).
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.
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.
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
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.
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.
(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.
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.
15. Output:
2 5
10 Teacher’s Manual—Informatics Practices with Python–XI
17. Do it yourself.
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
Output:
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
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.
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,
(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
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.
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.
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.
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.
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
Compound statements are spread into multiple logical lines or several single statements but aligned
together into a single unit. Its syntax is:
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.
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)
(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".
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]
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
Output:
Output:
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:
Output:
Output:
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:
(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.
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:
Output:
Output:
Output:
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.
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.
Example:
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:
14. Output:
(a) 1
(b) 1
Output:
Output:
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.
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.
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
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.
9. Advantages of a DBMS
(a) Control of data redundancy
(b) Data consistency
Teacher’s Manual—Informatics Practices with Python–XI41
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.
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.
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
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.
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.
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
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
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
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.
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.
(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’.
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
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.
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.