c11 Ip SSM Final 2025 - 26
c11 Ip SSM Final 2025 - 26
विद्यालयी वशक्षा में शैवक्षक उत्कृष्टता प्राप्त करना एिं निाचार द्वारा उच्च – निीन मानक
स्थावित करना केन्द्रीय विद्यालय सं गठन की वनयवमत कायय प्रणाली का अविभाज्य अंग है ।
राष्टरीय वशक्षा नीवत 2020 एिं िी. एम. श्री विद्यालय ं के वनदे श ं का िालन करते हुए
गवतविवि आिाररत िठन-िाठन, अनुभिजन्य वशक्षण एिं कौशल विकास क समावहत कर,
अिने विद्यालय ं क हमने ज्ञान एिं ख ज की अद् भुत प्रय गशाला बना वदया है । माध्यवमक
स्तर तक िहुुँ च कर हमारे विद्याथी सैद्ां वतक समझ के साथ-साथ, रचनात्मक – विशे षणात्मक
एिं आल चनात्मक वचंतन भी विकवसत कर ले ते हैं । यही कारण है वक िह ब र्य कक्षाओं के
दौरान विवभन्न प्रकार के मूल्ां कन ं के वलए सहजता से तैयार रहते हैं । उनकी इस यात्रा में
हमारा सतत य गदान एिं सहय ग आिश्यक है - केन्द्रीय विद्यालय सं गठन के िां च ं आं चवलक
वशक्षा एिं प्रवशक्षण संस्थान द्वारा सं कवलत यह विद्याथी सहायक- सामग्री इसी वदशा में एक
आिश्यक कदम है । यह सहायक सामाग्री कक्षा 9 से 12 के विद्यावथयय ं के वलए सभी
महत्विूणय विषय ं िर तैयार की गयी है । केन्द्रीय विद्यालय सं गठन की विद्याथी सहायक-
सामग्री अिनी गु णित्ता एिं िरीक्षा संबंिी - सामग्री संकलन की विशेषज्ञता के वलए जानी जाती
है और वशक्षा से जुड़े विवभन्न मंच ं िर इसकी सराहना ह ती रही है। मुझे विश्वास है वक यह
सहायक सामग्री विद्यावथय य ं की सहय गी बनकर वनरं तर मागयदशयन करते हुए उन्हें सफलता के
लक्ष्य तक िहुुँ चाएगी।
निनि प ांडे
PATRON
EDITORS:
S NO TOPIC
1 SYLLABUS
2 Unit -1 Introduction to Computer System
• Introduction to Computer and computing
• Computer Memory
• Software and types of software
3 Unit-2 Introduction to Python
➢ Basics of Python programming
➢ Statements, Control Statements
➢ Lists
➢ Dictionary
➢ Introduction to NumPy
4 Unit 3: Database concepts and the Structured Query Language
➢ Database Concept and types of SQL Command
➢ Data Query Language
5 Unit 4: Introduction to the Emerging Trends
6 Solved Question Papers (Two)
7 Unsolved Questions Papers (Three)
1. Prerequisite. None
2. Learning Outcomes At the end of this course, students will be able to:
● Identify the components of computer system.
● Create Python programs using different data types, lists and dictionaries.
● Understand database concepts and Relational Database Management Systems.
● Retrieve and manipulate data in RDBMS using Structured Query Language
● Identify the Emerging trends in the fields of Information Technology.
3. Distribution of Marks:
Unit No. Unit Name Marks
1 Introduction to Computer System 10
2 Introduction to Python 25
3 Database Concepts and the Structured Query 30
Language
4 Introduction to Emerging Trends 5
Practical 30
Total 100
1|Page
Unit Wise syllabus:
Unit 1: Introduction to Computer System
Introduction to computer and computing: evolution of computing devices, components of a
computer system and their interconnections, Input/output devices.
Computer Memory: Units of memory, types of memory – primary and secondary, data
deletion, its recovery and related security concerns.
Software: purpose and types – system and application software, generic and specific purpose
software.
2|Page
Practical Marks Distribution
Suggested material
NCERT Informatics Practices - Text book for class - XI (ISBN- 978-93-5292-148-5)
3|Page
Unit 1: Introduction to Computer System
Mind Map
4|Page
3. Components of a computer system:
● Components: The hardware includes the CPU, memory, input/output devices, and
storage.
● Types of memory:
Primary Memory:
RAM (Volatile) – Random Access Memory stores data temporarily.
▪ It is a volatile memory that means it lose the data when power is turned off.
▪ A computer can't operate/run without primary memory.
▪ It is faster than secondary storage memory.
▪ Types of RAM (SRAM, DRAM)
ROM (Non-volatile) – it retains its information even when the power is turned
off. It stores the boot-up instructions and it is primarily used for a computer to
5|Page
start. Instructions in the ROM written by the Programmer and it is called as
firmware and BIOS.
Firmware is software that provides basic machine instructions
Types of ROM:
• PROM Programmable Read Only Memory
• EPROM Erasable Programmable Read Only Memory
• EEPROM Electronic Erasable Read Only Memory
Cache Memory:
Cache memory is a high-speed memory located inside or very close to the CPU. It
stores the most frequently used data and instructions, allowing the CPU to access
them more quickly than if it had to fetch them from RAM.
→Cache is much faster than RAM but also more expensive and has a smaller storage
capacity.
→It helps in reducing the time taken to access data, thereby improving the overall
performance of the computer.
o High-speed temporary storage between CPU & RAM.
Secondary Memory:
Secondary memory is used for the permanent storage of data, files, software, and the
operating system. it is non-volatile Memory meaning data is not lost when the computer
is turned off.
➤ Characteristics of Secondary Memory:
• It is not directly accessible by the CPU; data must be loaded into primary memory
(RAM) before processing.
• It has large storage capacity compared to primary memory.
• It is slower than primary memory, but suitable for long-term data retention.
➤ Examples of Secondary Storage Devices:
Hard Disk Drive (HDD), Solid State Drive (SSD), Optical Disks (CD/DVD), Flash Drives
(Pen Drive, Memory Cards/SD Cards)
6|Page
6. Software:
Software is a collection of programs that enables hardware to function. It governs the
operations of a computer system and is used for various purposes.
There are three types of software:
A. System Software: It act as an interface between user and hardware. System software is
a type of software that controls and manages the hardware components of a computer
and helps to install or run application software.
a) Operating System (OS):
• Acts as an interface between user and hardware.
• Manages files, memory, processes, and devices.
• Examples: Windows, Linux, macOS, Android
b) System Utilities:
• Programs that perform maintenance and support tasks.
• Examples: Antivirus, Disk Cleanup, File Compression Tools (WinZip)
c) Device Drivers:
• Specialized software that allows the OS to communicate with hardware devices.
• Each device (printer, keyboard, etc.) needs its own driver.
• Example: Printer Driver, Graphics Driver
7|Page
a) Software b) Program c) Hardware d) Both a) and c
3 Which of the following is not a component of computer system?
a) Processor b) MS Office c) Motherboard d) Keyboard
4 The full form of ALU is:
a) Abacus Logarithmic Unit b) Arithmetic and Logical Unit
c) Abacus Language Unit d) Arithmetic and Language Unit
5 While troubleshooting a computer system, a technician explains that both logical
decisions and arithmetic operations are being handled simultaneously. Which component
is responsible for this task?
a) Control Unit b) Memory Unit c) Arithmetic Logic Unit d) Input Unit
6 Arrange the following in increasing order of the number of transistors on a single chip:
i) SLSI , ii) IC , iii) VLSI , iv) LSI
a) ii) IC → iv) LSI → iii) VLSI → i) SLSI
b) ii) IC → iii) VLSI → iv) LSI → i) SLSI
c) iv) LSI → ii) IC → iii) VLSI → i) SLSI
d) i) SLSI → ii) IC → iii) VLSI → iv) LSI
7 Which of the following is the fastest memory?
a) RAM b) Cache c) ROM d) Hard Disk
8 Which two digits does the binary number system consist of?
a) 1, 2 b) 0, 1 c) a, b d) i, ii
9 Which of the following is a volatile memory?
a) RAM b) CD c) ROM d) Hard Disk
10 Arrange the following units of memory in decreasing order of storage:
i) KB (Kilobyte) ii) GB (Gigabyte) iii) MB (Megabyte) iv) TB (Terabyte)
a) iv) TB → ii) GB → iii) MB → i) KB
b) ii) GB → iv) TB → i) KB → iii) MB
c) iv) TB → iii) MB → i) KB → ii) GB
d) iv) TB → ii) GB → i) KB → iii) MB
8|Page
5 (c) Arithmetic Logic Unit
6 (a) ii) IC → iv) LSI → iii) VLSI → i) SLSI
7 (b) Cache
8 (b) 0, 1
9 (a) RAM
10 (a) iv) TB → ii) GB → iii) MB → i) KB
11 (b) Speakers
12 (c) Bus
9|Page
Answer (Assertion and Reasoning Questions)
Remember:
ICs : Integrated Circuit Chips
LSI: Large Scale Integrated Circuit Chips
VLSI: Very Large Scale Integrated Circuit Chips
5 Relate any early computing machine to today’s computer systems in terms of design
similarity.
Answer: EDVAC is considered similar to modern computers as it used the stored-
program concept, influencing current CPU architecture.
10 | P a g e
6 Write the use of printer based on its function in a computer system.
Answer: A printer is an output device because it produces hard copies of digital
documents.
72. Differentiate between an operating system used in mobile devices and one used in
computers.
Answer: Android is a mobile OS designed for touchscreen interfaces, while Windows is a
computer OS supporting multitasking on desktops and laptops.
8 Explain the impact of John von Neumann's concept on modern computing.
Answer: He introduced the stored-program concept, enabling programs to be stored in
memory, forming the foundation of modern computer architecture.
9 Discuss how the Control Unit contributes to the execution of instructions within the CPU.
Answer: The Control Unit (CU) directs the operation of the processor by fetching,
decoding, and coordinating instruction execution.
10 Justify the importance of USB in modern computing environments.
Answer: USB (Universal Serial Bus) standardizes connections for data transfer and
peripheral communication, enhancing device compatibility and ease of use.
11 Provide an example of an optical storage medium and explain its use.
Answer: A CD (Compact Disc)/DVD is a Secondary Storage device that is used to store
data like music, videos, or software and is read by an optical drive(CD/DVD Drive)
12 Explain why a bit is considered the smallest unit of memory in a computer system
Answer: A bit (binary digit) represents the most basic unit of data, holding a value of
either 0 or 1, forming the basis for all computing processes.
13 Demonstrate how an operating system facilitates interaction between hardware and
users.
Answer: The operating system manages hardware resources like CPU and memory, and
provides a user interface for interaction with applications.
11 | P a g e
4 List out four differences between RAM and a Hard Disk.
Answer:
● RAM is volatile; a Hard Disk is non-volatile.
● RAM is faster; Hard Disks are slower.
● RAM stores data temporarily, while the Hard Disk stores data permanently.
● RAM has less storage capacity, while Hard Disks have a large storage capacity
5 Give two reasons for data deletion. How can data deletion by unauthorized persons be
prevented?
Answer:
● Reasons: Accidental deletion, malware attacks
● Prevention: Use strong passwords and allow authorized user to work on the
computer or digital device.
6 Give two differences between a compiler and an interpreter.
Answer:
● A compiler translates the whole program at once; an interpreter translates line by
line.
● A compiler is faster for execution; an interpreter is slower.
12 | P a g e
Answer:
Explanation of Each Component:
● Input Unit:
Devices like a keyboard, mouse, scanner, and microphone are used to provide
o
data and instructions to the computer.
● Central Processing Unit (CPU):
Also called the brain of the computer, it processes instructions and controls
o
system operations.
o Control Unit (CU): Directs the operations of the processor.
o Arithmetic Logic Unit (ALU): Performs mathematical calculations and logical
operations.
● Memory Unit:
o RAM (Random Access Memory): Volatile memory that stores data and
instructions temporarily.
o ROM (Read-Only Memory): Non-volatile memory that stores firmware and
essential booting instructions.
● Output Unit:
Devices like a monitor, printer, and speakers that display or present the
o
processed data.
● Storage Unit (Secondary Storage):
o Includes Hard Disk Drives (HDD), Solid State Drives (SSD), CDs, DVDs, and USB
drives to store data permanently.
Q2. What is hardware? What type of software is required to run hardware devices? Give one
example.
Answer:
● Hardware:
o Hardware refers to the physical components of a computer system, including
input devices, output devices, memory, and the processor.
13 | P a g e
Examples: Keyboard, Mouse, Monitor, Hard Disk, Printer.
o
● Software Required to Run Hardware Devices:
o Device Drivers: These are specialized programs that allow the operating system
to communicate with hardware components.
o Example: A printer driver is required to make the printer function correctly with
a computer.
Q3. Name the memory that is fastest in a computer system. What is the role of such memory,
and where is it placed?
Answer:
● Fastest Memory: Cache Memory
● Role of Cache Memory:
o Cache memory stores frequently used data and instructions close to the CPU.
o It reduces the time taken to access data from the main memory (RAM), thereby
improving system speed and efficiency.
● Placement of Cache Memory:
o It is located between the CPU and RAM or integrated directly inside the CPU
chip
Q4. What is the purpose of using secondary memory? Give some examples of secondary
memory devices. What is the storage capacity of a CD?
Answer:
● Purpose of Secondary Memory:
o Secondary memory is used to store data permanently and retrieve it when
required.
o it supports long-term data storage and retains data even when the power is
turned off
● Examples of Secondary Memory Devices:
o Hard Disk Drive (HDD)
o Solid State Drive (SSD)
o Compact Disc (CD)
o Digital Versatile Disc (DVD)
o Pen Drive (USB Flash Drive)
● Storage Capacity of a CD:
o A CD-ROM (Compact Disc Read-Only Memory) typically has a storage capacity of
700 MB (Megabytes).
● RAM
● Hard Disk
● Processor
● Motherboard
14 | P a g e
c) If upgrading RAM is not an option, suggest one other way to improve the system’s speed.
d) Rohit also wants to increase storage capacity. Which type of storage device should he
choose for faster performance: HDD or SSD? Why?
e) What utility software can help optimize system performance?
Answer:
a) The component most responsible for multitasking performance is: RAM
b) Role of RAM in a computer’s performance:
RAM (Random Access Memory) temporarily stores data that the CPU needs while running
applications. More RAM allows smoother multitasking and faster performance.
c) Alternative way to improve system speed if upgrading RAM is not an option:
Use an SSD (Solid State Drive) instead of an HDD to speed up data access and system
performance.
Q2. Computers have transformed our lives, bringing both advantages and challenges. Analyze
the following aspects and state whether they have a positive or negative impact:
Answer:
Impact of Computers on Society
b) Health concerns: Negative impact: Prolonged computer usage can cause eye strain, back
pain, and carpal tunnel syndrome.
c) Social networking: Both positive and negative: It improves communication but can also
lead to social isolation if people spend too much time online instead of engaging in face-to-face
interactions.
15 | P a g e
e) Cybersecurity issues: Negative impact: Increased digitization has led to cyber threats like
hacking, phishing, and data breaches.
Q3. Neha was working on an important project but forgot to save her work. Unfortunately, her
system crashed due to power failure.
Give suitable Answer of the following:
a) Will she be able to recover the unsaved data? Why or why not?
b) Which type of memory is responsible for temporary storage, and why is it lost after
shutdown?
c) Suggest one precaution Neha can take in the future to avoid data loss.
d) Name a hardware device that can help prevent unexpected shutdowns.
e) Between an external hard disk and a USB pen drive, which is better for long-term data
storage, and why?
Answer:
Neha’s Data Loss Due to Power Failure
a) She can recover unsaved data it depends on some software (like MS Word) has an auto-
recovery feature. But if the data wasn’t auto-saved, it is lost.
b) Memory is responsible for temporary storage:
RAM stores temporary data, but it is volatile, meaning data is lost after shutdown.
c) Precautions to avoid data loss in the future:
Enable AutoSave in applications or manually save work frequently.
d) Hardware device to prevent unexpected shutdowns:
UPS (Uninterruptible Power Supply) provides backup power during outages.
e) Better long-term storage device:
External Hard Disks are better for long-term storage because they offer more capacity and
durability than a USB pen drive.
Q4. Arjun is an architect who wants to create digital blueprints for his clients.
Answer the following:
a) Should he use traditional paper-based drawing or digital design software? Which one is
more efficient?
b) If he prefers digital drawing, which input device is best suited for sketching?
c) What type of display device (monitor) would be best for detailed architectural designs?
d) Which software should he use for designing professional architectural blueprints?
e) What kind of printer should he use for high-quality, large-scale prints of his designs?
Answer:
Arjun’s Architectural Design Needs
a) More efficient method for blueprints:
Digital design software is more efficient as it allows easy modifications, scaling, and 3D
modeling.
b) Best input device for digital sketching:
Graphics tablet (e.g., Wacom tablet) for precise sketching.
c) Best monitor for detailed designs:
16 | P a g e
4K Ultra HD monitor with high color accuracy and large screen size.
d) Best software for architectural blueprints:
AutoCAD, Revit, and SketchUp are widely used in architecture.
e) Best printer for large-scale prints:
Plotter printer (suitable for high-quality, large-scale architectural prints).
Answer:
Graphics Card and Performance
a) Primary function of a graphics card:
It processes and renders graphics for gaming, video editing, and visual applications.
b) Do all computers need a dedicated GPU?
No, basic tasks (browsing, office work) can be handled by integrated graphics.
c) Applications that require a high-performance GPU:
Gaming, 3D rendering, video editing, and AI-based applications.
d) Difference between dedicated and integrated graphics cards:
Dedicated GPU: Has its own memory (VRAM) for better performance.
Integrated GPU: Uses system RAM and shares CPU resources.
e) Do casual users need a dedicated GPU?
No, integrated graphics are sufficient for watching movies and browsing.
Q6. Mr. Sharma wants to buy a laptop but is confused between two models: one with DOS and
the other with pre-installed Windows.
Answer the following:
1. Why is the laptop with Windows more expensive than the one with DOS?
o a) DOS version is not user-friendly.
o b) DOS version does not support installing other software.
o c) Windows comes pre-installed, and its cost is included in the laptop price.
o d) None of the above.
2. If Mr. Sharma buys the DOS version, what additional software does he need to install
first?
o a) Utility software b) Application software
o c) Operating system d) None of the above
3. Mr. Sharma wants to create spreadsheets. Which software should he install?
o a) MS Excel b) MS Word
o c) MS PowerPoint d) All of the above
4. What software should he install to protect his laptop from viruses?
o a) Windows Media Player b) Windows Defender (Antivirus)
o c) MS Office d) None of the above
17 | P a g e
5. Which software should he install to browse the internet?
o a) Internet Explorer b) Mozilla Firefox
o c) Google Chrome d) All of the above
Answer:
Mr. Sharma’s Laptop Purchase Decision
1.(c) Windows comes pre-installed, and its cost is included in the laptop price.
2.(c) Operating system (like Windows or Linux).
3.(a) MS Excel
4.(b) Windows Defender (Antivirus)
5 (d) All of the above (Internet Explorer, Mozilla Firefox, Google Chrome).
Q7. Rahul frequently uses his personal computer for online banking, shopping, and
work-related activities. Recently, he noticed some unusual transactions in his bank
account, which made him suspect a security breach.
Answer the following:
a) What could be the most likely cause of Rahul’s security breach?
• Weak Passwords
• Malware or Keyloggers
• Phishing Attacks
• All of the above
b) What precaution should Rahul take to create a strong password? Name two key
characteristics of a strong password.
c) Which type of software should Rahul install to protect his computer from viruses and
malicious attacks?
d) Rahul frequently connects to public Wi-Fi. What security risk does this pose, and how can he
protect himself?
e) Name two online safety practices Rahul should follow to avoid phishing attacks and
unauthorized access to his accounts.
Answers:
a) All of the above (Weak passwords, malware, and phishing attacks can all lead to security
breaches).
Q8. Aman is starting his own e-commerce business. He needs various types of software
to manage inventory, process online orders, and secure customer data.
18 | P a g e
Answer the following:
a) Which category of software should Aman use to manage customer data and transactions
efficiently?
• System Software
• Application Software
• Utility Software
• Firmware
b) Aman needs to track inventory and sales. Should he use general-purpose software or
customized software? Justify your answer.
c) To secure customer data, which type of utility software should Aman install?
d) Aman is using an open-source e-commerce platform. What is the main advantage of open-
source software?
e) Name one programming language that Aman can use to develop a customized website for
his business.
Answers:
a) Application Software (It helps manage business operations like customer data and
transactions).
b) Customized software is better because it can be tailored to Aman's business needs and
offer specific features for inventory management.
c) Antivirus and Encryption Software (to protect sensitive customer data from cyber
threats).
d) Advantage of Open-Source Software: It is free to use, customizable, and has community
support.
e) Programming language: Python, JavaScript, PHP, or Java (commonly used for web
development).
19 | P a g e
Unit 2: Introduction to Python
BASICS OF PYTHON
Mind Map
20 | P a g e
2. Execution Modes:
Python can be run in two primary execution modes:
• Interactive Mode:
○ You enter individual Python commands or expressions, and the interpreter
immediately executes and displays the result.
○ This mode is great for quick testing and exploring code snippets.
○ Example: Open the Python shell and type print("Hello, World!") to
immediately get the result.
In Interactive mode, commands are given in front of Python command prompt
>>>
Example
>>> 10+ 15
25
>>> print (‘Hello, World’)
Hello, World
Interactive Mode is helpful for testing statement/code, you type the
commands, commands are executed one by one and get the result or error one
by one.
• Script Mode:
○ Python program is written in a file(.py), which are then executed as a whole by
the Python interpreter.
○ This mode is suited for developing larger programs or when you want to run a
sequence of Python commands that are stored in a file.
21 | P a g e
3. The Structure of a Program
The structure of a Python program typically consists of the following elements:
• Modules: Python code is often organized into modules, which are files containing
Python definitions and statements.
• Functions: Functions are defined using the def keyword and are used to encapsulate
code that performs specific tasks.
• Statements and Expressions: A statement in Python represents an action (e.g., print
()), while an expression computes a value (e.g., x + y).
• Control Flow: Conditional statements (if, else, elif) and loops (for, while) direct the
flow of execution.
4. Indentation
In Python, indentation is critical and is used to define the structure of code blocks. Unlike
many other programming languages, Python does not use braces {} to define blocks of code
(like loops or functions). Instead, it uses whitespace indentation.
• Error if Inconsistent: If you mix spaces and tabs, or if the indentation is inconsistent,
Python will throw an IndentationError.
Example:
if a==0:
print("Hello, World!") # print statement part of if condition
print(“Hello, World!”) # print statement not a part of if condition
5. Identifiers
Identifiers in Python are names used to identify variables, functions, classes, and other
objects.
• Rules for Identifiers:
○ Must begin with a letter (A-Z or a-z) or an underscore (_).
○ Can be followed by letters, digits (0-9), or underscores.
○ Case-sensitive: Schoolname, SchoolName, and SCHOOLNAME all three are
different identifiers in python.
22 | P a g e
○ Cannot be a keyword (e.g., if, else, def, etc.).
Example: my_variable = 10
6. Keywords
Keywords are reserved words in Python that have special meaning and cannot be used as
identifiers.
Example: if, else, elif, for, while, def, class, import
7. Constants
Values that do not change during execution of program are called constants. In Python, there
are no built-in constants (values that cannot be changed once set). However, it’s a common
convention to use uppercase letters for constant-like values, signaling that they should not
be changed.
○ Example: PI = 3.14159 MAX_USERS = 1000
8. Variables
A variable in Python is an identifier whose value can be changed. Python is a dynamically
typed language, meaning the type of a variable is determined at runtime, based on the value
it holds.
• Declaring Variables: You don't need to specify the type of the variable; Python
automatically assigns the appropriate type based on the value.
o Example:
▪ age = 25 # This assigns an integer value to 'age'
▪ name = "John" # This assigns a string value to 'name'
• Reassigning Variables: Python allows the reassignment of variables to different data
types.
age = 25 # ‘age’ contains value of integer type
age = "twenty-five" # now 'age' contains value of string type
9. Types of Operators
Python supports various types of operators to perform operations on variables and values:
• Arithmetic Operators (+, -, *, /, //, %, **): Used for mathematical calculations.
Operator Description Example
X=10, y=20
+ Addition To adds values on either side of the operator. >>>X + y
>>>30
- Subtraction Subtracts right hand operand from left hand >>>X – y
operand. >>>-10
* Multiplication Multiplies values on either side of the operator >>>X * y
>>>200
/ Division Divides left hand operand by right hand operand >>>X / y
23 | P a g e
>>>2
// Floor The division of operands where the result is the >>>9//2
quotient in which the digits after the decimal
Division >>>4
point are removed. But if one of the operands is
negative, the result is floored, i.e., rounded away ------------------
from zero (towards negative infinity) −
>>>9.0//2
>>>4.0
X=’Welcome’ Y=2
>>>X*Y
>>>WelcomeWelcome
• Comparison Operators (==, !=, >, <, >=, <=): Used to compare two values.
It either returns True or False according to the given condition.
24 | P a g e
<= If the value of left operand is less than or equal to the >>>(X <= y)
value of right operand, then condition becomes true.
>>>False
Note: These operators can also be used for comparing string values, through the
use of ASCII value of a String. ASCII value of A=65, Z=90, a=97, z=122
• Assignment Operators (=, +=, -=, *=, /=,%=,**=,//=): Used to assign values to
variables. It assigns values from right side operands to left side operand
Operator Description Example
25 | P a g e
or Logical OR: True if either of the operands is true X>Y or Y<Z
otherwise False
True
not Logical NOT: True if operand is False and vice not (X>Y)
versa False
not(X>Y and Y>Z)
False
• Membership Operators (in, not in): Used to test membership in a sequence such as
strings, lists, or tuples. There are two membership operators as explained below –
• Identity Operators (is, is not): Used to compare the memory location of two
objects.
is, is not are the identity operators both are used to check if two values are located on
the same part of the memory. Two variables that are equal does not imply that they are
identical.
26 | P a g e
• Bitwise Operators(&, |, ^, ~, <<, >>): Used for bit-level operations.
It is in descending order (upper group has higher precedence than the lower ones.)
27 | P a g e
• Numeric Types:
○ int: Integer numbers (e.g., 5, -3).
○ float: Floating-point numbers (e.g., 3.14, -0.001).
• Sequence Types:
○ str: Strings (e.g., "Hello", 'Python').
○ list: Ordered, mutable collections (e.g., [1, 2, 3]).
○ tuple: Ordered, immutable collections (e.g., (1, 2, 3)).
• Mapping Type:
○ dict: Key-value pairs (e.g., {"name": "John", "age": 25}).
• Boolean Type:
○ bool: True or False.
12. Mutable and Immutable Data Types
• Mutable Types: These are data types/objects whose content or values can be
changed after they are created.
○ Examples: list, dict.
○ These objects can be modified in place, so changes to a mutable object will
affect all references to that object.
• Immutable Types: These are data types whose content or values cannot be changed
after they are created.
○ Examples: int, str, tuple.
○ When an immutable object is modified, a new object is created, leaving the
original object unchanged.
Example of Mutability:
a = [1, 2, 3]
b=a
a.append(4) # Modifies the original list
print(b) # Output: [1, 2, 3, 4]
print(a) #Output: [1, 2, 3, 4]
print(id(a)) # gives memory location of object
print(id(a)) # gives memory location of object
both a and b variable having same location in memory
28 | P a g e
4 What is the correct way to assign a value to a variable in Python?
A) x == 5 B) 5 = x C) x = 5 D) x := 5
5 Which operator is used for exponentiation in Python?
A) ^ B) ** C) exp() D) %
6 Predict the output of the following code:
print(3**2+55/11*-(-3+3))
A) -39.0 B) 27.0 C) -14.0 D) 9.0
29 | P a g e
or a null value. It is often used to signify that a variable does not have any value
assigned to it yet.
2 What is a variable in Python, and how is it different from a constant?
Ans. A variable is a name that refers to a value that can be changed during the
execution of the program, while a constant represents a value that remains
unchanged throughout the program.
3 Differentiate between Keywords and Literals (Constants).
Ans. Python Keywords are some predefined reserved words in Python that
have special meaning.
Identifier is a user-defined name given to a variable, function, class, module,
etc. The identifier is a combination of character digits and an underscore. They
are case-sensitive i.e., 'num' and 'Num' and 'NUM' are three different identifiers
in python. It is a good programming practice to give meaningful names to
identifiers to make the code understandable.
4 Arrange the precedence of operators from highest to lowest
+ , ** , // , ==
Ans. precedence of operators from highest to lowest
**, //, +, ==
3 Write a Python program to find the average of three numbers where value of
a is 10, b is 20 and c is 30.
30 | P a g e
Ans:
4 Predict Output –
a, b, c = 2, 3, 4
a, b, c = a*a, a*b, a*c
print(a, b, c)
Ans. 4 6 8
5 Predict the Output –
a, b, c = 10, 20, 30
p, q, r = c-5, a+3, b-4
print('a, b, c : ', a, b, c, end = '### ')
print('p, q, r : ', p, q, r, sep = '$$ ')
Ans: a, b, c : 10 20 30###p, q, r : $$25$$13$$16
6 Payal is working in a firm and given a task to find the average of two numbers
x=7
y=5
print(x+y/2)
she is not getting the correct average, give your suitable answer and rectify the
code
Ans:
x=7
y=5
print((x+y)/2)
both x and y should be in parenthesis and both divided by 2 then she will
be able to find correct average
13. Statements
• Instructions executed by the Python interpreter.
31 | P a g e
• Types of statements:
o Empty statement: – Statement which does nothing. It is as follows:
15. Comments
• Used to annotate code and make it more understandable.
• Single-line comments: Begin with # symbol
e.g., #This is a comment.
32 | P a g e
o input (): Reads a line of text input from the user (e.g., name = input ("Enter your name: ")).
o Always returns a string.
• Output:
o print (): Outputs text or variables to the console (e.g., print ("Hello, World!")).
o Can accept multiple arguments separated by commas (e.g., print ("Name:", name)).
o Optional arguments like sep and end to customize the output
e.g., print ("Hello", "World", sep="-")
x=15
print ("Value of x:", x) #output Value of x: 15
33 | P a g e
1. Child seated with mother to discuss about decoration of house for celebrating his birthday
2. They discuss all 3 options to decorate the house with balloon or flower or pictures
(sequentially child think about every option with its cost)
3. child think about all options and choose one option (he selects decoration of house with
ballons) due to less cost. Selection statement→use of [if/ elif /else]
4. Child start inflating balloons one by one until 50 balloons are inflated with the help of
pump. (Repetition of task; inflation of balloon -> iteration statement → use of [for/
while]
Note: student use this real-life example and make python program after learning python
control statements
Selection Statements
• if statement:
• Executes a block of code if a condition is true.
• Example:
• if-else statement:
• Executes one block of code if a condition is true, and another block if it is false.
• Example:
• if-elif-else Statement:
• Checks multiple conditions in sequence, executing the first block of code where the
condition is true.
• Example:
Iterative Statements
While Loop:
• Repeats a block of code as long as a condition is true.
Example:
34 | P a g e
For Loop
• Iterates over a sequence (e.g., list, tuple, string) or range of numbers.
Syntax: for <variable> in <sequence>
statements_ to_repeat
• Example:
Jump statements
Python offers two types of jump statements to be used within loops to jump out of loop
iterations.
• break
Break statement is a jump statement which terminates the very loop it lies
within and skips over a part of the code(i.e. rest of the loop) and jumps over to the
statement following the loop.
• continue
Continue is a jump statement which forces the next iteration of the loop to take
place and skip the rest of the loop statements.
• Examples:
35 | P a g e
2. What is the primary purpose of the if statement in Python?
a) To execute a block of code based on a condition
b) To perform mathematical operations
c) To repeat a block of code
d) To define a function
3. Ravi is a student of class xi computer sci and he is not able to understand the
concept of if statement of Python and you as a programmer help him to find out the
correct output of the following code snippet?
x = 10
if x > 5:
print("x is greater than 5")
a) x is greater than 5 b) x is less than 5
c) x is equal to 5 d) No output
4. Which keyword is used to execute a block of code if the condition in the if statement
is false?
a) while b) elif c) else d) for
5. What is the purpose of the elif statement in Python?
a) To define a loop b) To perform arithmetic operations
c) To exit from a loop d) To execute a block of code if the previous conditions are false
6. Sunita is a student of class xi computer sci and he is not able to understand the
concept of if-elif statement of Python and you as a programmer help him to find out
the correct output of the following code snippet?
x=5
if x < 3:
print ("x is less than 3")
elif x == 3:
print ("x is equal to 3")
else:
print ("x is greater than 3")
a) x is less than 3 b) x is equal to 3 c) x is greater than 3 d) No output
7. How can you execute multiple statements under a single if block in Python?
a) Separate statements with a semicolon
b) Indent the statements to the same level
c) Use the and keyword between statements
d) Use the elif keyword
8. You as a programmer of python in a company, Find out the correct output
of the following code
x = 10
if x < 5:
print ("x is less than 5")
elif x > 15:
print ("x is greater than 15")
else:
36 | P a g e
print ("x is between 5 and 15")
a) x is less than 5 b) x is greater than 15
c) x is between 5 and 15 d) No output
9. What is the purpose of the while loop in Python?
a) To execute a block of code repeatedly until a condition is false
b) To execute a block of code a fixed number of times
c) To define a function
d) To iterate over items in a sequence
10. What is the syntax of while loop in Python?
a) while condition (): b) while condition:
c) while condition loop: d) while loop condition:
11. How can you exit a loop prematurely in Python?
a) Using the break statement b) Using the continue statement
c) Using the pass statement d) Using the exit function
12 Meera created a List named fruits in python and he want to access each element
of a List. She writes below code but she is not sure whether below code is correct
or not. Help her to find the correct output from the given options
fruits = ["apple", "banana", "cherry"]
for fruit in fruits:
print (fruit, end=’ ’)
a) No Output b) [“apple”, “banana”, “cherry”]
c) 0 1 2 d) apple banana cherry
13. What will the following code snippet print?
for i in range (2,-1,-1):
print (i, end=' ')
a) 0 1 2 b) 1 2 3 c) 2 1 0 d) 3 2 1 0
14. What is the purpose of the pass statement in Python?
a) To exit from a loop prematurely
b) To skip the current iteration of a loop
c) To execute a block of code if a condition is false
d) To do nothing and act as a placeholder
15. What is the purpose of the else block in a loop in Python?
a) To execute if the loop encounters an error
b) To execute if the loop completes without encountering a break statement
c) To execute if the loop encounters a continue statement
d) To execute if the loop encounters a pass statement
16. An empty/null statement in Python is
a) go b) pass c) over d) ;
17. What is the output of the following code?
x = 10
if x > 5:
print("Hello")
elif x > 8:
37 | P a g e
print("Hi")
else:
print("Hey")
a) Hey b) Hi c) Hello d) Hello, Hi
Choose correct option for given Assertion (A) and Reasoning (R)
a) Both A and R are true and R is the correct explanation of A.
b) Both A and R are true but R is not the correct explanation of A.
c) A is true but R is false.
d) A is false but R is true.
1 Assertion (A): The conditional flow of control can be defined with the help of if
statement.
Reasoning (R): if statement executes one or more statements based on the given
condition. If the condition evaluates to true, the statement block following the
indentation gets executed, otherwise nothing gets executed.
2 Assertion (A): break and continue are termed as Jump statements.
38 | P a g e
Reasoning (R): Jump statements can only be used with looping constructs but not
with conditional constructs.
3 Assertion (A): In an if-else statement, the if block checks the true part whereas else
checks for the false part.
Reasoning (R): In a conditional construct, else block is mandatory.
4 Assertion (A): The data type of a variable is taken according to the type of value assigned
to it.
Reasoning (R): Data types do not require initialization at the time of declaration.
This process is described as Dynamic Typing.
Answer (Assertion and Reasoning Questions)
1 What will be the output of the following code? Also give short explanation about
execution of loop with continue statement
for i in range (1, 6):
if i == 3:
continue
print (i , end=’’)
Ans. 1245
Explanation: The continue statement skips the rest of the loop and moves to the
next iteration. So, when i equals 3, it skips printing that value.
2 What will be the output of the following code? with explanation, how the code will
be executed?
for i in range(3):
for j in range(3):
print(i + j, end=' ')
print()
Ans.
Explanation: The outer loop iterates three times, and for each iteration of the outer
loop, the inner loop also iterates three times. The values of i and j are added together
and printed. Each iteration of the outer loop starts a new line.
3 What will be printed by the following code?
num = 5
while num > 0:
print(num)
num -= 1
if num == 3:
39 | P a g e
break
else:
print("Done")
Ans. 5
4
4 What is the output of the following code?
x = 10
if x < 5:
print("A")
elif x > 7:
print("B")
else:
print("C")
Ans. B
5 What will be the output of the following code?
x=5
while x > 0:
print (x, end=" ")
x-=2
if x == 1:
break
else:
print("Done")
Ans. 5 3
6 What do you mean by continue and break keywords
Ans. The break statement terminates the loop containing it. Control of the
program flows to the statement immediately after the body of the loop.
The continue statement is used to skip the rest of the code inside a loop for the
current iteration only. Loop does not terminate but continues with the next
iteration.
Ans. The while loop in Python is used to repeatedly execute a block of code as
long as a given condition remains true.
Example:
c=0
while c < 5:
print("C:", c)
c += 1
8 Find out the Error in the following Code Snippet. Rewrite the code after removing
all the errors and underline.
40 | P a g e
Ans.
Ans:
2 Write a program to compute the result when two numbers and one arithmetic
operator is given by user.
Ans:
41 | P a g e
5 Write a program to find the sum of first n odd numbers.
Ans:
Ans:
On the basis of the above code, choose the right statement which will be
executed when different inputs for pay and location are given.
43 | P a g e
(D) Input value: location = "Delhi", pay = 500000
a) Statement 6 b) Statement 5 c) Statement 4 d) Statement 3
Answer: (c) Statement 4
OUTPUT:
Enter year: 1800
1800 is not a Leap Year
3 Read the following case and answer the questions:
A school is organizing a mock election. The eligibility to vote is based on the age of
the student. The program checks the student's age and prints if the student is
eligible to vote or not.
Questions:
a) What will be the output if the user inputs 20?
b) What is the purpose of the int() function in this code?
c) Modify the code to also print "Please wait until you are 18." if not eligible.
d) What will happen if the user enters a non-numeric input?
e) If a student is eligible to vote another message must be displayed on the
screen that “choose a right person” , after which print statement, would you
add this line of code.
Answer: (a) Eligible to vote.
a) It converts the input string to an integer.
44 | P a g e
b)
Questions:
a) What grade will be displayed for 88 marks?
b) What is the output if the marks entered are 45?
c) Modify the code to also check if the marks are within 0 to 100.
d) What will happen if the user enters -10 in the above mentioned code.
Answers:
a) Grade B
b) Grade D
c)
d) The original code will still run and give Grade D, but it should be considered
invalid input.
45 | P a g e
5 A school wants to help students in revise multiplication tables. The following code
print the multiplication table of a number:
Hint- range(start, stop, step))
start position: default 0 if not specify, stop position: at which position to stop,
step position: increment /decrement, its optional, default is 1
Questions:
a) What will be the output for input 5?
b) How many times will the loop run?
c) Modify the code to print the table in reverse order (from 10 to 1).
d) What is the role of range (1, 11)?
Answers:
a) 5 x 1 = 5
5 x 2 = 10
…
5 x 10 = 50
b) 10 times.
List in Python
Mind Map:
List is an ordered sequence which is mutable and made up of one or more elements. A list can
have elements of different data types such as integer, float, string, tuple or even another list.
46 | P a g e
Elements of a list are enclosed in square brackets and are separated by comma. It is a mutable
data type.
Creating List
● We can create a list by placing elements inside square brackets [], separated by
commas.
Example : Number=['One', 'Two', 'Three']
● We can create list using list() method
data=list() Creates empty list
data=list([3,4,5])
Accessing Elements in a List: Each element in the list is accessed using a value called
index. The first index value is 0 and second index value is 1 and so on, if its move from left to
write.
If accessing of element start from right to left then the index value start from -1 to -n
Traversing a List: We can access each element of the list or traverse a list using a loop.
Example:
L=[1,2,3,4]
for item in L:
print(item)
Nested List: When a list appears as elements of another list, it is called a nested list.
Example: L=[1,2,[3,4],5]
47 | P a g e
Method Syntax Description
append() list.append (items) It adds a single item to the end of the list.
insert() list.insert (index_no, It adds an element at a specified index
value)
reverse() list.reverse () It reverses the order of the elements in a list
index() list.index (item) It returns the index of first matched item from the
list.
sort() list.sort () This function sorts the items of the list
count() list.count (element) It counts how many times an element has occurred
in a list and returns it.
pop() list.pop (index)/ It removes the element from the specified index
list.pop() and also returns the element which was removed.
Default index is -1.
remove() list.remove (value) It is used when we know the element to be deleted,
not the index of the element.
clear() list.clear () .It removes all the elements from the list.
List Methods and Built-in Functions with Examples
The values that make a list are called its elements, or its items. We will use the term element or
item means same.
Functions Examples with output
list() X=list()
print(X)
Output: [ ] #emply list created
list(sequence) Lst=list ("hi")
print (Lst)
Output:
['h', 'i']
#sequence(String) converted in to list
len (list) L= [2, 3, [4,5]]
print(len(L))
Output:
3 # Explanation: In above example 3rd element is list and
it is considered as single element
max(list) L=[1,-2,4,-4]
print(max(L))
output: 4
Try it!!!
lst=[[2,3],[4,6],[6,4]]
print(max(lst))
min(list) L=[1,-2,4, -4]
print(min(L))
output: - 4
sum(list) L=[1, -2,4, -4]
print(sum(L))
output: -1
48 | P a g e
sorted(list,reverse=False) L=[15,16,17,2,3,9]
print(sorted(L)) #by default reverse False
output:
[2,3,9,15,16,17]
--------------------------------------------------------
L=[15,16,17,2,3,9]
print (sorted (L, reverse=True))
output:
[17,16,15,9,3,2]
49 | P a g e
list.count (element) data= [10,30,20,30,90,30]
print(data.count(200))
output:
0 # element /value 200 not in the list data
data=[10,30,20,30,90,30]
print(data.count(30))
Output:
3 # element /value 30 three times in the list data
list.pop (index) data=[10,30,20,40,50]
print(data.pop()) # pop() without index position
print(data)
Output:
50 # pop () returns the popped value
[10,30,20,40]
# data list printed after popped its last element
data= [10,30,20,40,50]
print(data.pop(2)) #pop() function with index position
print(data)
Output:
20 # pop () returns the popped value
[10,30,40,50]
# data list printed after popped its element of particular
index position.
list.remove (item/element) data=[10,30,20,25,30,40]
data.remove(30) #element 30 at index position 1, 4
print(data)
output:
[10, 20, 25, 30, 40]
# remove the first occurrence of a specified value from the
list
list.clear () data=[10,30]
data.clear()
print(data)
output:
[]
# empty list will be displayed after implanting clear method
Multiple Choice Questions
Suppose
1. list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after execution of list1.pop
(1)?
1.
a) [3, 4, 5, 20, 5, 25, 1, 3] b) [1, 3, 3, 4, 5, 5, 20, 25]
c) [3, 5, 20, 5, 25, 1, 3] d) [1, 3, 4, 5, 20, 5, 25]
50 | P a g e
2. Suppose a list mylist is [10,23,45,3,34,50], what is mylist after execution of
mylist.remove(3)
a) [10, 23, 3, 34, 50] b) [10, 23, 45, 34, 50]
c) [10, 23, 3, 34, 50] d) No output
3. Consider the following code and predict the output
mylist = [2,3,8,9,3]
mylist.append([2,4])
print(mylist)
a) [2, 3, 8, 9, 3, 2, 4, [2, 4]] b) [[2, 4], 2, 3, 8, 9, 3, 2, 4]
c) [2, 3, 8, 9, 3, ,2, 4, 2, 4] d) [2, 3, 8, 9, 3, [2, 4]]
4. Consider a list mylist with n elements, in mylist.pop() what is the default index
a) 1 b) 0
c) -1 d) 4
5. What is the output when we execute?
print(list(“hello”))
a) [‘h’, ‘e’, ‘l’, ‘l’, ‘o’] b) [‘hello’]
c) will not create a list d) [‘h,e,l,l,o’]
6. Which of the following commands will create a list?
a) listl = list( ) b) listl = [ ]
c) listl = list([1, 2, 3]) d) all of these
Answer (Multiple Choice Questions)
1. c) [3, 5, 20, 5, 25, 1, 3]
2. b) [10, 23, 45, 34, 50]
3. d) [2, 3, 8, 9, 3, [2, 4]]
4. c) -1
5. a) [‘h’, ‘e’, ‘l’, ‘l’, ‘o’]
6. d) all of these
Assertion and Reasoning Questions
Choose correct option for given Assertion (A) and Reasoning (R)
a) Both A and R are true, and R is the correct explanation of A.
b) Both A and R are true, but R is not the correct explanation of A.
c) A is true, but R is false.
d) A is false, but R is true.
1. Assertion (A): Lists in Python are mutable.
Reason (R): We can modify, add, or remove elements from a list after its creation.
2. Assertion (A): A list in Python can contain another list as its element.
Reason (R): Python does not allow different data types inside a list.
51 | P a g e
2 Answer: c) A is true, but R is false.
1. Write a python code to read a list of numbers and print all even numbers from the
list.
Answer:
xlist=eval(input("enter elements"))
for i in xlist:
if i%2==0:
print(i)
Output :
enter elements [1,2,3,8,9]
2
8
2. Write a python code to read a list and replace all even elements with 0 and odd with 1
Answer:
xlist=eval(input("enter elements"))
for i in range(len(xlist)):
if xlist[i]%2==0:
xlist[i]=0
else:
xlist[i]=1
print(xlist)
output:
enter elements[2,5,7,98,0,7]
[0, 1, 1, 0, 0, 1]
3. Predict the output of the following code: -
Moves=[11, 22, 33, 44]
Queen=Moves
Moves[2]+=22
L=len(Moves)
for i in range (L):
print (“Now@”, Queen[L-i-1], “#”, Moves [i])
Answer:
Now@ 44 # 11
Now@ 55 # 22
Now@ 22 # 55
Now@ 11 # 44
4. Consider the following list myList. What will be the output of the code after executing of
below code:
myList = [10,20,30,40]
myList.append([50,60])
d=myList.pop(2)
52 | P a g e
print(d)
print(myList)
Answer:
30
[10, 20, 40, [50, 60]]
list1 = [12,32,65,26,80,10]
list1.sort()
print(list1)
10. What will be the output of following code
myList = [1,2,3,4,5,6,7,8,9,10]
newlist=[]
for i in range(len(myList)):
if i%2 == 0:
newlist.insert(i,myList[i])
print(newlist)
Dictionary in Python
Mind Map:
53 | P a g e
The data type dictionary falls under mapping. It is a mapping between a set of keys and a set of
values. The key-value pair is called an item. A key is separated from its value by a colon (:) and
consecutive items are separated by commas. Items in dictionaries are unordered,
A dictionary is an unordered sequence of key-value pairs.
Key and value in a key-value pair in a dictionary are separated by a colon. Further, the key:
value pairs in a dictionary are separated by commas and are enclosed between curly
parentheses.
● The keys of the dictionaries are immutable types such as Integers or Strings etc.
● Indices in a dictionary can be of any immutable type and are called keys.
● The values of a dictionary in Python are mutable.
Creating Dictionaries
A Dictionary can be created in three different ways:
We can use Square Brackets [ ] with keys for accessing and initializing dictionary values.
For Example:
Months[0] = ‘January’
Months[1] = ‘February’
Months[2] = ‘March’
print(Months)
output: {0 : 'January', 1: 'February' , 2 : 'March'}
output: Monday
54 | P a g e
Traversing a Dictionary:
Dictionary items can be accessed using a for loop.
output:
Apple
Boy
Cat
Adding an Element in a Dictionary
We can add new element (key : value pair) to a dictionary using assignment, but the key being
added must not exist in dictionary and must be unique.
output: {'A': 'Android ', 'B': 'Boy', 'C': 'Cat', 'D': 'Dog'}
55 | P a g e
the given dictionary
del del Dict_name Deletes the item with the given key or to delete
the dictionary from the memory.
del dictionary[key]
clear() dictionary.clear() Deletes or clear all the items of the dictionary
56 | P a g e
print(dates) a dictionary
Note: if single key:value pair is to remove from a dictionary then pop() and popitem()
method of dictionary can be used
57 | P a g e
a) The values of a dictionary can be accessed using keys
b) The keys of a dictionary can be accessed using values
c) Dictionaries store data as key : value pair
d) Dictionaries are mutable
58 | P a g e
1. Rita is a student of class XI. Help her to create a dictionary to store details of 10
employees given by the user. Each element consists of empcode as key, name
and salary as values.
Answer:
emp={}
for i in range(10):
l=[]
empcode=int(input("enter emplyee code"))
name=input("enter name")
salary=int(input("enter salary"))
l.append(name)
l.append(salary)
emp[empcode]=l
print(emp)
2. Consider the following dictionary and print the name and salary of employees in
“computer” department.
{ "anil":["computer",10000],
"anju":["History",5000],
"somu":["computer",11000],
"sam":["English",8000] }
Answer:
data={"anil":["computer",10000], "anju":["History",5000],
"somu":["computer",11000], "sam":["English",8000] }
for key, value in data.items():
if value[0]=="computer":
print(key , value[1])
59 | P a g e
students = {
"A101": ["Ravi", 88],
"A102": ["Divya", 76],
"A103": ["Kiran", 95],
"A104": ["Neha", 65]}
Write a Python program to display the name and marks of students who scored
more than 80
3. Write python code to create dictionary to store the following details of 10
products
{Productno: [Product name, price, quantity]}
4. Write the Python statement for the following tasks using built-in
functions/methods only:
To remove the item whose key is "NISHA" from a dictionary named Students.
For example, if the dictionary Students contains
{ "ANITA":90, "NISHA":76, "ASHA":92)
After removal, the dictionary should contain {"ANITA":90, "ASHA":92}
60 | P a g e
Introduction to NumPy
Introduction, Creation of NumPy Arrays from List
To install NumPy in Python, use the pip package on command line and choose the
absolute path of location, where python is installed.
pip install numpy
NumPy is a library in Python which can be imported in a program by using import command
as
import numpy as np
Array: Group or collection of similar type of elements.
Eg. Scores of players in a cricket match, Marks of students in a class
NumPy Array: A grid contains value of same type (homogeneous elements) and uses Zero
based indexing, like lists in Python. NumPy Array also known as ndarray
NumPy Arrays are grid-like structures similar to lists in Python but optimized for numerical
operations. NumPy array can be created by converting a regular Python list into an array
using the np.array() function. This function returns ndarray object. Once the NumPy array
is defined, the space it occupies in memory is fixed and cannot be change.
Ndarray is one of the most important classes in the NumPy python library. It is basically a
multidimensional or n-dimensional array of fixed size with homogeneous elements (i.e., the
data type of all the elements in the array is the same). A multidimensional array looks
something like this:
61 | P a g e
Axes: Axes are defined for arrays with more than one dimension. A 2-dimensional array has
two corresponding axes: the first running vertically downwards across rows(axis 0), and the
second running horizontally across columns (axis 1). Many operations can take place along
one of these axes.
Rank: The no. of axes in a ndarray is called its rank.
Creation of NumPy array using List
Types of Arrays:
• 1-D Array: A single row of elements.
• 2-D Array: A matrix with rows and columns
1) 1D NumPy array creation -> Using List:
62 | P a g e
2 Size <ndarrayname>.size
Total no. of elements in the
array
3 Datatype <ndarrayname>.dtype
(dtype): Type of data stored in the
array
4 ItemSize: <ndarrayname>.itemsize
Size of each element of
ndarray in bytes
5 ndim <ndarrayname>.ndim
It returns an integer
representing the number
of dimensions.
63 | P a g e
numpy.full(shape, fill_value, >>>ar2=np.full((4,),1.5, dtype='float')
dtype = None) >>> ar2
array([1.5, 1.5, 1.5, 1.5])
64 | P a g e
(a) [3 6 3 3] (b) [3,6,3,3,15] (c) [3,6,3,3] (d)[3,15,18,36,35,38]
10 Which of the following is correct way to import the Numpy module in your
program?
(a) import numpy (b) import numpy as np
(c) from numpy import * (d) All of the above
11 What will be the output of following code?
import numpy as np
A=np.array([24,46,57,14,68,34,89,92])
print(A[7:3:-1])
print(A[2:6])
a) [92 89 34 68] b) [92 34 89 68]
[57 14 68 34] [14 57 68 34]
6 (b)ndim
7 (c) 3 Explanation: arr value will be
print(arr[1,0]) To access elements from 2-D arrays we can use comma separated
integers representing the dimension and the index of the element.
8 (d) [0],[7]
9 (a) [3 6 3 3]
Explanation: print (Array [ :4]) This statement starts printing element from index
position 0 and will print upto index position 4-1=3 as its increment by 1 (default
increment).
10 (d) All of the above
11 (a)
Explanation: print (A [7:3: -1]) This statement starts printing element from index
65 | P a g e
position 7 and display upto index position (3-(-1))=4 as its decrement by -1
12 (c) We cannot change the size of NumPy array after the store in memory.
66 | P a g e
Answer:
NumPy Arrays are grid-like structures similar to lists in Python. NumPy array
can be created by converting a regular Python list into an array using the
np.array() function.
import numpy as np
List1= [10,50,90,130]
Arr1=np.array(List1)
print (List1) # will display list [10,50,90,130]
print (Arr1) # will display array of list [10 50 90 130]
3 What is an ndarray. What is use of Array in python code.
Answer:
Ndarray is one of the most important classes in the NumPy python library. It is
basically a multidimensional or n-dimensional array of fixed size with
homogeneous elements (i.e., the data type of all the elements in the array is the
same)
Example
Answer:
5 What are some of the advantages of using NumPy arrays over Python lists?
Answer:
NumPy arrays offer several advantages, including: faster performance for
numerical operations due to vectorization, more efficient memory usage, and a
wide range of mathematical functions and operations. Array also helpful in
Optimize the data that help CPU to perform operation accurately and effectively.
NumPy is designed for data analysis and manipulation, offering a wide range of
functions for sorting, searching, and statistical analysis.
6 Given a list L=[1,2,3,4] and an ndarray N having elements [1 2 3 4] . What will be
the result produced by the following statements?
(a) L*2 (b) N*3 (c) L+L (d) N+N
Ans:
(a) [1,2,3,4,1,2,3,4]
(b) [3 6 9 12]
67 | P a g e
(c) [1,2,3,4,1,2,3,4]
(d) [2 4 6 8]
68 | P a g e
UNIT 3: DATABASE CONCEPTS
Mind Map
Database
A database is an organized collection of data that can be easily accessed, managed, and
updated.
A database helps us to store our data in the permanent memory
DBMS
A database management system (DBMS) or database system in short, is a software that can be
used to create and manage databases.
DBMS lets users to create a database, store, manage, update/modify and retrieve data from
that database by users.
Some examples of DBMS are MySQL, Oracle, PostgreSQL, SQL Server, Microsoft Access,
MongoDB.
RDBMS
RDBMS stands for Relational DBMS
Different types of DBMS are available and their classification is done based on the underlying
data model.
There are three Data Models : Hierarchical, Network, and Relational.
A data model describes the structure of the database, including types of data, relationship
between the data and rules(constraints) on data.
69 | P a g e
The most commonly used data model is Relational Data Model.
Advantages of a database
TERMINOLOGY
DOMAIN It is a set of values from which an attribute can take a value in each
row. Usually, a data type is used to specify domain for an attribute.
TUPLE Each row of data in a relation (table) is called a tuple.
ATTRIBUTES Each column of a relation (table) is called an attribute
CARDINALITY The number of tuples in a relation is called the Cardinality of the
relation.
DEGREE The number of attributes in a relation is called the Degree of the
relation.
DATABASE Database Schema is the design of a database. It is the skeleton of the
SCHEMA database that represents the structure (table names and their
fields/columns), the type of data each column can hold, constraints
on the data to be stored (if any), and the relationships among the
tables.
Database schema is also called the visual or logical architecture as it
tells us how the data are organised in a database.
DATA Sometimes we put certain restrictions or limitations on the type of
CONSTRAINT data that can be inserted in one or more columns of a table. This is
done by specifying one or more constraints on that column(s) while
creating the tables.
META DATA The database schema along with various constraints on the data is
stored by DBMS in a database catalog or dictionary, called meta-data.
A meta-data is data about the data.
QUERY A query is a request to a database for obtaining information in a
70 | P a g e
desired way. Query can be made to get data from one table or from a
combination of tables.
DATABASE ENGINE Database engine is the underlying component or set of programs used
by a DBMS to create database and handle various queries for data
retrieval and manipulation.
Example :
Consider the student table given below:
StudentID Name Age Grade Mobile
101 Aman 14 A 9921245689
102 Ajay 15 B 9567231212
Name of relation: Student
Domain: In the above relation, the attribute StudentID takes integer values and hence its
domain is a set of integer values.
Degree: Degree of this table is 5 as it has 5 attributes (columns)
Name of attributes: StudentID, Name, Age, Grade, Mobile
Cardinality: Cardinality of this table is 2 as this table contains 2 tuples(rows/records) of data
Keys of a relation
Candidate A relation can have one or more attributes that takes distinct values.
Keys Any of these attributes can be used to uniquely identify the tuples in
the relation. Such attributes are called candidate keys
Primary Key Out of one or more candidate keys, the attribute chosen by the
database designer to uniquely identify the tuples in a relation is called
the primary key of that relation.
If no single attribute in a relation is able to uniquely distinguish the
tuples, then more than one attribute are taken together as primary
key. Such primary key consisting of more than one attribute is called
Composite Primary key
Alternate Key From the candidate keys, the attributes which are not chosen as
primary key are called Alternate key
Foreign Key A foreign key is used to represent the relationship between two
relations. A foreign key is an attribute whose value is derived from
the primary key of another relation.
For example- in below table following attributes(columns) RNO, UID, REGNO are candidate
keys, suppose we have chosen RNO as primary Key. Then the other two attributes (column)
UID, REGNO will become alternate key
71 | P a g e
In the above table
1. There are 5 tuples (rows/ records), hence the CARDINALITY is 5
2. There are 6 Attributes and hence DEGREE is 6
3. RNO, UID AND REGNO are unique for each student and hence are eligible to become
Primary Key. They are CANDIDATE KEYS.
4. RNO is chosen as PRIMARY KEY
5. So UID & REGNO becomes ALTERNATE KEYS.
In Patient table, the primary key of Doctor table is present, which helps us to link these two
tables. Hence DID in patient table is the Foreign Key.
Note:
The table whose primary key is present in another table, is known as parent table. Here in
the above example DOCTOR table is the parent table
The table in which, foreign key is present is known as the Child table. In the above example
PATIENT is the child table.
72 | P a g e
Three Important Properties of a Relation
In relational data model, following three properties are observed with respect to a relation
which makes a relation different from a data file or a simple table.
Property 1: imposes following rules on an attribute of the relation :
⮚ Each attribute in a relation has a unique name.
⮚ Sequence of attributes in a relation is immaterial.
Property 2: governs following rules on a tuple of a relation.
⮚ Each tuple in a relation is distinct.
⮚ Sequence of tuples in a relation is immaterial.
73 | P a g e
Data Definition Language (DDL):
The structure of a relation consists of the number of attributes, their data types, keys and
constraints that we keep on the values of attributes.
The commands used for creating, modifying or deleting the structure of a relation are called
DDL commands
DATATYPES IN MYSQL
The various datatypes of MySQL are
1. INT OR INTEGER :
A medium integer. Signed range is from -2147483648 to 2147483647. Unsigned
range is from 0 to 4294967295.
2. FLOAT:
A floating-point number.
Syntax: FLOAT (SIZE, D)
The total number of digits is specified in size. The number of digits after the
decimal point is specified in the d parameter.
Example: FLOAT (10,2) means total size 10 out of that 2 digits are in the decimal
part.
3. DATE:
Takes date in the form of ‘YYYY-MM-DD’.
The size of DATE datatype is fixed(10bytes).
4. CHAR:
It is FIXED length string (can contain letters, numbers, and special characters).
The size can be from 0 to 255. Default is 1
5. VARCHAR:
It is Variable length Character (can contain letters, numbers, and special
characters). The size can be from 0 to 65535
Note:
74 | P a g e
1. MySQL commands are case insensitive.
2. All the commands in MySQL should be terminated by ; (semicolon)
CREATE COMMAND
This command is used to create a database/table /view.
Syntax:
Create database <databasename>;
Note:
Once a database is created, we have to use it. To use a database the command is
USE <databasename>;
Example:
mysql> create database SCHOOL;
mysql>use SCHOOL;
CREATING A TABLE:
SYNTAX:
CREATE TABLE <TABLENAME> (FIELD1 DATATYPE(SIZE), FIELD2 DATATYPE
(SIZE)……………..);
Example:
CREATE TABLE STUDENT (RNO INT (5), NAME VARCHAR (20), CLASS CHAR (3), MARKS INT
(3));
DESC command
To see the structure of a table we use the command DESC (describe)
DESC <tablename>;
DESC STUDENT;
1 A relation has 10 rows and 5 columns. What will be its degree and cardinality?
(a) Degree: 10, Cardinality: 5 (b) Degree: 15, Cardinality 10
75 | P a g e
(c) Degree: 5, Cardinality: 10 (d) Degree: 5 , Cardinality: 15
2 There are 5 candidate keys and one primary key in a table. How many alternate
keys are there in that table?
a) 3 b) 4 c) 5 d) 6
3 A non-key attribute, whose values are derived from primary key of some other
table.
a) Alternate key b) Foreign key c) Primary key d) Super Key
4 Pick the odd one out.
a) Update b) Delete c) Create d) Insert
5 Which of the following is not an example of DBMS?
a) MySQL b) Microsoft Access c) IBM DB2 d) Google
6 The default date format in MySQL is:
a) DD/MM/YYYY b) YYYY-MM-DD
c) MM-DD-YYYY d) YYYY/MM/DD
7 SQL stands for
a) Standard Query Language b) Structured Query Language
c) Standard Question Language d) Simplified Query Language
8 The attributes of a relation which are unique in their values and which are
eligible to become primary key are called
a) Alternate Key b) Foreign Key c) Candidate Key d) Eligible Key
9 Which of the following best describes a primary key?
a) A key that can accept null values
b) A key that uniquely identifies each record in a table
c) A duplicate value identifier d) A key used to join two tables
10 How many candidate keys can a table have?
a) Only one b) Zero c) One or more d) Exactly two
11 A foreign key in one table refers to:
a) A primary key in the same table b) A duplicate value in another table
c) A primary key in another table d) A unique constraint in any table
12 Which of the following is a DDL command?
a) SELECT b) UPDATE c) CREATE d) INSERT
13 Which statement is used to modify the structure of an existing table?
a) CHANGE b) ALTER c) UPDATE d) MODIFY
14 Which of the following is a DML command?
a) CREATE b) SELECT c) DROP d) DELETE
15 The SELECT statement in SQL is classified under:
a) DML b) DDL c) DCL d) DQL
16 What is the purpose of DQL in SQL?
a) Query and retrieve data b) Control access to data
c) Define data structure d) Delete data
17 DBMS stands for
a) Data Borrowing and Movement Software b) Database Management System
c) Digital Base Mapping System d) Database Manipulation Software
76 | P a g e
Answer (Multiple Choice Questions)
77 | P a g e
3 Attribute
4 Cardinality
5 Degree
6 Candidate Keys
7 Primary Key
8 use
9 Database
10 Metadata
78 | P a g e
10 Assertion(A): A foreign key can have duplicate values.
Reason (R) : A foreign key establishes a relationship between two tables and
does not require uniqueness.
1 Sayuj wants to save data permanently in his system for data manipulation purposes. He
wants this data to be shared with his friends in a secure manner. Suggest him how a
database can be used for this purpose?
Answer: A database is an organized collection of data that can be easily accessed,
managed, and updated. A database helps us to store our data in the permanent memory.
A database management system helps many users to access the data and manipulate
data. So Sayuj can take the help of a DBMS software for this purpose.
2 Mention any two advantages of using a DBMS.
Answer: DBMS lets users create a database, store, manage, update/modify and retrieve
data from that database by users or application programs.
It reduces data redundancy and inconsistency. It ensures data integrity and maintains
standardization of data formats. It facilitates sharing of data
3 Ms Preetha, a teacher has written the details about students of 12A class in her register.
Similarly all the teachers teaching in Class 12A maintains separate registers having the
same data. Can you identify the problem in storing same data in multiple locations like
this ? Define the term 'data redundancy'. How does DBMS help to reduce it?
Answer: When the same data is stored in multiple locations like this, the data may
become inconsistent due to lack of proper updation of data. Storing the same data at
multiple locations causes duplication of data. This is called data redundancy. DBMS
facilitate sharing of data. So multiple users can work on the same data. This avoids data
redundancy and the problems caused due to data redundancy
4 Rohan wants to collect the date of birth of students of his class. He distributes a form to
all students for writing their date of birth. After observing the collected data, Rohan finds
that the students have written the date of birth in different formats. What is the problem
79 | P a g e
faced by Rohan Now? How can he overcome this problem?
Answer: Rohan finds it difficult to differentiate between date and month because some
of them have used DD-MM-YYYY format and others have used MM-DD-YYYY format.
Even the number of digits used for writing the year is different in different data. If Rohan
saves the data like this, he will find it difficult to manipulate it later. Rohan must have
used a standard format for collecting data.
DBMS can provide rules and constraints on data so that the data follows the same format
everywhere. Also the same data is shared with multiple users. Maintaining the
correctness of data is called Data Integrity
5 Explain what is a primary key?
Answer: The attribute chosen by the database designer to uniquely identify the tuples in
a relation is called the primary key of that relation. For example, in a student table,
admission number may be chosen as primary key as this data will not be repeated in the
column
6 Ramya is working with 2 tables in a database. She wants to retrieve data from both these
tables which are related with each other. How can she achieve this?
Answer: She must identify a common column which is present in both the tables. She
must set one of them as the foreign key. Foreign key is used to establish a connection
between 2 relations
DDL stands for Data Definition DML stands for Data Manipulation
Language Language
80 | P a g e
DDL commands are used to modify DML commands are used to modify the
the structure of a relation data inside a relation
Eg: Create Table, Alter table, Drop Eg: Insert into, Update, Delete
table
13 What do you mean by cardinality and degree of a relation?
Answer: The number of tuple of a relation is called cardinality and the number of
attributes of a relation is called degree of the relation
14 Explain what is metadata?
Answer: Data about data is called metadata. It contains the structure (table names
and their fields/columns), the type of data each column can hold, constraints on the
data to be stored (if any), and the relationships among the tables.
15 Give any 2 features of MySQL.
Answer: MySQL is an RDBMS and is easy to use and Manage
It is an open-source software which is secure, reliable and can handle large volume
of data.
16 A database has two tables:
Students (StudentID, Name, ClassID) and Classes (ClassID, ClassName)
You need to relate students to their respective classes.
Which key should you use in the Students table to refer to the Classes table?
Answer: ClassID
81 | P a g e
Data Query Language (DQL)
Mind Map:
82 | P a g e
● Data Query Language (DQL) :
Data Query Language (DQL) is an element of SQL, which is used for retrieving data from
the database using the query supplied to it.
The main example of DQL is SELECT statement, which is used to get the data from one or more
database tables.
● SELECT is the primary command used to query and access the data without
altering it. The result of a SELECT against a table or tables is compiled into a separate
temporary table that the application, or perhaps a front-end, displays.
● FROM: Specifies the table or tables from which you want to retrieve data.
➢ It follows the SELECT clause in the SQL query.
You can query data from one or more tables by listing them after the FROM keyword
Table: sportsclub
▪ Selecting Columns: SELECT statement can be used in various ways and combinations to
retrieve subset of columns from one or more tables.
83 | P a g e
2 Selecting SELECT SELECT
columns <column1, GameName,
column2,…> Fees FROM
FROM sportsclub;
<table_name>;
SQL requires single quotes or double quotes around text values. However, numeric fields
should not be enclosed in quotes.
84 | P a g e
3 Selecting Show the SELECT
specific gamename and GameName,
columns fees from a table Fees FROM
of rows sportsclub with sportsclub
based on two noofclubs. WHERE
condition Noofclubs=2;
Use of Operators in WHERE Clause
⮚ Comparison Operators:
In the above example, we have used equal to (=) operator in the WHERE clause for exact match
conditions. We can also use other relational/comparison operators (<, <=, >, >=, ! =, < >) to
specify conditions other than exact match.
Operator Query Command Output
⮚ Logical operators:
In a WHERE clause, logical operators like AND, OR, and NOT are used to combine multiple
conditions and create more complex filters for data retrieval. These operators helps to define
the criteria for which rows are included in the result set.
85 | P a g e
AND display details of all SELECT * FROM
Rows are games that have sportsclub
selected exactly 2 clubs and WHERE
only if both fees charge is less noofclubs =2 AND
(or all)
than 10,000 from a Fees < 10000;
conditions
table sports club
are true.
OR Display details of SELECT * FROM
Rows are games that either sportsclub
selected if have fees more WHERE
any one or than 20,000 or Fees > 20000 OR
all
have more than 3 noofclubs >3;
condition
clubs from a table
is true.
sportsclub
NOT display GCode, SELECT GCode,
Negate a Game Name and GameName,
condition. Starting Date of all StartingDate
It returns games except Chess FROM sportsclub
rows
from a table WHERE NOT
where the
sportsclub GameName=
condition
is false. ‘Chess’;
➢ Between operator:
This clause facilitates us to give a range of values. So, if you want to impose a condition in
which you wish to include a range of values, we use the Between clause.
Note: both values are inclusive in the range you give in the "Between" clause
➢ IN -Membership Operator:
The IN operator is used to filter data for a specified set of values. It can also be used to
replace multiple OR conditions.
Operator Query Command Output
86 | P a g e
IN – List Show Gcode and SELECT *
condition Fees of all the FROM
games where the Sportsclub WHERE
Game Name is GameName IN
either 'Carom', (‘Carom’, Chess’,
'Chess', or 'Lawn ‘Lawn Tennis’);
Tennis' from a
table sports club
The LIKE operator makes use of the following two wild card characters:
87 | P a g e
Operator Query Command Output
Like (i) Display (i) (i)
operator- game code and Select Gcode,
Substring name of games Gamename from
pattern whose game Sportsclub where
matching name starts Gamename like
with ‘C’ and ‘C%s’;
ends with ‘s’.
(ii)
(ii) Displays Select * from
(ii)
details of all sportsclub where
those games Gamename like
whose game ‘__r__’;
name consists
of exactly 5
letters and 3rd
character is ‘r’
from a table
sports club
Example: Combination of both % (multi character pattern matching operator) and _ (single
character pattern matching operator)
Query: Displays names of all employees containing 'a' as the second character.
mysql> SELECT EName FROM EMPLOYEE WHERE Ename LIKE '_a%';
Data Manipulation Language (DML) :
The SQL commands that deals with the manipulation of data present in the database belong to
DML or Data Manipulation Language and this includes most of the SQL statements. It is the
component of the SQL statement that controls access to data and to the database.
List of DML commands:
● INSERT: It is used to insert data into a RELATION(TABLE).
● UPDATE: It is used to update existing data in a RELATION (TABLE)
● DELETE: It is used to delete records from a database RELATION(TABLE).
88 | P a g e
Update- Data (i) Increase fees of all (i) UPDATE all
Updation – games by Rs. 500 rows-
to make UPDATE
changes in the <TABLE_NAME>
value(s) of SET <columnname
one or more = value>;
columns of (ii) Change the name (ii) UPDATE
existing of Judo club to ‘Judo specific rows-
records in a and Taekwondo’. UPDATE
table. <TABLE_NAME>
SET<columnname
= value> WHERE
<condition>;
DELETE - The (i) Delete all the rows (i) Syntax to
DELETE from sportsclub. DELETE all rows:
statement is
used to delete DELETE FROM
one or more <TABLE_NAME>;
* Data of sportsclub tables gets
record(s)
deleted
from a table
(ii) Delete all games (ii) DELETE
having noofclubs <4 specific rows:
DELETE FROM
<TABLE_NAME>
WHERE
<Condition>;
89 | P a g e
Multiple Choice Questions (DQL)
90 | P a g e
2. d) Retrieve data from one or more tables
3. a) WHERE
4. c) To filter records based on a condition
5. a) BETWEEN
6. c) SELECT * FROM Customers WHERE CustomerName LIKE '__M%M';
7. b) Matches values using patterns
8. c) Customers from Delhi or Mumbai
9. b) All orders where status is undefined
10. b) SELECT * FROM employees WHERE age BETWEEN 25 AND 35;
Multiple Choice Questions (DML)
1. Which of the following is NOT a DML command?
a) INSERT b) SELECT c) UPDATE d) DELETE
2. Which SQL command is used to add new rows to a table?
a) ADD b) INSERT c) APPEND d) INCLUDE
3. The UPDATE statement is used to:
a) Add new data b) Delete existing data
c) Modify existing data d) Retrieve data
4. Which keyword is used in UPDATE statement to specify which records should be
updated?
a) SET b) WHERE c) FROM d) SELECT
5. To remove records from a table, which command is used?
a) ERASE b) REMOVE c) DROP d) DELETE
6. Which statement will update the salary of employees by 10% in an EMPLOYEE
table?
a) UPDATE EMPLOYEE SET salary = salary + 10;
b) UPDATE EMPLOYEE ADD salary = (Salary * 0.1) + Salary;
c) UPDATE EMPLOYEE SET salary = (Salary * 0.1) + Salary;
d) MODIFY EMPLOYEE SET salary = salary + 10;
7. What will happen if you execute DELETE FROM table_name; without a WHERE
clause?
a) Syntax error b) Deletes a random row
c) Deletes all rows d) Deletes only the first row
8. Which of the following statements is used to insert multiple rows in one query?
a) INSERT ALL INTO…. b) INSERT MULTIPLE INTO ...
c) INSERT INTO table_name VALUES (), (), (); d) MULTI INSERT INTO ...
91 | P a g e
b) It can be used with a WHERE clause to remove selected rows.
c) It requires the use of SET
d) Syntax error
1. b) SELECT
2. b) INSERT
3. c) Modify existing data
4. b) WHERE
5. d) DELETE
6. c)UPDATE EMPLOYEE SET salary = salary * 1.10;
7. c) Deletes all rows
8. c) INSERT INTO table_name VALUES (), (), ();
9. b) It can be used with a WHERE clause to remove selected rows.
10. c) Deletes students with less than 40 marks
Assertion and Reasoning Questions
Choose correct option for given Assertion (A) and Reasoning (R)
a) Both A and R are true, and R is the correct explanation of A.
b) Both A and R are true, but R is not the correct explanation of A.
c) A is true, but R is false.
d) A is false, but R is true.
1. Assertion (A): The SELECT statement can modify data in a table.
Reason (R): SELECT is a part of DQL and is used for retrieving data.
2. Assertion (A): In SQL, INSERT INTO is a Data Definition Language (DDL) Command.
Reason (R): DDL commands are used to create, modify, or remove database
structures, such as tables.
3. Assertion (A): The INSERT, UPDATE, and DELETE commands are part of DML.
Reason (R): These commands manipulate the data stored in database tables.
4. Assertion: The SQL WHERE clause is used for sorting the result set of a query.
Reason(R): The WHERE clause specifies conditions to filter rows in a query.
5. Assertion: The IS NULL operator in SQL checks if a column has a NULL value.
92 | P a g e
Reason(R): The IS NULL operator checks if a column contains a specific value.
6. Assertion (A): The DELETE command can be used to remove all rows from a table.
Reason (R): The DELETE statement requires a WHERE clause to execute.
7. Assertion (A): Both BETWEEN and IN operators can choose from a range of values.
Reason (R): The value ranges and a list of values are interpreted in different ways in
SQL.
8. Assertion (A): The UPDATE command in SQL can modify existing records in a table.
Reason (R): The INSERT command is used to add new rows to a table.
9. Assertion (A): The LIKE operator is used in SQL to filter records based on pattern
matching.
Reason (R): The LIKE operator supports wildcards such as % for multiple characters
and _ for a single character.
10. Assertion (A): DML commands can affect the structure of the database schema.
Reason (R): Commands like INSERT, UPDATE, and DELETE do not change the
database structure.
Answer (Assertion and Reasoning Questions)
1. D) A is false, but R is true.
Explanation: SELECT only retrieves data and does not modify it.
2. D) A is false, but R is true.
Explanation: INSERT INTO is a DML command.
3. a) Both A and R are true, and R is the correct explanation of A.
4. D) A is false, but R is true.
Explanation: Assertion is false because the WHERE clause is not used for sorting.
Reason is true - the WHERE clause is indeed used to filter rows based on a
condition
5. c) A is true and R is False
Explanation: Assertion is True: The IS NULL operator checks if a column does not
have a value, i.e., it’s null, meaning "unknown" or "missing".
Reason is false: IS NULL does not check for a specific value—it checks for the
absence of any value at all.
6. c) A is true and R is False
Explanation: Assertion is True: :You can delete all rows using DELETE FROM
table_name;
Reason is false: But a WHERE clause is optional — it’s used to delete specific
rows, not mandatory.
7. a) Both A and R are true, and R is the correct explanation of A.
93 | P a g e
Short type Questions with Answer:
SNo. Questions
1. For finding the names of all the students who have enrolled for “Commerce” group in
class XI from the “Exam” table, Rishab has typed the following command, but he is
not getting the expected result. Kindly help him by rewriting the command to get the
expected output.
Select name from Exam where group like “Commerce”;
Ans: Corrected query is
Select name from Exam where group =“Commerce”;
As Equal to (=) operator is used for exact matching.
2. Sita has given following MySQL command to remove details of students who has not
paid the fees. But it is showing some error. Help Sita to correct it and justify your
answer.
DELETE * FROM STUDENT WHERE FEES=NULL;
Ans: Corrected query is
DELETE * FROM STUDENT WHERE FEES IS NULL;
NULL values are compared with IS operator only.
3. In SQL, how can you change ‘’Arnav’ into ‘Shivam’’ in the ‘FirstName’ column in the
Persons table?’ Write the SQL query to do the same.
Ans. Update Persons
Set FirstName=‘Shivam’’
Where FirstName=‘’Arnav’;
4. Correct the error in the following query.
Select * from RECORD where Rname = %math%;
Ans. Select * from RECORD where Rname like %math%;
LIKE operator is used for pattern matching.
5. Find the error in the following query and rewrite it:
DELETE * FROM STUDENT;
Ans. DELETE FROM STUDENT;
It is the correct query because * is not part of the syntax of
DELETE Command.
6. You have a database table named "Students" with columns "StudentID,"
"FirstName," "LastName," and "Age." Write an SQL query to delete all students below
the age of 18.
Ans. DELETE FROM Students WHERE Age < 18;
7. Write a query to display details of all those employees from EMPLOYEE table whose
name contains 7 characters, 3rd character is ‘M’ and 5th character is ‘K’.
Ans. Select * from EMPLOYEE where Ename LIKE ‘_ _M_K_ _’;
8. Match the following operators
Column A Column B
(a) range matching operator (i) <>
(b) multi character pattern matching operator (ii) NOT
94 | P a g e
(c) logical operator (iii)_(underscore)
(d) list matching operator (iv) %
(e) Single character pattern matching operator (v) Between
(f) relational operators (vi)IN
Ans.
Column A Column B
(a) range matching operator (v) Between
(b) multi character pattern matching operator (iv) %
(c) logical operator (ii) NOT
(d) list matching operator (vi)IN
(e) Single character pattern matching operator (iii)_(underscore)
(f) relational operators (i) <>
9. Explain the purpose of the SQL SELECT statement and provide an example of how it
is used to retrieve specific data from a database table.
Ans. The SQL SELECT statement is used to retrieve specific data from a database
table without altering it.
Example: SELECT FirstName, LastName FROM Employees;
10. Differentiate between Alter and Update command.
Ans.
Alter Command Update Command
(i) It is a DDL command. (i) It is a DML command
(ii) It is used to change the columns of the (ii) It is used to modify some or all
existing table such as: Adding a new records of the table specified by a
column, Deleting a column, Changing condition.
the data type of the column,
Renaming a column.
It is also used to add or delete the
constraints on an existing table.
Long type Questions with Answer:
SNo. Questions
1. Write output for (i) to (iv) MySQL queries on Customer table:
Table: CUSTOMER
ACCOUNTNO CNAME AGE GENDER BALANCE ACCOUNTCO
DE
101 S K YADAV 62 M 80000 7777
102 VIBA MISHRA 52 F 90000 9999
103 DIDAR SINGH 32 M 75000 7777
104 M SHARMA 35 M 79000 NULL
105 SIMI ARORA 30 F 97000 8888
106 DAYAL SONI 26 M 68000 9999
(i) SELECT ACCOUNTNO, CNAME, BALANCE
FROM CUSTOMER WHERE CNAME LIKE ‘%N%’;
(ii) SELECT * FROM CUSTOMER
WHERE AGE>50 AND BALANCE>80000;
95 | P a g e
(iii) SELECT ACCOUNTNO, CNAME FROM CUTOMER
WHERE ACCOUNTCODE NOT IN(7777,9999);
(iv) SELECT * FROM CUSTOMER WHERE ACCOUNTCODE IS NULL;
Answer:
2. Observe the following table Watches and answer the questions from (i) to (iv):
Table: Watches
Watchid Watch_Name Price Type Qty_Store
W001 High Time 10000 Unisex 100
W002 Life Time 15000 Ladies 150
W003 Wave 20000 Gents 200
W004 High Fashion 7000 Unisex 250
W005 Golden Time 25000 Gents 100
(i) Write SQL query to change the Qty_Store of Golden Time watches to 300.
(ii) To display all the details of those watches whose name ends with ‘Time‘
(iii) Write a query to add the following record in Watches table
(‘W006’,’Rolex’,25000,’Gents’,200)
(iv) Write the query to delete all the records from the table, but table
structure should remain in the database.
Answer:
(i) Update Watches Set Qty_Store=300 Where Watch_Name= “Golden Time”;
(ii) Select * from Watches where Watch_Name like “%Time”;
(iii) Insert into Watches values (‘W006’,’Rolex’,25000,’Gents’,200);
(iv) Delete from Watches;
3. Write queries for (i) to (iv) which are based on the following table TRAVEL.
Table: TRAVEL
CNO CNAME TRAVELDATE KM VCODE NOP
101 K. Niwal 2015-12-13 200 V01 32
103 Fredrick Sym 2016-03-21 120 V03 45
105 Hitesh Jain 2016-04-23 450 V02 42
102 Ravi Anish 2016-01-13 80 V02 40
107 John Malina 2015-02-10 65 V04 2
104 Sahanubhuti 2016-01-28 90 V05 4
96 | P a g e
(i) To display CNO, CNAME, TRAVELDATE from the table TRAVEL.
(ii) To display the CNAME of all customers from the table TRAVEL who are
travelling by vehicle with code V01 or V02
(iii) To display the CNO and CNAME of those customers from the table
TRAVEL who travelled between ‘2015-12-31‘and ‘2015-05-01‘.
(iv) To display all the details from table TRAVEL for the customers, who do
not have travel distance 120 KM.
Answer:
(i) Select CNO, CNAME, TRAVELDATE from TRAVEL;
(ii) Select CNAME from TRAVEL where VCODE= ‘V01’ or VCODE=’V02’;
(iii) Select CNO, CNAME from TRAVEL where TRAVELDATE between
‘2015-12-31‘and ‘2015-05-01‘;
(iv) Select * From TRAVEL where NOT KM=120;
4. Execute Query based on below Statements (i) to (iv) for table: SALES
Ecode Ename Address dojoin Amount Area
100 Amit Delhi 2017-09-29 5000.90 East
101 Sushant Gurgaon 2025-01-01 7000.75 East
102 Priya Noida 2024-04-25 3450.45 West
103 Mohit Delhi 2018-11-03 6000.50 North
104 Priyanshi Delhi 2019-12-15 8000.62 North
(i) Write a SQL query to display details of all salesmen whose date of joining is
after 31st March 2024.
(ii) Display details of all employees whose name starts with ‘S’ and ends
with ‘t’.
(iii) Display Area, Employee name and PFamount calculated as Amount *0.01
of East or West area employees.
(iv) Write a SQL query to delete the record of Ecode as 102.
Answer:
(i) Select * From Sales where dojoin > ‘2024-03-31’;
(ii) Select * From sales where Ename like ‘S%t’;
(iii) Select Area, Ename, Amount*0.01 as PFamount from Sales where Area IN
(‘East’, ‘West’);
(iv) Delete from Watches where Ecode=102;
5. Study the following table DOCTOR and answer the following questions: -
TABLE: DOCTOR
ID NAME DEPT GENDER EXPERIENCE
101 John ENT M 12
104 Smith ORTHOPEDIC M 5
107 George CARDIOLOGY M 10
114 Lara SKIN F 3
109 K George MEDICINE F 9
105 Johnson ORTHOPEDIC M 10
117 Lucy ENT F 3
97 | P a g e
(i) Write SQL Query to display the details of all those Doctors whose name
either starts with ‘J’ or starts with ‘S’.
(ii) Write SQL Query to display the details of all female doctors having
experience more than 5 years.
(iii) Write the SQL Query to delete the records of Male doctors of ENT dept.
(iv) Write the SQL Query to update the experience of all doctors by 1.
Answer:
(i) Select * From Doctor Where Name like ‘J%S’;
(ii) Select * from Doctor Where Gender=’F’ and Experience>5;
(iii) Delete From Doctor Where Gender=’M’ and department=’ENT’;
(iv) Update Doctor Set Experience=Experience+1;
98 | P a g e
Unit 4: Introduction to the Emerging Trends
99 | P a g e
1. Artificial Intelligence (AI)
What is it?
AI is a branch of computer science that enables machines to mimic human intelligence. This
means they can perform tasks like thinking, learning, problem-solving, and decision-making.
Key Features:
● Learns from experience
● Solves problems
● Makes decisions
Real-life Examples:
● Google Assistant answers your questions.
● Self-driving cars make driving decisions.
● Face recognition on smartphones.
What is it?
ML is a subset of AI. It means teaching computers to learn from data and make predictions or
decisions without being explicitly told what to do every time.
How it works:
● Provide data → Computer analyzes it → Learns patterns → Makes predictions
Examples:
● YouTube recommends videos based on your watch history.
● Email filters move spam messages to the spam folder.
What is it?
NLP allows computers to understand, interpret, and respond to human language (like English,
Hindi, etc.).
Examples:
● Google Translate
● Chatbots on websites
● Voice typing on smartphones
100 | P a g e
Example:
You point your camera at a street, and it shows directions or restaurant reviews.
5. Robotics
What is it?
Robotics is the field of designing and building robots—machines that can do tasks
automatically or with minimal human help.
Examples:
● Robot arms in factories
● Drones used for delivery or photography
● Cleaning robots at home
Characteristics (5 V’s):
Examples:
● Smartwatches that track your steps and heartbeat
● Smart lights that can be controlled via phone
● A fridge that tells you when you're out of milk
8. Sensors
101 | P a g e
What are they?
Sensors detect physical changes in the environment (like temperature, motion, light) and send
that information to a computer or device.
Examples:
● Temperature sensor in AC
● Motion sensor in security lights
● Fingerprint scanner on smartphones
9. Smart Cities
Features:
● Smart traffic management
● Smart energy use (like automatic street lights)
● Clean and efficient waste management
Examples:
● Cameras that monitor traffic and take decisions to reduce congestion
● Apps that tell you when your bus will arrive
What is it?
Cloud computing means storing and accessing data and applications over the internet instead
of your computer’s hard drive.
Benefits:
● Access from anywhere
● No need for expensive hardware
● Easy sharing and collaboration
● SaaS (Software as a Service): Use software online (e.g., Google Docs, Zoom)
● IaaS (Infrastructure as a Service): Rent IT infrastructure like servers (e.g., Amazon
Web Services)
● PaaS (Platform as a Service): Tools for developers to create software (e.g., Microsoft
Azure)
What is it?
Grid computing connects multiple computers over a network to work together on a single task,
sharing resources like a powerful virtual computer.
102 | P a g e
● Solves complex problems
● Speeds up processing
Example:
Scientists use grid computing to analyse climate change models or DNA sequencing.
What is it?
Blockchain is a digital ledger (record book) where information is stored in blocks and linked in
a secure and unchangeable way.
Key Features:
● Decentralized (no single owner)
● Secure and transparent
● Difficult to change once data is added
Uses:
● Cryptocurrency like Bitcoin
● Securely storing property or medical records
103 | P a g e
c) Sending emails d) Creating animations
10 Which of the following is an example of a robot?
a) Fan b) Washing machine
c) Self-driving vacuum cleaner d) Keyboard
11 Which of the following is not a characteristic of Big Data?
a) Volume b) Variety
c) Velocity d) Visibility
12 "Variety" in Big Data refer to?
a) Speed of data b) Number of users
c) Different types of data (text, images, etc.) d) Cost of data
13 What does IoT connect to the internet?
a) Physical devices like TVs, lights, and cars b) Only mobile phones
c) Website only d) Only computers
14 Smart homes use IoT for:
a) Traditional key-based locks b) Managing home appliances remotely
c) Manual water heating d) Paper documentation
15 Motion sensors are commonly used in:
a) Text editing software b) Social media platform
c) Food packaging d) Smart lighting systems
16 Which device commonly uses a fingerprint sensor?
a) Television b) Smartphone
c) Refrigerator d) Fan
17 Smart traffic lights use data to:
a) Change based on fixed time b) Operate manually by policemen
c) Optimize traffic flow dynamically d) Work only during the day
18 Which of the following is a feature of a smart city?
a) Smart traffic management b) Manual traffic lights
c) Paper maps d) Public payphones
19 What does Cloud Computing allow users to do?
a) Clean their computers b) Access computing services over the internet
c) Build physical servers d) Paint digital images
20 IaaS is used when organizations need:
a) Cloud-based software only b) Infrastructure like servers and networking
c) Web development platforms d) Voice-based control system
21 Grid Computing combines multiple computers to:
a) Share internet only b) Print documents faster
c) Work together on a task d) Reduce electricity use
22 Which of the following best describes Grid Computing?
a) One powerful computer b) Cloud-based storage
c) A software development tool
d)A network of computers solving problems together
23 Blockchain stores data in:
a) Boxes b) Sheets
c) Linked blocks d) File
24 Which of the following is built using Blockchain technology?
a) WhatsApp b) Bitcoin
104 | P a g e
c) Antivirus software d) MS Word
Answer (Multiple Choice Questions)
b) Both Assertion (A) and Reason (R) are true, and Reason (R) is not the correct
explanation of Assertion (A).
105 | P a g e
c) Assertion (A) is true, but Reason (R) is false.
d) Assertion (A) is false, but Reason (R) is true.
1 Assertion (A): Artificial Intelligence helps machines make decisions like humans.
Reason (R): AI systems can learn from data and past experiences.
3 Assertion (A): NLP allows computers to understand human speech and text.
Reason (R): NLP translates machine code into human language.
6 Assertion (A): Big Data can be processed using traditional tools like Excel.
Reason (R): Big Data has high volume, velocity, and variety.
9 Assertion (A): Smart cities aim to improve quality of life using technology.
Reason (R): Smart cities ignore sustainability and focus only on digital tools.
10 Assertion (A): Cloud computing allows access to software and data from anywhere.
Reason (R): Cloud services are stored on remote servers connected via the internet
106 | P a g e
6 (c) A is false, but R is true
7 (a) A and R are true, and R is the correct explanation of A.
8 (c) A is true, but R is false.
9 (c) A is true, but R is false.
10 (a) A and R are true, and R is the correct explanation of A.
11 (c) A is false, but R is true.
12 (c) A is false, but R is true.
a) Identify the technology behind the app and how it mimics human
intelligence.
b) Mention two benefits of using such AI-based tools in education.
Answer:(a) The technology is Artificial Intelligence (AI), which enables the
app to analyze past data and make smart decisions, similar to how a teacher
might suggest topics.
Answer:(b) (i) Personalized learning experience and (ii) instant doubt
resolution
4 Medical students use VR headsets to practice surgery in virtual operation
rooms that simulate real scenarios.
a) Explain how VR creates an immersive experience.
b) List two benefits of using VR for professional training in the medical field.
Answer: (a) VR simulates a 3D environment, making users feel as if they are
in the real surgical room.
Answer: (b) (i) Risk-free learning and (ii) better hands-on practice.
5 What is meant by SaaS in cloud computing? Give one example.
Answer: SaaS stands for Software as a Service. It allows users to access
107 | P a g e
software over the internet. Example: Google Docs.
6 How does blockchain ensure the security of data?
Answer: Blockchain uses cryptographic links between blocks, making it
tamper-proof and ensuring that data cannot be changed without altering all
subsequent blocks.
7 A farm uses soil sensors that send data to the farmer's phone and
automatically switch irrigation pumps on or off.
a) Explain how IoT works in this farming setup.
b) State two advantages of IoT in agriculture.
Answer: (a) Sensors collect data and communicate via the internet to
control pumps automatically.
Answer: (b) (i) Saves water and (ii) increases crop yield.
8 A shopping website recommends clothes and gadgets based on what users
have previously browsed or purchased.
a) Explain how the website “learns” from user behavior.
b) State two ways Machine Learning improves user experience in online
shopping.
Answer: (a)The website uses Machine Learning (ML) to detect patterns in
user activity and uses algorithms to make future recommendations.
108 | P a g e
1. Supervised Learning – where the model learns from labelled data.
2. Unsupervised Learning – where the model identifies patterns in unlabelled
data.
3 Describe the difference between AR and VR. How are they used in education
and entertainment?
Answer: AR overlays digital content on the real world, while VR immerses
users in a virtual environment.
In education, AR can enhance textbooks with 3D models; VR can simulate
lab experiments.
In entertainment, AR is used in games like Pokémon GO, while VR is used
in virtual tours and 3D games.
4 A farmer uses a mobile app connected to soil sensors in his field. The app
alerts him about moisture levels and turns irrigation pumps on/off
automatically.
a) What does IoT stand for?
b) How do sensors help in smart farming?
c) State one advantage of using IoT in agriculture.
d) Mention one device commonly used in IoT-based farming.
Answer:
(a) Internet of Things
(b) Sensors collect real-time data like soil moisture, temperature, and
humidity, which helps in making timely and accurate decisions for crop
management.
(c) IoT improves crop yield while reducing water and resource wastage
through automated systems.
(d) Soil moisture sensor
5 Explain the term Big Data. Discuss the 5 V’s of Big Data with examples.
6 What are the different types of cloud computing services? Explain each
with examples.
110 | P a g e
KENDRIYA VIDYALAYA SANGATHAN
SAMPLE QUESTION PAPER-01
CLASS: XI
INFORMATICS PRACTICES (065)
Time allowed: 3 Hours Maximum Marks:70
111 | P a g e
9 Which of the following is correct with respect to above Python code? 1
d={"a":3,"b":7}
(A) dictionary d is created (B) a and b are the keys of dictionary d.
(C) 3 and 7 are the values of dictionary (D) All of the above.
Q-20 and Q-21 are Assertion (A) and Reason (R) Type questions. Choose the
correct option as:
(A) Both Assertion (A) and Reason (R) are true, and Reason (R) is the
correct explanation of Assertion (A)
(B) Both Assertion (A) and Reason (R) are true, but Reason (R) is not the
correct explanation of Assertion (A)
(C) Assertion (A) is True, but Reason (R) is False
(D) Assertion (A) is False, but Reason (R) is True
20 Assertion (A): List is mutable data type 1
Reason (R): We can update the values of list elements likeLl[1]=5.
112 | P a g e
21 Assertion (A): In SQL, INSERT INTO is a Data Definition Language 1
(DDL) Command.
Reason (R): DDL commands are used to create, modify, or remove database
structures, such as tables.
31 (i) Rewrite the following code in python after removing all the syntax
errors. Underline each correction done in the code.
num1, num2 = 10 5
if num1 % num2 = 0
num1+= 20
num2+= 30
Else: 2+1=3
print(Not Divisible )
32 (A) Consider the following list myList. What will be the output of the code 3
after executing of below code:
myList = [10,20,30,40]
myList.append([50,60])
d=myList.pop(2)
print(d)
print(myList)
OR
(B) Write a program to make 1-D array and 2-D array list and write the
output for both
ii. Write SQL Query to insert the following data in the Items Table
101, Galaxy S30 Ultra, Samsung, Black, 85000, 10
114 | P a g e
(ii) Aman has created a table “Inventory” and forgot to add a
column “GST” of data type integer. Write SQL command to
add the column in the table.
(iii) Smita is working on SQL query , but she is getting error in
her query.Help her in removing error and writing correct
query
select * from Product where price=NULL;
34 Write the output of the queries (i) to (iv) based on the table given below: 4
I. Select BRAND_NAME, FLAVOUR from CHIPS where PRICE < > 10;
II. Select * from CHIPS where FLAVOUR=”TOMATO” and PRICE > 20;
III. Select BRAND_NAME from CHIPS where price > 15 and QUANTITY <
15;
IV. Select price , price *1.5 from CHIPS where FLAVOUR = “PUDINA”;
OR
Consider the given dictionary,
D={1:’monday’, 2:’Tuesday’, 3:’Wednesday’,4:’Thursday’}
(i) What will be the output of following code:
print(D.values())
(ii) What will be the output of D[2]
(iii) Write python code to add a new value ‘Friday ‘with key 5.
(iv) Write python code to remove the value ‘Wednesday’ from the
dictionary.
(v) Which among the following statements will the number of key
value pairs in D ?
(A) D.count() (B) count(D) (C) len(D) (D) D.index()
115 | P a g e
36 Mr. Manav, a database administrator in “Global Educational and Training 5
Institute” has created following table named “Training” for the upcoming
training schedule:
Table : Training:
Training_Id TName Topic City Fee
116 | P a g e
MARKING SCHEME
KENDRIYA VIDYALAYA SANGATHAN
SAMPLE QUESTION PAPER-01
CLASS: XI
INFORMATICS PRACTICES (065)
Time allowed: 3 Hours Maximum Marks:70
Q No. Section-A Marks
1 False (1 mark for correct answer) 1
2 (C) 230 (1 mark for correct answer) 1
3 (D). Structured Query Language (1 mark for correct answer) 1
4 (A) 2 times (1 mark for correct answer) 1
(B)
117 | P a g e
RAM ROM
RAM is Random ROM is Read-only Memory
Access Memory
Data of RAM is Data present in Read Only
very volatile, it Memory (ROM) is not volatile,
will exist as long it is permanent. Data will
as there is no remain unchanged even when
interruption in there is a disruption in the
power power supply.
RAM) is expensive ROM is cheaper when compared
when compared to RAM.
to ROM
23 Degree – 5 Cardinality – 4 2
(1 mark each for correct answer )
24 (i) Create database IP ;
(ii) USE IP ; 2
(1 mark for each correct query)
25 (A) i) Machine Learning – Machine learning is a growing technology
which enables computers to learn automatically from past data
ii) Blockchain technology – It works on the concept of shared
database where each computer has a copy of the database and so it is
not possible for a single user to alter data.
(1 mark each for correct definition)
OR 2
Natural Language Processing –It enables the machines to
(B) understand, analyse, manipulate, and interpret human languages
NLP applications – Spam filters , Virtual Assistants
(1 mark for correct definition)
(1/2 each mark for any two applications)
26 Primary Key : A set of attributes that can uniquely identify each row in a
table (relation). It must contain unique values and cannot be null.
How it differs from Candidate Key
There can be multiple Candidate Keys in a table (relation), but only one of
them is selected as Primary Key. 2
(1 mark for correct definition) (1 mark for correct difference)
27 High Level Language ,Portable ,Cross Platform Language, Interpreted 2
(1/2 mark each for any 4 correct points)
28 (A) DDL - DROP , ALTER 2
DML – DELETE , UPDATE
(1/2 mark for each command)
OR
(B) char(n) varchar(n)
1 CHAR datatype is used to VARCHAR datatype is used to
store strings of fixed store strings of variable length
length
2 In CHAR, If the length of In VARCHAR, If the length of
118 | P a g e
the string is less than set the string is less than the
or fixed-length then it is fixed-length, then it will
padded with space. store as it is ie not padded
with extra space.
(1 mark each for any 2 relevant points )
Q No Section-C (4 x 3 = 12 Marks) Marks
31 num1, num2 = 10 , 5 3
if num1 % num2 == 0 :
num1+= 20
num2+= 30
else:
print(“Not Divisible” )
½ mark for each correction
Immutable datatypes - string , tuple
(1/2 mark each)
119 | P a g e
[10, 20, 40, [50, 60]] (2 mark for correct output)
OR
(B)
½ mark each for import numpy in both 1-D and 2-D Array
1 mark for correct array()
1 mark for correct print statement with output
Q No. Section-D (2 x 4 = 8 Marks) Marks
120 | P a g e
if pn in product:
print(“Product Details Found -
“,pn,’\t\t’,product[pn])
else:
print(“Product Details Not
Found”) ( 1 mark for for loop)
(1 mark for creating dictionary)
(1mark for search )
OR
(i) dict_values([ ‘Monday’,’Tuesday’, ‘Wedneday’,’Thursday’])
(ii) ‘Tuesday’
(iii) D[5]=’Friday’
121 | P a g e
SELECT ITEM, DATEPURCHASE FROM INFANT WHERE
DATEPURCHASE < ’2015-01-01’ ;
ITEM DATEPURCHASE
BABY SOCKS 2014-10-16
122 | P a g e
KENDRIYA VIDYALAYA SANGATHAN
SAMPLE QUESTION PAPER 02
CLASS XI : INFORMATICS PRACTICES (065)
TIME: 03 HOURS M.M: 70
a)list(range(-2,-8,-2))
b) list(range(0,-8,-2))
c) list(range(-2,-10,-2))
d) list(range(0,-10,-2))
125 | P a g e
13 Comments are executed by interpreter. State True or False 1
14 A company interested in cloud computing is looking for a provider who 1
offers a set of basic services such as virtual server provisioning and on-
demand storage that can be combined into a platform for deploying and
running customized applications. What type of cloud computing model fits
these requirements?
a) Platform as a Service
b) Software as a Service
c) Infrastructure as a Service
15 The COUNT(*) function provides the total number of __________ within a 1
relation (table) in a relational database.
(A) Columns (B) Unique values (C)Not-null values (D)Rows
16 Identify the SQL command used to delete a relation (table) from a relational 1
database.
(A) DROP TABLE (B) REMOVE TABLE
(C) DELETE TABLE (D)ERASE TABLE
17 Which is not one of the features of IoT devices? 1
a) Remotely controllable b) Programmable
c) Can turn themselves off if necessary d) None of the above
18 from the below python code display the value of first element of array and 1
display number 35 from an array
import numpy as np
Array=np.array([3,6,9,12,15,18,36,35,38])
print(Array[ ],Array[ ])
(a) [1],[7] (b) [1],[8] (c) [0],[8] (d)[0],[7]
19 “Imagine what if our bulbs, fans and refrigerator also become a part of 1
LAN or Internet. Think about of the advantages and tasks that can be
accomplished if all these devices with smart connectivity features are
able to communicate amongst themselves and we are also able to
communicate with them using computers or smart phones.”
In your opinion, which feature are we talking about in the above context?
(i) AR (ii) VR (iii) WoT (iv) IoT
126 | P a g e
SECTION B (7 x 2 = 14 Marks)
22 Deleting digitally stored data means changing the details of data at bit 2
level, which can be very time consuming. Therefore, when any data is
simply deleted, its address entry is marked as free, and that much
space is shown as empty to the user, without actually deleting the data.
In case data gets deleted accidentally or corrupted, there arises a need
to recover the data. Recovery of the data is possible only if the
contents/memory space marked as deleted have not been overwritten
by some other data.
i) Can you recover the data once deleted? Justify
ii) Give any one security threat involved when we throw away
electronic gadgets that are non-functional.
Or
Write down the type of memory needed to do the following:
i) To execute the program
ii) To store the instructions which cannot be overwritten
23 How to create an Array of list in python using NumPy? Explain with 2
suitable example.
24 What are DDL and DML? Give one command of each. 2
127 | P a g e
ii) arrange the elements of the list in ascending order
iii) to add an element in any position of a list
30 (i) Himank has written the following statement in Python, but 1+2
it is showing an error: =3
X = 0o81
According to you what could be the problem?
(ii) “Our heritage monuments are our assets. They are a
reflection of our rich and glorious past and an inspiration
for our future. UNESCO has identified some of Indian
Heritage sites as World Heritage Sites.”
Identify at least two parameters from the above text that can be used as
key value pair to set up a dictionary. Form a dictionary to create at least 5
records of World Heritage Sites.
31 (i) Write an SQL statement to create a table named STUDENTS, with the 3
following specifications:
Column Name Data Type
StudentID Numeric
FirstName Varchar(20)
LastName Varchar(20)
DateOfBirth Date
Percentage Float(10,2)
ii.
iii. (ii) Write SQL Query to insert the following data in the Students Table
1, Supriya, Singh, 2010-08-18, 75.5
32 Consider the table “Accessories” given below and write suitable output 3
of the following:
128 | P a g e
SECTION D (2X4=8 Marks)
33 i) What will be the output of following code: 1+1
dict1 = {“Rollno”:20, “Marks”:65} +2
dict2 = {“Rollno”:20, “Marks”:65} =4
print(dict1 == dict2)
ii) Name different types of comments in Python.
iii) Predict the output of the following:
quota = [“sports”, “ pwd”, “ews”, “gen”]
Marks= [58,70,45,69]
for k in range(len(quota)):
if quota[k]==”sports”:
Marks[k]+=2
if quota[k]==”ews”:
Marks[k]+=5
129 | P a g e
36 Consider the table ‘Teacher_Details’ given below and write suitable SQL 5
queries of the following:
Table: Teacher_Details
T_ID T_Name T_DOJ T_Subject Num_of_Periods
1001 Bharti 2018-10-15 Hindi 27
1002 Pratima NULL NULL 32
1003 Savitri 2012-11-13 Science 29
1004 Aashna 2020-02-24 English 28
i) Display the T_Name and Num_of_Periods by increasing
the number of periods each by 1.
ii) Display T_Name of all those teachers whose date of joining
is after 1st Jan 2019.
iii) Display T_ID and T_Name of all those teachers whose number
of periods are in the range of 25 to 30. (both values
included)
iv) Display the details of all those teachers who have not assigned
any subject.
v) Display the details of all those teachers whose subject is either
Hindi or Science.
37 a) A data analyst wants to preprocess a list of numbers by replacing all 3+2
positive numbers with 1 and negative numbers with -1. The analyst =5
needs a Python program to accept the list from the user, modify it, and
display the result.
Requirements:
1. Accept a list of numbers from the user.
2. Replace all positive numbers with 1 and negative numbers with -
1.
3. Display the modified list.
Solution:
Write a Python program that meets the requirements above.
OR
130 | P a g e
list1 = [11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
print(list1[::2])
print(list1 + [21, 22])
print(list1[::-])
131 | P a g e
KENDRIYA VIDYALAYA SANGATHAN
SAMPLE PAPER 02
CLASS XI -INFORMATICS PRACTICES (065)
MARKING SCHEME
TIME: 03 HOURS M.M: 70
SECTION A (21 x1=21 Marks)
1 Ans: (a) 1 GB 50MB 1
2 Ans: False 1
3 Ans: (c) TypeError 1
6 Ans: d) 4_Data 1
7 Ans: c) if 1
8 Ans: b) 4 1
10 Ans: b) 4 1
13 False 1
15 d)Rows 1
16 a) DROP TABLE 1
18 d) [0],[7] 1
19 d) IoT 1
20 b) Both A and R are true and R is not the correct explanation for A 1
132 | P a g e
21 a) Both A and R are true and R is the correct explanation for A 1
133 | P a g e
- Typically requires a headset or device
Examples: Gaming, simulations, virtual tours
Augmented Reality (AR)
- Overlays digital information onto the real world
- Enhances the physical environment with virtual objects
- Combines digital and physical elements
- Can be experienced through smartphones, tablets, or smart glasses
Examples: Pokémon Go, Snapchat filters, Google Maps
1 mark for explanation and 1 mark for example
27 As per MySQL, ORDER BY must be the last clause in SQL QUERY, and in this query 2
ORDER BY is used before WHERE which is wrong, the correct query will be:
2 mark for correct answer, 1 mark may be awarded for identifying the error
28 Degree :3 2
Cardinality :4
Or
1. Open-Source and Cost-Effective: MySQL is an open-source relational database
management system, which means it is free to download, use, and modify. This
reduces the overall cost of development and maintenance.
To fix the error, Himank can simply remove the leading zero, like this:
(1 mark for the correct answer)
(ii) Two parameters that can be used as key-value pairs to set up a dictionary are:
134 | P a g e
"Red Fort": "A historic fort in Delhi, built by Mughal Emperor Shah Jahan",
"Humayun's Tomb": "A tomb in Delhi, built by Haji Begum, the wife of Humayun",
"Qutub Minar": "A minaret in Delhi, built by Qutb-ud-din Aibak",
"Fatehpur Sikri": "A historic city in Uttar Pradesh, built by Mughal Emperor
Akbar" }
print(world_heritage_sites)
(2 marks for correct answer)
32 Consider the table “Accessories” given below and write suitable output of the 3
following:
i) SELECT DISTINCT NAME FROM ACCESSORIES WHERE
PRICE>5000;
Ans:Mother Board
LCD
ii) SELECT AVG(PRICE), MAX(PRICE) FROM ACCESSORIES WHERE
PRICE>=10000;
AVG(PRICE) MAX(PRICE)
12500 13000
NAME DISCOUNT
Keyboard 25
Mother Board 650
Keyboard 20
Hard Disk 225
( 1 mark for each correct output)
SECTION D (4 x2 =8 Marks)
33 i) True 4
ii) Single Line comment and Multi Line comment
iii) [60, 70, 50, 69]
(½ mark to be awarded for each correct value)
135 | P a g e
place to store the installed software.
(1 mark for correct explanation)
ii) Cache memory is considered crucial for microprocessor performance
because:
136 | P a g e
37 a) A data analyst wants to preprocess a list of numbers by replacing all 3+2
positive numbers with 1 and negative numbers with -1. The analyst needs =5
a Python program to accept the list from the user, modify it, and display
the result.
Requirements:
1. Accept a list of numbers from the user.
2. Replace all positive numbers with 1 and negative numbers with -1.
3. Display the modified list.
Solution:
Write a Python program that meets the requirements above.
Ans: 3 Marks for any correct logic
OR
a) [11,13,15,17,19]
[11,12,13,14,15,16,17,18,19,20,21,22]
[20,19,18,17,16,15,14,13,12,11]
137 | P a g e
KENDRIYA VIDYALAYA SANGATHAN
UNSOLVED PAPER 1
CLASS XI - INFORMATICS PRACTICES (065)
139 | P a g e
structures, such as tables.
QNo. Section-B (7 x 2 = 14 Marks) Marks
22 (A) What is the difference between RAM and ROM? 2
OR
(B) What is the difference between Primary Memory and Secondary
Memory?
23 Rahul, a beginner in the field of Computer Science wants to know about the 2
different types of software. Explain to him the advantages and disadvantages
of Proprietary software?
OR
140 | P a g e
and write the name of Two Input and Output devices. 3
30 (A) Phuntsok has started his coding lessons in Python. Help him to 3
write a program to accept the sales made in a shop and calculate
the percentage of discount as per the following table:
Sr.No Sales Discount
1 < 1000 No discount
2 Between 1000 5%
and 5000
3 More than 5000 10%
Display the discount percentage as well as the final
discounted price to be paid.
OR
Sonam, a software trainee has been assigned a task to write a
(B) program that accepts the percentage of a student and then gives
the result of the student as per the following table. Help her in
accomplishing this task
percentage Result
More than 75 percent First Class
60 to 75 percent Second Class
40 to 60 percent Pass Class
Less than 40 percent Fail
(a) Suggest the Primary key for the table giving appropriate reasons.
(b) Write the SQL command to insert the following data in the table:
Salesid - E009, Name-Sukumar, City-Nagpur, Commission-10
(c) Is the command used in part (b) a DDL or a DML command
32 (A) What is Big Data? Explain any four features of Big Data. 3
OR
(B) What is Cloud Computing? Explain any two services offered on
the cloud.
Q No. Section-D (2 x 4 = 8 Marks) Marks
33 Write a program to accept the name of an item and its price repeatedly from 4
the user and use it to create a dictionary. The key is the item name and the
value is the price of the item. Ask the user for an item name and then find its
price
141 | P a g e
34 (A) Consider the following table BOOK and answer the questions 4
that follow:
Table: BOOK
BCODE TITLE AUTHOR PRICE
MIDNIGHT’S SALMAN
B001 500
CHILDREN RUSHDIE
THE GOD OF ARUNDHATI
B002 450
SMALL THINGS ROY
VIKRAM
B003 A SUITABLE BOY 600
SETH
THE WHITE ARAVIND
B004 399
TIGER ADIGA
TRAIN TO
B005 KHUSHWAN 350
PAKISTAN
T SINGH
Write SQL query to-
(a) Display book titles and the author names.
(b) Display the book titles priced more than 400.
(c) Display the details of books written by ARUNDHATI
ROY and KHUSHWANT SINGH.
(d) Remove the book ‘THE WHITE TIGER’ from the
table.
OR
(B) Consider following table MEDICINE and answer the questions
that follow:
Table: MEDICINE
MID MED_NAME SUPP_CITY STOCK DEL_DATE
M01 PARACETAMOL MUMBAI 200 2023-06-15
M02 AMOXICILLIN KOLKATA 50 2022-03-21
M03 COUGH SYRUP BENGALURU 120 2023-02-10
M04 INSULIN CHENNAI 135 2023-01-25
M05 IBUPROFEN HMEDABAD 30 2022-04-05
(a) Display the Medicine names and the supplier cities of all
medicines
(b) Display the medicine names from Mumbai and Chennai
cities.
(c) Display the medicine names delivered in 2022
(d) To remove the medicine ‘INSULIN’ from the table.
Q No. Section-E (3 x 5 = 15 Marks) Marks
35 Rafael is working on a project monitoring the sales of a Company and is 5
working on the table SALES as shown below:
142 | P a g e
Assist him by writing the output of the following SQL queries:
(A) select distinct City from Sales;
(B) Select Name, Commission * 0.5 As NewCommission from Sales;
(C) Select * from Sales where (City =‘Delhi’ or City = ’Mumbai’) and
Commission>20;
(D) Select Name, City from Sales where Commission between 20 and 30;
(E) Select Name from Sales where City != ‘Delhi’ and City !=’Kolkata’;
37 (A) 5
Write a program that will manage the inventory of a shop.
The program should create a dictionary consisting of five
products from user input in which the key is the product
name and the value is the quantity presently in stock. The
user must input the product name and the quantity
separately, the program must add it dynamically to the
143 | P a g e
dictionary.
The program should then ask from the user a list containing
five numbers. The list of numbers are the quantities that are
to be reduced from the stock. The program should reduce the
(B) quantities from the dictionary and then display the updated
dictionary OR
144 | P a g e
Web links:
1. Syllabus for Higher Secondary Stage prescribed by NCERT:
https://ncert.nic.in/pdf/syllabus/IPHSS.pdf
145 | P a g e