0% found this document useful (1 vote)
682 views98 pages

XI Informatics Practices

The document provides an introduction to computer systems, including: 1) It describes the evolution of computing devices and the components of a computer system such as the CPU, memory, input/output devices, and their interconnections. 2) It explains computer memory in terms of primary and secondary memory, units of memory, data deletion and recovery, and related security concerns. 3) It discusses the purpose and types of software including system software, application software, generic and specific purpose software.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
682 views98 pages

XI Informatics Practices

The document provides an introduction to computer systems, including: 1) It describes the evolution of computing devices and the components of a computer system such as the CPU, memory, input/output devices, and their interconnections. 2) It explains computer memory in terms of primary and secondary memory, units of memory, data deletion and recovery, and related security concerns. 3) It discusses the purpose and types of software including system software, application software, generic and specific purpose software.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 98

केन्द्रीय टवद्यालय सींगठन

कोलकाता सींभाग
KENDRIYA VIDYALAYA SANGATHAN
KOLKATA REGION

अध्ययन सामग्री
STUDY MATERIAL
कक्षा : ग्यारहवी ीं
CLASS: XI
इन्फॉमैटिक्स प्रैक्टिसेज
Informatics Practices (065)
2023-24

कोलकाता सींभाग
KOLKATA REGION

PAGE:1
Chief Patron :- Mr. Y. Arun Kumar
Deputy Commissioner, KVS RO Kolkata
Patrons :- 1) Mr. Sanjib Sinha
Assistant Commissioner, KVS RO Kolkata
2)Mr. Chintapalli Vijaya Ratnam
Assistant Commissioner, KVS RO Kolkata
3)Mr. Dibakara Bhoi
Assistant Commissioner, KVS RO Kolkata
4) Mr. Amit Baidya
Assistant Commissioner, KVS RO KOL.
Co-Ordinator :- Mr. Amarendra Kumar Jha
Principal I/C,KV NO-1 AFS Kalaikunda

Resource Person: - Mr. Bishwajit Banerjee (PGT Comp. Sc.)


K. V. NTPC FARAKKA

Contributors :- 1.Mr. AriIjit Ghosh , PGT(CS), KV COSSIPORE


2. Mr. Soumalik Roy , PGT (CS), KV ISHAPORE No 2
3. Mr. Avisek Pal , PGT (CS), KV HALDIA
4. Mr. Ashish Kumar Singh ,PGT (CS), KV ANDAL
5. Mr. Suman Chakraborty , PGT (CS), KV RANAGHAT
6. Mr. Partha Karati , PGT (CS), KV SANTRAGACHI
7. Mr. Manu Dev Hembrom , PGT (CS), K.V ADRA
8. Mr. Anuj Kumar , PGT (CS), KV IIT KHARAGPUR
9. Mr Abhishek Jha , PGT (CS), KV SEVOKE ROAD

PAGE:2
Salient features of this Study Material
1. Targeting 100% pass rate.
2. Ensuring a minimum level of learning.
3. Providing support for improving risers and other students of Class XI in the
subject of IP (Informatics Practices).
4. Provide an introduction to the chapter, including its relevance and importance.
5. Summarize the key concepts and takeaways from the chapter.
6. Multiple Choice Questions (MCQs):
Present a set of multiple-choice questions related to the chapter .Include
options for each question and provide correct answers.
7. Assertion and Reason-Based Questions:
Include assertion and reason-based questions to test logical reasoning. and
provide correct answers.
8. Questions of 2 Marks (Knowledge/Understanding/Application-Based )
Create questions related to identifying errors in code or predicting program
output and Include model answers.
9. 3 Marks Questions (Knowledge/Understanding/Application-Based):
Formulate questions requiring a deeper understanding of the chapter.
Include questions that test the application of concepts and provide model
answers.
10.4 Marks Questions (Knowledge/Understanding/Application-Based):
Include comprehensive questions combining various aspects of the chapter.
Cover topics like application, output, errors, and in-depth understanding and
provide detailed model answers
11.Case Study-Based Questions:
Include case study questions that require students to analyse and apply their
knowledge to real-world scenarios. Provide model answers or suggested
approaches to solving the case studies.

PAGE:3
INDEX

S. No. UNIT Page No.

1 DISTRIBUTION OF MARKS 05

2 Syllabus 06
2 UNIT-1
Introduction to Computer System 07-28

3 UNIT-2
Introduction to Python 29-65

4 UNIT-3
Database concepts and the Structured 66-87
Query Language
5 UNIT-4
Introduction to Emerging Trends 87-98

PAGE:4
Units and Marks
UNIT UNIT NAME MARKS
1 Introduction to Computer System 10
2 Introduction to Python 25
3 Database concepts and the 30
Structured Query Language
4 Introduction to Emerging Trends 5
5 Practical 30
TOTAL 100

PAGE:5
Syllabus of Class XI IP (2023-2024)

Topics to be-covered Th. Pr.


Unit1:Introduction to Computer System 10
• Introduction to computer and computing: evolution of computing devices,
components of a Computer System and their inter connections,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
Unit2:Introduction to Python 35 28
• Basics of Python programming,Python interpreter-interactive and script
mode, the structure of a program,
• Indentation,identifiers,keywords,constants,variables,types of
operators,precedence of operators,data
• Types,mutable and immutable data types,
statements,expressions,evaluationand comments, input and output
statements,
• Data type conversion,debugging.
• Control Statements:if-else,if-elif-else, while loop,forloop
• Lists: list operations-creating,initializing,traversing and manipulating lists,list
methods and built-infunctions.– len(),list(),append(),insert(),
count(),index(),remove(), pop(), reverse(), sort(), min(),max(),sum()
• Dictionary:conceptof key-value pair,
creating,initializing,traversing,updating and deleting elements,dictionary
methods and built-infunctions.– dict(), len(), keys(), values(), items(),
update(), del(), clear()
Unit3:Database concepts and the Structured Query Language 17 7
• Database Concepts: Introduction to database concepts and its need, Database
Management System.
• Relational data model: Concept of domain, tuple,relation, candidate key,
primary key, alternate key
• Data Query: SELECT, FROM, WHERE with relational operators, BETWEEN,
logical operators, IS NULL, IS NOT NULL
• Data Manipulation: INSERT, DELETE,UPDATE
Unit4:IntroductiontotheEmergingTrends 7
• Artificial Intelligence, Machine Learning, Natural Language Processing
,Immersive experience(AR,VR),Robotics,Big data and its characteristics,
Internet of Things(IoT), Sensors, Smart cities, Cloud Computing and Cloud
Services(SaaS, IaaS,PaaS);Grid Computing, Block chain technology

PAGE:6
Name of the chapter : Introduction to Computer System
Topic Covered

• Introduction to computer and computing: evolution of computing devices, components


of a Computer System and their inter connections,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
Key Points
Hardware:-Computer hardware refers to the physical components of a computer system,
including the central processing unit (CPU), memory, storage devices, input devices
(keyboard, mouse), output devices (monitor, printer), and other peripherals. It encompasses
the tangible, electro-mechanical, and electronic elements that constitute a computer and
enable its functioning.
Integrated Circuit:An Integrated Circuit (IC) is a compact assembly of interconnected
electronic components, such as transistors, resistors, and capacitors, fabricated on a
semiconductor substrate. This miniaturized arrangement enables the creation of complex
electronic circuits, forming the basis of modern microprocessors, memory chips, and various
electronic devices.
Input Devices:Computer input devices are hardware components that allow users to provide
data and commands to a computer system. Examples include keyboards for typing, mice for
pointing and clicking, and scanners for converting physical documents into digital form.
These devices enable users to interact with and input information into the computer.
Output Devices:Computer output devices are hardware components that present or display
processed information from a computer to the user. Examples include monitors for visual
output, printers for producing hard copies of documents, and speakers for audio output. These
devices convey the results of computations and operations performed by the computer.
Central Processing Unit:The Central Processing Unit (CPU) is the primary component of a
computer responsible for executing instructions from programs. Acting as the "brain" of the
system, it performs arithmetic and logic operations, manages data, and coordinates the
functioning of other hardware components, crucial for overall computing functionality and
speed. It consists of Arithmetic Logic Unit, Control Unit & Registers
Arithmetic Logic Unit: The Arithmetic Logic Unit (ALU) is a fundamental component of a
computer's central processing unit (CPU) responsible for performing arithmetic and logical

PAGE:7
operations on binary data. It executes tasks like addition, subtraction, AND, OR, and other
operations, crucial for processing and manipulating information within the computer system.
Control Unit:The Control Unit is a critical component of a computer's central processing
unit (CPU) that manages and coordinates the execution of instructions. It decodes program
instructions, directs data flow within the CPU and between other system components, and
controls the overall operation of the processor to execute tasks in a programmed sequence.
Memory:Computer memory refers to the electronic components that store data and
instructions temporarily or permanently for processing by a computer. It includes RAM
(Random Access Memory) for temporary storage and ROM (Read-Only Memory) for
permanent storage. Memory is crucial for the execution and retrieval of information during
computer operations.
Primary Memory:Primary memory, also known as main memory or RAM (Random Access
Memory), is a volatile and fast-access computer storage that temporarily stores data and
instructions for the CPU. It plays a critical role in actively running programs and allows
quick access to information needed for ongoing computational tasks.
Secondary Memory:Secondary memory refers to non-volatile storage devices in a computer
system, such as hard drives, solid-state drives, and external storage. Unlike primary memory
(RAM), it retains data even when the power is off. Secondary memory is used for long-term
storage of files, applications, and the operating system.
Registers:Memory registers are small, high-speed storage locations within a computer's
central processing unit (CPU). They temporarily hold data and instructions that the CPU is
actively processing. Registers play a crucial role in facilitating quick access to information
and supporting the efficient execution of instructions during program operation.
Cache Memory:Cache Memory is a high-speed volatile computer memory located between
the central processing unit (CPU) and main memory. It stores frequently accessed data and
instructions to expedite retrieval, enhancing overall system performance by reducing the time
it takes for the CPU to access frequently used information during program execution.
System Bus:The System Bus is a communication pathway that connects the major
components of a computer system, facilitating data transfer between the central processing
unit (CPU), memory, and peripheral devices. It comprises the address bus, data bus, and
control bus, coordinating the flow of information within the computer architecture.
Data Deletion-It is the simple process of deleting a file and placing it into the Recycle Bin or
Trash.
Data recovery-It is a process of retrieving deleted, inaccessible, lost, corrupted, damaged, or
formatted data from secondary storage/ removable media .
PAGE:8
Data security -It is the process of protecting corporate data and preventing data loss through
unauthorized access.
Software -It is basically a set of instructions or commands that tell a computer what to do.
System Software-It is a program designed to run a computer's hardware and applications and
manage its resources, such as its memory, processors, and devices.
Application Software-It is a type of computer program that performs a specific personal,
educational, and business function.
Generic software- Generic software is a system designed for general public usage.
Specific software-It is software that is created for a specific purpose, organization, or
individual.
30 Objective Question (1 Mark )
Q1. A computer is a/an ............ device.
a) Mechanical
b) Electrical
c) Electronic
d) Telecommunication
Ans c) Electronic
Q2. The physical components of the computer are known as
a) Software
b) Program
c) Hardware
d) Both A and C
Ans c) Hardware
Q3. Which of the following is not related to a personal computer:
a) Processor
b) Onboard
c) Motherboard
d) Keyboard
Ans b) Onboard
Q4. Which of the following is not a type of computer:
a) Smart Phone
b) Smart watch
c) Biometric
d) Tablet PC
Ans c) Biometric

PAGE:9
Q5. Which type of PC is available in your school computer laboratory?
a) IBM PC
b) Macbook
c) Chrome Book
d) Tablet PC
Ans a) IBM PC
Q6. Full form of ALU is:
a) Abacus Logarithmic Unit
b) Arithmetic Logic Unit
c) Abacus Language Unit
d) Arithmetic Language Unit
Ans b) Arithmetic Logic Unit
Q7. Which of the following is a part of ALU?
a) Arithmetic Unit
b) Control Unit
c) Logic Unit
d) Both a) and c)
Ans d) Both a) and c)
Q8. First binary programmable computer based on Von Neumann architecture is:
a) UNIVAC
b) EDVAC
c) ENIAC
d) Mark I
Ans c) ENIAC
Q9. Arrange the following in increasing order of no of transistors on a single chip:
i) SLSI
ii) IC
iii) VLSI
iv) LSI
a) i) SLSI ii) IC iii) VLSI iv) LSI
b) ii) IC iii) VLSI iv) LSI i) SLSI
c) ii) IC iv) LSI iii) VLSI i) SLSI
d) iii) VLSI iv) LSI i) SLSI ii) IC
Ans c) ii) IC iv) LSI iii) VLSI i) SLSI

PAGE:10
Q10. Which of the following is the fastest memory?
a) RAM
b) Cache
c) ROM
d) Hard Disk
Ans b) Cache
Q11 Binary number system comprises of the digits:
a) 1, 2
b) 0, 1
c) a, b
d) i, ii
Ans b) 0, 1
Q12 ______ is volatile i.e. as long as the power is supplied to the computer, it retains the
data in it
a) RAM
b) CD
c) ROM
d) Hard Disk
Ans a) RAM
Q13 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 i) KB iii) MB
b) ii) GB iv) TB i) KB iii) MB
c) iv) TB iii) MB i) KB ii) GB
d) iv) TB ii) GB iii) MB i) KB
Ans d) iv) TB ii) GB iii) MB i) KB
Q14 Which of the following is not an input device?
a) Scanner
b) Speakers
c) Webcam
d) Joystick
Ans b) Speakers

PAGE:11
Q15 ______ is an electronic pathway composed of cables which connects the major parts
of a computer system
a) Motherboard
b) Processor
c) Bus
d) Cache
Ans c) Bus
Q16. Which of the following cannot be the reason for data deletion from HDD?
a) Data lost due to shutting down the PC
b) Hacker attacking the system.
c) Bad sector in Hard Disk
d) Accidentally deleting a file.
Ans a) Data lost due to shutting down the PC
Q17. Which of the following is not a data recovery software?
a) Recuva
b) EaseUS
c) Disk Drill
d) Matlab
Ans d. Matlab
Q18. In which of the scenario do we need to recover data?
a) When disk is full.
b) When system performance has become slow.
c) When a photo or video has been accidentally deleted.
d) All of the above
Ans c) When a photo or video has been accidentally deleted.
Q19. Which of the following is an example of Proprietary software?
a) Linux
b) Windows
c) Mozilla Firefox
d) None of the above
Ans b) Windows
Q20. Cryptographic utilities are used to ___________ files to prevent unauthorized users.
a) Encrypt
b) Decrypt
c) Both of these
d) None of thse
Ans c) Both of these

Q21. Operating System is an example of


a) System software
b) Utility program
c) Application software
d) None of the above
Ans a) System software

PAGE:12
Q22. _________ is a software that can be freely downloaded and even distributed to
others.

a) Open source software


b) Liteware
c) Shareware
d) Freeware
Ans d) Shareware
Q23. Word processing and desktop publishing are the examples of

a) Hardware
b) Software
c) CPU
d) None of these
Ans Software
Q24. The full form of OSS is ________________
a) Operating system software
b) Operating source software
c) Open system software
d) Open source software
Ans d) Open source software
Q25. An antivirus software is an example of __________
a) System software
b) Pirated software
c) Freeware
d) Utility software
Ans d)Utility software
Q26 ___________________ is designed to solve a specific problem or to do a specific
task.

a) System software
b) Utility software
c) User
d) Application software
Ans d) Application software
Q27 Which of the following is not a feature of a compiler?

a) Execution time is more


b) When all the syntax errors are removed execution takes place
c) Scans the entire program first and then translate it into machine code
d) Slow for debugging
Ans a) Execution time is more
Q28 Which of the following is not an example of system software?
a) Language Translator
b) Utility Software
c) Communication Software
d) Word Processors
Ans e) Word Processors

PAGE:13
Q29 What is the process of deleting all the data on the hard drive?
a) Delete
b) Erase
c) Formatting
d) Uninstall
Ans c) Formatting
Q30 A general purpose software is a type of ______________
a) System software
b) Database software
c) Package software
d) Application software
Ans e) Application software

10 Assertion and reason Based question ( 1 Mark )

Q1. Assertion (A): Computers use binary code (0s and 1s) to represent and process data.
Reason (R): Binary code is the fundamental language of computers, where 0
represents OFF and 1 represents ON in the context of electronic switches.
Ans Both A and R are true and R is the correct explanation for A.
Q2. Assertion (A): Main/Primary memory is volatile.
Reason (R): ROM which is a part of main memory is non-volatile.
Ans A is False but R is True.
Q3. Assertion (A): The CPU (Central Processing Unit) is often referred to as the "heart"
of the computer.
Reason (R): The CPU is responsible for executing instructions and performing
calculations, similar to the human heart's processing capabilities.
Ans A is False but R is True.
Q4. Assertion (A): RAM (Random Access Memory) is volatile memory.
Reason (R): RAM retains its data even when the computer is powered off.
Ans A is True but R is False.
Q5. Assertion (A): A scanner is an output device that produces hard copies of digital
documents.
Reason (R): Scanners use sensors to capture images or text from paper documents,
making them available for digital processing and storage.
Ans A is False but R is True.
Q6. Assertion : It is always good to keep the passwords encrypted while storing.
Reason : Encrypted data cannot be easily stolen by hackers.
Ans Both A and R are true and R is the correct explanation for A

PAGE:14
Q7. Assertion : Windows 10 is a system software.
Reason : The software that protects a computer system from computer virus is system
software
Ans A is True but R is False.
Q8. Assertion : Not all types of software are system software.
Reason : Application software are designed to carry out operations for a specific
application.
Ans Both A and R are true and R is the correct explanation for A
Q9. Assertion : A software designed for a bank will work only for the account holders of
that bank.
Reason: Customized software are tailor made software according to user
requirements.
Ans Both A and R are true and R is the correct explanation for A
Q10. Assertion : A system software is also called as a manager.
Reason: Utility software assists the computer in maintaining it’s performance.
Ans Both A and R are true but R is not the correct explanation for A
10 Short Knowledge/Understanding/Application Based Questions (2 Marks)

Q1. Differentiate between RAM and ROM.


Ans .
RAM ROM
i) Full form is Random Access Full form is Read Only Memory
Memory
ii) RAM is volatile memory that ROM is non-volatile memory that
temporarily stores the files you are permanently stores instructions for your
working on. computer.
.
Q2. Where is cache memory located and what is its use?
Ans Cache memory is located on the CPU itself or very close to it, typically on the same
chip as the CPU.
The primary purpose of cache memory is to store frequently accessed data and
instructions, providing the CPU with faster access to this information than fetching it
from the main memory (RAM).
Q3. List out two arithmetic and two logical operators
Ans Arithmetic operators: + – * /
Logical operators: > ,< , >= , <=, = , !=
Q4. Where registers are located and what are their uses?
Ans Registers are located inside the central processing unit (CPU), and they are the
smallest, fastest, and most accessible form of memory within a computer.

PAGE:15
CPU uses registers to either hold processing information or to store some part of data
or some memory address or some instructions.
Q5. What is the function of Control Unit in a CPU?
Ans The functions of control unit are:
i) It controls instruction execution.
ii) It guides the interpretation, flow and manipulation of data.
Q6. Deleting digitally stored data means changing the details of data at bit level, which
can bevery time consuming. Therefore, when any data is simply deleted, its address
entry ismarked as free, and that much space is shown as empty to the user, without
actuallydeleting the data.
In case data gets deleted accidentally or corrupted, there arises a need to recover
thedata. Recovery of the data is possible only if the contents/memory space marked
asdeleted 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.
Ans i) Yes, by Data Recovery. Data recovery is a process of retrieving deleted,
corrupted and lost data from secondary storage devices.
ii) ii) If these storage devices fall into the hands of mischief-mongers, they
can easily 1 recover data from such devices; this poses a threat to data
confidentiality.
Q7. What are the two main categories of system software?
Ans The two main categories of system software are:
a) Operating system- It is a program which acts as an interface between the user
and the hardware.
b) Language processor- It is responsible for converting a High level code to
machine language.
Q8. What is data deletion? How does it work?
Ans Data deletion is the process where the data is deleted from the system either
accidentally or intentionally.
Deleting stored data means changing the details of data at bit level, which can be
very time consuming. Therefore when any data is simply deleted it’s address entry is
marked as free, and that much space is shown empty to the user.
Q9. What is the difference between system software and application software.
Ans System Software Application software
System software is mainly designed for Application softwareis mainly designed
managing system resources. to accomplish tasks for specific
purposes.
Programming of system software is Programming of application software is
complex. comparatively easy.
A computer cannot run without system A computer can easily run without an
software. application software.
System software do not depend on Application software do depend on
application software. system software.

PAGE:16
Q10. What is the difference between customized software and generic software.
Ans Customized software Generic software
Designed for a specific user’s or Designed for a broad range of users
organization’s needs. with general needs.
Specific maintenance and support Standard maintenance and support
required. required.
Longer development time required to Shorter development time required.
meet all the needs.

10 Short Knowledge/Understanding/Application Based Questions (3 Marks)


Q1. What is the IPO cycle in a computer?
Ans The IPO cycle, which stands for Input-Processing-Output cycle, is a fundamental
concept in computer science and information processing. It describes the sequence of
operations that a computer follows to process data and produce results.
Here's an overview of each phase in the IPO cycle:
• Input: In this phase, data or information is collected from external sources or
input devices, such as keyboards, mice, sensors, or storage devices like hard drives
and network connections. Input can be in the form of text, numbers, images, sound,
or any other data type.
• Processing: In the processing phase, the computer performs various
operations on the input data. This can include calculations, transformations,
comparisons, sorting, filtering, and executing instructions specified by software
programs.
• Output: After processing, the computer generates results or output data.
Output can take various forms, such as displaying information on a screen, printing a
document, saving data to storage, sending data over a network, or producing sound
through speakers.
Q2. List out at least three differences difference between cache memory and registers in a
computer?
Ans

Cache Memory Registers


i) Cache memory offers fast access Registers are the fastest form of memory
times but is slower than registers in a computer, with almost instant access
times.

PAGE:17
ii) Cache memory is located between Registers are part of the CPU's
the CPU and the main memory. It architecture and are located directly on
can be on the CPU chip itself. the CPU chip.
iii) Cache memory is used to store Registers are used for temporary storage
frequently accessed data and of data and instructions that are actively
instructions from the main being processed by the CPU. They are
memory, optimizing overall crucial for executing instructions and
system performance by reducing performing calculations.
memory latency.
.
Q3. Write the full forms of the following:
SMPS USB CRT UPS BIOS PROM

Ans SMPS → Switched-Mode Power Supply


USB → Universal Serial Bus
CRT → Cathode Ray Tube
UPS → Uninterruptible Power Supply
BIOS → Basic Input Output System
PROM → Programmable Read-Only Memory

Q4. Mr Rakesh has eleven CDs each of capacity 700 MB containing MP3 songs of
legendary singers of Bollywood. After few years he discovers that the CDs are
becoming corrupt. So he wants to transfer the songs to a pen drive for keeping them.
How much minimumcapacity pen drive should he purchaseif pen drives are available
in 2 GB, 4 GB, 8 GB and 16 GB sizes?

Ans Capacity of 1 CD=700 MB


Capacity of 11 CDs=700*11=7700 MB
1024 MB = 1 GB
So no of GB in 7700 MB=7700/1024=7.5 GB
Hence Mr.Rakesh should purchase a 8 GB pendrive to transfer the songs in the 11
CDs.

PAGE:18
Q5. Write at least three differences between keyboard and mouse.
Ans
Keyboard Mouse
i) A keyboard is primarily used for A mouse is primarily used for pointing,
entering text, numbers, and selecting, and interacting with graphical
various commands. It is the elements on the computer screen. It
primary input device for typing provides precise cursor control.
and text-based input.
ii) Users interact with a keyboard by Users move a physical mouse on a flat
pressing physical keys, each of surface, and the movement is translated
which corresponds to a specific into corresponding on-screen cursor
character or function. movements. Mice have buttons for
clicking and scrolling wheels for
navigating content.
iii) Keyboards are commonly used for Mice are commonly used for navigating
word processing, data entry, graphical user interfaces, selecting files
programming, web browsing, and and icons, gaming, graphic design, and
executing keyboard shortcuts. web browsing.
iv) Keyboards offer a range of Right-clicking with a mouse opens
keyboard shortcuts for various context menus, providing quick access
functions, making them efficient to various options and actions related to
for tasks like copying, pasting, the selected item.
saving, and undoing actions.
.
Q6. Suman has discarded old, broken and malfunctioning Hard Disk without taking care
to delete data. Is it harmful in respect of security concern? Justify your answer.
Ans Yes, as it invites hackers/malware to see through your data. (Knowledge)
(1 mark to be awarded for yes/no and 2 mark for the correct justifications).

Q7. What is a data backup software? How can it help in data recovery?
Ans Data backup software is a software whose primary function is to copy and save the
data to an external source. This could be either a drive, server, data centre, or the
cloud.
The main role of backup and recovery is to preserve critical data in case of loss or
damage. In case of a disaster — natural or manmade including a ransomware attack
the backed up data can be retrieved and restored.

PAGE:19
Q8. Give three techniques to prevent accidental file deletion.
Ans Three popular techniques to prevent accidental file deletion are as follows:
a) We can configure the Permissions Settings to allow us to grant or deny file
access to other users.
b) we can simply hide the files from the file properties option.
c) We can password protect the file using third party software.
Q9. Why is operating system also called a resource manager?
Ans a) The OS manages these resources and allocates them to particular programs.
b) The CPU is one kind of resource and the OS decides how much processor
time should be given for the execution of a particular program.
c) OS also manages memory and I/O devices when multiple users are working
simultaneously.
Q10. What is an OSS? How is OSS different from FOSS.
Ans Open source software is software developed and maintained by open collaboration,
and made available, typically at no cost, for anyone to use, examine, alter and
redistribute however they like.
Open Source Software refers to software whose source code is available to customers
while FOSS is a software that is both free software as well as open-source software.
(2 marks for correct definition and 1 mark for difference)
10 Short Knowledge/Understanding/Application Based Questions (4 Marks)
Q1. Modern computers are based on Von Neumann Architecture. What does Von
Neumann Architecture comprise of?
Ans Von Neumann architecture comprises of:
i) Central Processing Unit
ii) Memory to store data and programs
iii) Input and output devices
iv) Communication channels to send/receive the output data
Q2. Draw the block diagram of a computer system. Briefly write about the functionality
of each component.
Ans

Block diagram of a computer system.

PAGE:20
Three components of computer are:
• Central Processing Unit (CPU),
• Input Devices,
• Output Devices
Central Processing Unit: It is the brain of the computer system. It broadly comprises
of Arithmetic Logic Unit(ALU) and Control Unit(CU). ALU is responsible for
performing the various Arithmetic operations and Logical operations on integers. CU
is responsible for controlling all the activities which are performed inside the
computer system.
Input Devices: They accept data from the user or outside the environment. It sends
data & instructions in binary form to the computer for further processing. Example:
keyboards, mouse, scanners etc.
Output Devices: They receive data or information from memory. This data is
converted into human readable format and shown to the user.Example: Monitor,
Printer etc.

Q3. List out four differences between RAM and Hard Disk.
Ans .
RAM Hard Disk
i) It is a type of Primary Memory It is a type of Secondary Memory
ii) RAM is volatile memory that Hard Disk is non-volatile memory that
temporarily stores the files you are permanently stores data or instructions
working on. for your computer.
iii) RAM has higher speed than Hard Hard Disk has lower speed than RAM
Disk
iv) Cost of per unit memory is more in Cost of per unit memory is less in
RAM Hard Disk
.
Q4. What was the basic electronic component of:
1st Generation of Computers
2nd Generation of Computers
3rd Generation of Computers
4th Generation of Computers

PAGE:21
Ans 1st Generation of Computers mostly comprised of vacuum tubes
2nd Generation of Computers mostly comprised of transistors
3rd Generation of Computers mostly comprised of integrated circuits
4th Generation of Computers mostly comprised of VLSI circuits
Q5. Define the following terms in relation to computers:
a) Booting b) BIOS c)POST d) CMOS
Ans a) Booting
The booting process in a PC (Personal Computer) is the sequence of events that
occurs when you turn on the computer to start the operating system (OS). It involves
the computer's hardware and firmware working together to load the OS into memory,
allowing the computer to become functional.
b) BIOS
BIOS (Basic Input/Output System) is firmware that serves as the computer's system
software. Its primary role is to initialize the hardware and provide the initial software
environment for the boot process. BIOS configures critical hardware settings, such as
the system clock, CPU parameters, and boot device order.
It locates the bootable device (e.g., a hard drive or SSD) based on the boot order
specified in BIOS settings.
c)POST
The BIOS built into the motherboard's ROM (Read-Only Memory) chip initiates a
Power-On Self-Test (POST). During POST, the BIOS checks the hardware
components (CPU, RAM, storage devices, graphics card, etc.) to ensure they are
functioning correctly. Any detected issues are reported via beep codes or error
messages.
d) CMOS
CMOS stands for Complementary Metal-Oxide-Semiconductor. CMOS technology
is a semiconductor technology used to manufacture integrated circuits, and it is
particularly known for its low power consumption. In the context of personal
computers, the term "CMOS" is commonly associated with the CMOS battery, which
powers the CMOS chip on the motherboard and maintains vital system settings and
the system's real-time clock when the computer is turned off.
Q6. Give two reasons for data deletion. How can data deletion from unauthorized persons
be prevented?

PAGE:22
Ans The reasons for data deletion are as follows:
a) The storage device can malfunction or crash down leading to data loss.
b) Users can accidentally erase data from storage devices.
(1 mark each for any other reason of deletion)
Data deletion from unauthorized persons can be prevented by:
a) Limiting access to the computer system by using passwords.
b) Keep files encrypted to prevent it from unwanted modification.
(1 mark each for any other correct answer)
Q7. Give two similarities and two differences between a compiler and interpreter.
Ans Two similarities between compiler and interpreter are:
a) Both compiler and Interpreter are language translators.
b) Both compiler and interpreter are used to find errors in the source code and
debug them.
Differences are as follows:
Compiler Interpreter
It takes the entire program in one go. An interpreter takes a single line of
code at a time.
The compiler generates an intermediate The interpreter does not produce an
machine code. intermediate machine code.
The compiler is used by programming The interpreter is used by programming
languages such as C,C++,Java etc. languages such as Python, Ruby etc.
Q8. Give four major functions of an operating system.
Ans a) Allocates and deallocates the memory and it keeps a record of which part of
primary memory is being used by which process.
b) When more than one process runs on the system the OS decides how and
when a process will use the CPU.
c) It keeps records of the status and locations of files and allocates and
deallocates resources.
d) An operating system regulates device connection using drivers. The processes
may require devices for their use.
Q9. Give four techniques to prevent loss of data due to security reasons.
Ans a) Backing up the Data-It is always good to have a backup strategy or several
backups of the company’s data.
b) Encrypt Sensitive Data-Encryption makes it exceedingly difficult for an
unauthorized individual to comprehend or use stolen data.
c) Use SoftwareAnti-virus and anti-malware software protects our system from
programs that can wipe out data or from threats that can block access to our
critical files.
d) Having a Password Policy: Creating and enforcing a password policy makes
it more challenging for a bad actor to crack employees’ passwords and get
into your system.
Q10. What is language translator? Mention the three main types of language translators.
Ans A language translator is a program that converts source code into object code.
Generally, there are three types of translator:
Compiler: A compiler takes the source code as a whole and translates it into object
code all in one go.
Interpretor: An interpreter translates source code into object code one instruction at a
time.
Assembler: an assembler converts assembly level language code into machine
language code.
PAGE:23
07 Case Based Questions (5 Marks)
Q1. Ramesh wants to purchase a new PC. He is trying to choose a PC within his budget
which will work fast. Which of the following components are compulsory and which
are optional and explain why?
a) Scanner
b) Keyboard
c) Printer
d) Monitor
e) Mouse
Ans a) A scanner is not essential for the working of a PC. In future if Ramesh has to scan
documents or pictures regularly, he may buy it.
b) A computer keyboard is an essential input device used to enter characters and
functions into the computer system by pressing buttons, or keys. It is the primary
device used to enter text. A keyboard typically contains keys for individual letters,
numbers and special characters, as well as keys for specific functions.
c) A printer is not essential for the working of a PC. However if Ramesh frequently
needs hard copies of various documents from PC, he may buy it in future.
d) A computer monitor is an essential and mainoutput device for a PC. The primary
use of a monitor is to display images, text, video, and graphics information
generated by the computer via a computer's video card.
e) A mouse is an essential input device used to point at objects you see on the screen.
By pointing at an object, you tell the computer that you want to do something with
that object. For example, say you wanted to start a program. There's a small
picture, called an icon, on the computer screen that represents that program.
Q2. Sweta has recently installed new software on her 1 year old laptop after which the
speed of the laptop has become quite slow. She is confused regarding which of the
following must be upgraded for better speed. Help her to understand the role of each
of the following components and which of them will ultimately improve the speed of
the laptop.
a) Hard Disk
b) ROM
c) RAM
d) Processor
e) Network

PAGE:24
Ans a) Since laptop was working properly and the hard disk is relatively new, there is no
need to upgrade the hard disk.
b) ROM contains the programming that allows a computer to start up or regenerate
each time it is turned on. So the ROM is also not the cause of the problem.
c) Generally, the faster the RAM, the faster the processing speed. Since the laptop
has become slow after installation of a new software, there is a possibility that the
new software needs more RAM for smooth working of the laptop. Hece RAM
must be upgraded.
d) A processor also affects the speed of a laptop. But since the laptop was functioning
properly till recently and the laptop and itsprocessor being new, there is no need to
upgrade the processor.
e) A network has nothing to do with the speed of the laptop. Its role is only to transfer
files from one laptop to other.
Q3. Classify on which the following areas computers have a positive or negative impact.
Justify your answer with suitable reason.
a) Accuracy
b) Speed
c) Health
d) Employment
e) Social Relations
Ans a) Accuracy of calculations have been greatly enhanced by computers. Computers are
machines which can repeatedly do calculations with consistent accuracy.
b) Speed of doing various tasks have improved due to high processor speeds of a
computer.
c) Health of human beings often adversely affected due to working for long hours on
a computer. Improper postures can cause back, neck and shoulder pains, headache,
eye strain and overuse injuries of the arms and hands.You can help avoid
computer-related injuries with proper furniture, better posture and good working
habits.
d) Computer has led to reduction of employment opportunities for unskilled workers
whereas it had given rise to ample opportunities for skilled manpower.
e) On one hand people are becoming lonelier due to less time for interpersonal
relationships. On the other hand people areSocializing more using social platforms.
Hence to an extent computers are helping people to socialize more.

PAGE:25
Q4. Anisha was in the middle of a typing a letter in Microsoft Word when suddenly
power went off.
a) Do you think she will get back the entire text she had typed in the letter.
b) If not what is the reason?
c) What would you suggest her to not face the problem again?
d) Can you suggest any device to prevent the above problem?
e) Which is better a writeable DVD or an external hard disk for long term storage?
Ans a) I don’t think she will be able get back the entire letter.
b) Because the latest portions of the letter which was being typed was on the RAM
which being volatile loses its data as soon as power is switched off.
c) She should continuously save the work after every few moments.
d) She must use a UPS to avoid this type of data loss.
e) An external HDD will last longer than a writable DVD.
Q5. Sunil is a student of fine arts and wants to draw a potrait which he has to send
someone by email.
a) Do you think he should draw it on canvas and scan the image or can he draw it on
a PC? Which one is better if he knows how to draw on a PC?
b) Can a touchscreen make his work easier?
c) If he cannot afford a touchscreen, suggest him a suitable input device for drawing
theportrait.
d) He manages to draw a portrait but is unable to determine what type of printer
should be used. Suggest him a suitable printer along with the reason.
e) Do you think a separate graphics card is essential for drawing in a PC.
Ans a) Considering above scenario it will be better to draw on a PC because we can
repeatedly modify the portrait in the PC until he is satisfied. On the other hand the
same will not be possible on the canvas.

b) Yes a touchscreen can serve as a digital tablet and make work easier for an artist.

c) He will need compatible a digital pen and stylus if he doesn’t have a touchscreen.

d) He should use a plotter as it gives him the flexibility to print in various sizes on
various media.

e) No graphics card is not essential for drawing. However a graphics card can offload
work and reduce memory-bus-contention from the CPU and system RAM, therefore
the overall performance for a computer could improve in addition to increased
performance in graphics processing.

PAGE:26
Q6. Mr Samrat is a data recovery expert at ABC Computer Pvt limited company. He has
been assigned the task to keep the data in every system safe and protected from
unauthorized personnel.
i) Which among the following methods should he use to keep the company’s
data safe from outsiders
a) Install a disk backup software
b) Set password to authenticate users at the time of login
c) Perform boot time scan of the system
d) All the above.

ii) Which of the following is a sign that the data in removable disk is
corrupted?
a) Files in removable disk are opening slowly.
b) System is taking more time to open.
c) Files in removable disk could not be read.
d) None of the above

iii) A user in his company has mistakenly deleted a file. How can he get back
the file?
a) By creating the file once again.
b) By restoring it from the recycle bin.
c) By searching for the file in drives of the system
d) None of the above.

iv) Mr Samrat notices that whenever a pen drive is connected in his system
all files and folders in it become hidden. What could be the possible
reason for it?
a) Operating system has become corrupted.
b) File explorer is not working properly.
c) Pen drive has become faulty.
d) There may be a malware in the pen drive or system.

v) Which software would you suggest to increase the performance of the


hard disk.
a) Disk Cleaner
b) Anti Virus
c) Disk Boost
d) Disk Defragmenter
Ans i) b) Set password to authenticate users at the time of login
ii) c) Files in removable disk could not be read.
iii) b) By restoring it from the recycle bin.
iv) d) There may be a malware in the pen drive or system.
v) d) Disk Defragmenter
Q7. Mrs Sunita wants to buy a laptop for her personal work. She is a teacher in Indira Public
School. She has searched in the internet and she found two laptops with the same
configuration. One with DOS version and another with pre loaded Windows.
1.Why is the price of the pre loaded Windows system more than the DOS version?
a) DOS version is not user friendly.
b) DOS version does not support installing other software.
c) In pre-loaded Windows system an OS is already installed and it’s cost is included.
d) None of the above.

PAGE:27
2. Which software she needs to install in the DOS version?
a) Utility software
b) Application software
c) Operating system
d) None of the above.

3. She wants to install software for spread sheet work. Suggest a suitable software for
her.
a) MS Excel
b) MS Word
c) MS Power Point
d) All the above

4. Which software among the following should she update to protect her system from
virus?
a) Windows Media Player
b) Windows Defender
c) MS Office
d) None of the above

5. She wants to use the internet for surfing content. Which among the following
would be the most suitable software for it.
a) Internet Explorer
b) Mozilla Firefox
c) Google Chrome
d) All the above

Ans 1. c) In pre-loaded Windows system an OS is already installed and it’s cost is


included.
2. c) Operating system
3. a) MS Excel
4. b) Windows Defender
5. d) All the above

PAGE:28
Name of the chapter : Introduction to Python
Topic Covered
• Basics of Python programming,Python interpreter-interactive and script mode, the
structure of a program,
• Indentation,identifiers,keywords,constants,variables,types of operators,precedence
of operators,data
• Types,mutable and immutable data types,statements,expressions,evaluation and
comments, input and output statements
• Data type conversion,debugging.
• Control Statements:if-else,if-elif-else, while loop,forloop
• Lists: list operations-creating,initializing,traversing and manipulating lists,list
methods and built-infunctions.– len(),list(),append(),insert(),
count(),index(),remove(), pop(), reverse(), sort(), min(),max(),sum()
• Dictionary: concept to fkey-value pair, creating,initializing,traversing, updating and
deleting elements,dictionary methods and built-infunctions.– dict(), len(), keys(),
values(), items(), update(), del(), clear()

Key Points

Python interpreter To execute a program in a high-level language by translating it one line at


a time interactive mode, A way of using the Python interpreter by typing commands and
expressions at the prompt.
script mode, A way of using the Python interpreter to read and execute statements in a script.
In Python, everything is an object. For example, numbers, strings, functions, classes,
and modules are all objects. Every Python object has three core characteristics that define it
at a foundational level. These characteristics are: Value ,identity

In Python, variables don’t have an associated type or size, as they’re labels attached to
objects in memory

Python objects are concrete pieces of information that live in specific memory positions on
your computer.

An object’s value is probably the only characteristic that you’d want to change in your code.
An object that allows you to change its values without changing its identity is a mutable

In contrast, an object that doesn’t allow changes in its value is an immutable object.

Control Statements- It allows programmers to control the execution flow of a program or


one of its sections.
if statement- if statement consists of a Boolean expression followed by one or more
statements. If the condition is True, the statements under if statements are executed.
if else-An if else statement consists of a Boolean expression followed by one or more
statements. If the condition is True, the statements under if statements are executed. If the
condition is false, statements under else part is executed
if elif- An if statement followed by one or more elif Statements, that consists of Boolean
expressions and then followed by an optional else statement, which executes when all the
condition becomes false.

PAGE:29
Nested if - An if statement inside another if or elif statement(s).
Loop- executes a statement or group of statements multiple times
while loop- It consists of a Boolean expression written along with while keyword followed
by one or more statements which will be executed as long as condition is True
for loop- Executes a sequence of statements multiple times and abbreviates the code that
manages the loop variable
break - It is used to terminate the loop.
continue -It is used to skip all the remaining statements in the loop and move controls back
to the top of the loop.
pass-This statement does nothing. It can be used when a statement is required syntactically
but the program requires no action.
Definition :
A list is a data structure in Python that is a mutable, or changeable, ordered sequence of
elements.
Example:- L1=[10,25,100,500], L2=[1, 2, 2.5, 10.0, 'a', 'b'], L3=[1,[2,3],4]
List Creation:
L1=[] or L2=list( ) # To create empty list
L3=[10,25,100,500] # To create and initialize list
L4=eval(input("Enter elements of the list")) #to create and initialize by user input
List Traversing and Manipulation:
Every element of the list has an unique sequential index(position) starting from 0
List elements can be accessed and manipulated by index.
if LST=[3,6,9,12,15] then
LST[1] ---->refers second element, i.e 6
LST[3]=20 ----> modifies the 4th element as 20.
To traverse and display all elements of the list:-
for item in LST:
print (item)
List Operators:
Concatenation (+)
Joins two lists. For example if L1=[1,2,3], L2=[4,5] then L1+L2 ---> [1,2,3,4,5]
Replication ( * )
Replicates the list given number of time.
For example , L1*3 ----->[1,2,3,1,2,3,1,2,3]
Membership ( IN / NOT IN)
Checks if an element is present or not.
For example : 2 in L1---> True 2 in L2--->False
Comparison ( ==, !=, >, <, >=, <= )
Compares two lists element by element
For example:
L1==L2---->False L1!=L2= True L1>L2-----> False
Slice ( : )
To access a range of items in a list, you need to slice a list. One way to do this is to use the
simple slicing operator ":".
Syntax:

PAGE:30
Note: If step is omitted, default step in 1.
Example:
L = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']
print(L[2:7])
# Prints ['c', 'd', 'e', 'f', 'g']

Note: Last index is always excluded.

Negative Index:
L = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']
print(L[-7:-2])
# Prints ['c', 'd', 'e', 'f', 'g']

Built in Functions
len()
returns the no of size/no of elements. len(L1)---->3 , len(L2)----->2
min()
returns minimum element min(L1) ----->1
max()
returns maximum element max(L2) ----->5
sum()
returns sum of elements sum(L2) ----->9 sum(L1)----->6
List Functions
append()
adds an element at the end of the list
L1.append(10) ------> [1,2,3,10]
insert()
insert an element at a given index
L2.insert(1,2.5) ------->[4,2.5,5]

PAGE:31
count()
returns the frequency of an element
Val=[2,4,6,4,7,3,4]
Val.count(4)------>3
index()
returns the index of an element
Val.index(6)------>2
remove()
delete the element with a given value
Val.remove(7) -----> [2,4,6,4,3,4]
pop()
delete the element with a given index . If no index is given, last element is deleted
Val.pop(2) -----> Val=[2,4,4,7,3,4]
reverse()
Val.reverse( )----->[4,3,7,4,4,2]
arranges the elements of the list in a reverse order
sort()
arranges the elements of a list in ascending order.
cars = ['Ford', 'BMW', 'Volvo']
cars.sort() ----> ['BMW', 'Ford', 'Volvo']
clear( )
deletes all elements of the list
Num=[1,4,7,9]
Num.clear() -----> Will give empty list
extend()
Merge the elements of a list in the current list
L1.extend(L2) ----->[1,2,3,4,5]
L2.extend(L1) ------>[4,5,1,2,3]
Dictionary
• Dictionary has some similarities with string, list and tuple but it is different in terms
of storing and accessing an element. String, list and tuple are sequences whereas a
dictionary is a mapping. Rather than having an index associated with each element,
Dictionaries in Python have a key associated with each element. Python Dictionaries
are a collection of key value pairs.
• In other ways, you can think keys as user defined indices.
• In English Dictionary, we search any word for meaning associated with the word.
Here Word is the Key and meaning is the value.

Dictionary Creation:
• Syntax:
<dictionay_name>={<key1>:<value1>, <key2>:<value2>, ……..
<keyn>:<value n>}
• Example:
Price={ ‘Redmi Note8’: 10500, ‘Galaxy A70s’: 25900,
‘OppoA31’:12490}
Here ‘Redmi Note8’, ‘Galaxy A70s’ and ‘Oppo A31’ are Keys and 10500, 25900,
12490 are values.

• Dict1={} #Empty Dictionary


• TeacherCount={‘PGT’:10, ‘TGT’:7, ‘PRT’:5}

PAGE:32
• Note: Keys of a Dictionary must be of immutable types, such as:
* A Python string
* A number.
* A tuple (containing only immutable types)
If we try to give a mutable type as key, Python will give an error.

Accessing elements of a Dictionary:


• We need a key to access any element of a Dictionary likewise in lists, strings and
tuples we used index to access any element.
• Example:
>>> TeacherCount={'PGT':10, 'TGT':7, 'PRT':5}
>>> TeacherCount{'PGT': 10, 'TGT': 7, 'PRT': 5}
>>> TeacherCount['PGT']
10
• Note: Attempting to access a key that doesn’t exist causes an error

Traversing a Dictionary:
• Traversal of a collection means accessing and processing each element of it.
• for loop is efficient to traverse any collection and sequence. for loop will get every
key of Dictionary and we can access every element of the Dictionary based on the
keys.
• Example:
>>> TeacherCount={'PGT':10, 'TGT':7, 'PRT':5}
>>> TeacherCount
{'PGT': 10, 'TGT': 7, 'PRT': 5}
>>> for i in TeacherCount:
print('Key is ',i, 'Value is ',TeacherCount[i])
Key is PGT Value is 10
Key is TGT Value is 7
Key is PRT Value is 5

Accessing Key and Values Simultaneously:


• Accessing all keys in a Dictionary in one go:
<dictionary>.keys()
Example:
>>> TeacherCount={'PGT':10, 'TGT':7, 'PRT':5}
>>> TeacherCount
{'PGT': 10, 'TGT': 7, 'PRT': 5}
>>> TeacherCount.keys()
dict_keys(['PGT', 'TGT', 'PRT'])
• Accessing all values in a Dictionary in one go:
<dictionary>.values()
Example:
>>> TeacherCount.values()
dict_values([10, 7, 5])

Characteristics of a Dictionary:
• Unordered Set:
A dictionary is a unordered set of key:value pair.

PAGE:33
• Not a Sequence:
Unlike a string, list and tuple, a dictionary is not a sequence because it is unordered
set of elements. The sequences are indexed by a range of ordinal numbers. Hence,
they are ordered, but a dictionary is an unordered collection.
• Indexed by keys, Not numbers:
Dictionaries are indexed by keys. Keys are immutable type. But the values of a
dictionary can be of any type.
• Keys must be unique:
Each keys of a Dictionary must be unique. However two unique keys can have same
values.
• Mutable:
Like lists, dictionaries are mutable. We can change the value of a key in place.
• Internally stored as Mappings:
Internally, the key:value pairs of a dictionary are associated with one another with
some internal function (called hash-function). This way of linking is called mapping.

Multiple ways of Creating Dictionaries:


1. Initializing a Dictionary:
In this method all the key:value pairs of a dictionary are written collectively,
separated by commas and enclosed in curly braces.
Example:
T20Cricketer={'Name':'Virat', 'Runs':2794, 'Age':31}
2. Adding key:value pairs to an empty Dictionary:
In this method, first we need to create an empty dictionary and then keys and values
are added to it one pair at a time.
Two ways of creating empty dictionary:
■ T20Cricketer={}
and
■ T20Cricketer=dict()
Next step is to add key:value pairs, one at a time as per syntax given below:
<dictionary>[<key>]=<value>
Example:
>>> T20Cricketer['Name']='Virat'
>>> T20Cricketer['Runs']=2794
>>> T20Cricketer['Age']=31
>>> T20Cricketer
{'Name': 'Virat', 'Runs': 2794, 'Age': 31}
3. Creating a Dictionary using dict():
(i) Specify Key:Value pairs as keyword arguments to dict() function:
Example:
>>> T20Cricketer=dict(Name='Virat', Runs=2794, Age=31)
>>> T20Cricketer
{'Name': 'Virat', 'Runs': 2794, 'Age': 31}
PAGE:34
(ii) Specify comma-separated Key:Value pairs:
Example:
>>> T20Cricketer=dict({'Name':'Virat', 'Runs':2794, 'Age':31})
>>> T20Cricketer
{'Name': 'Virat', 'Runs': 2794, 'Age': 31}
(iii) Specify Key:Value pairs separately in form of sequences:
In this method, one list or tuple of individual key value pair is passed
as argument to dict().
Example1:
>>>T20Cricketer=dict([['Name','Virat'],['Runs',2794],
['Age',31]])
>>> T20Cricketer
{'Name': 'Virat', 'Runs': 2794, 'Age': 31}
Example 2:
>>>T20Cricketer=dict((('Name','Virat'),('Runs',2794),
('Age',31)))
>>> T20Cricketer
{'Name': 'Virat', 'Runs': 2794, 'Age': 31}
Example3:
>>>T20Cricketer=dict((['Name','Virat'],['Runs',2794],
['Age',31]))
>>> T20Cricketer
{'Name': 'Virat', 'Runs': 2794, 'Age': 31}
Example 4:
>>>T20Cricketer=dict([('Name','Virat'),('Runs',2794),
('Age',31)])
>>> T20Cricketer
{'Name': 'Virat', 'Runs': 2794, 'Age': 31}
• Adding Elements to Dictionary:
<dictionary>[<key>]=<value>
Example:
>>> T20Cricketer={'Name':'Virat','Runs':2794,
'Age':31}
>>> T20Cricketer['Country']='India'
>>> T20Cricketer
{'Name': 'Virat', 'Runs': 2794, 'Age': 31, 'Country':'India'}
N.B: Key to be added must not exist in dictionary and must be unique. If the Key
already exists, then it will change the value of existing key and no new entry will
be added to dictionary.

• Updating Existing Elements in a Dictionary:


<dictionary>[<key>]=<value>
Example:
>>> T20Cricketer={'Name':'Virat','Runs':2794,
‘Age':31}
>>> T20Cricketer
{'Name': 'Virat', 'Runs': 2794, 'Age': 31}
>>> T20Cricketer['Name']='Rohit'
>>> T20Cricketer
{'Name': 'Rohit', 'Runs': 2794, 'Age': 31}

PAGE:35
N.B: Key must exist in the dictionary otherwise new entry will be added to
dictionary.

• Deleting Elements from a Dictionary using del:


del <dictionary>[<key>]
Example:
>>> T20Cricketer={'Name':'Virat','Runs':2794,
‘Age':31}
>>> T20Cricketer
{'Name': 'Virat', 'Runs': 2794, 'Age': 31}
>>> del T20Cricketer['Age']
>>> T20Cricketer
{'Name': 'Virat', 'Runs': 2794}
N.B: Key must exist in the dictionary otherwise Python gives KeyError.

• Checking for Existence of a Key:


Membership operators in and not in are used to check for the existence of Keys only.
<key> in <dictionary>
<key> not in <dictionary>
Example:
>>> T20Cricketer={'Name':'Virat','Runs':2794,
'Age':31}
>>> 'Runs' in T20Cricketer
True
>>> 'Age' not in T20Cricketer
False
>>> 'Virat' in T20Cricketer
False
# Here ‘Virat’ is not a key

• Checking for Existence of a Value:


<value> in <dictionary>.values()
<value> not in <dictionary>.values()
Example:
>>> T20Cricketer={'Name':'Virat','Runs':2794,
'Age':31}
>>> 'Virat' in T20Cricketer.values()
True
• Functions and Dictionary Methods:
1. len(Dictionary):
Returns total number of elements present in the dictionary.
Example:
T20Cricketer={'Name':'Virat','Runs':2794,'Age':31}
>>> len(T20Cricketer)
3
2. Dictionary.keys():
Returns a list of keys of the dictionary.
Example:
>>> T20Cricketer.keys()
dict_keys(['Name', 'Runs', 'Age'])

PAGE:36
3. Dictionary.values():
Returns a list of values of the dictionary.
Example:
>>> T20Cricketer.values()
dict_values(['Virat', 2794, 31])

4. Dictionary.items() :
Returns all of the items of the dictionary as a sequence of (key,value) tuples
Example:
>>> T20Cricketer.items()
dict_items([('Name', 'Virat'), ('Runs', 2794), ('Age', 31)])

5. Dictionary.update(other dictionary) :
Merges key:value pairs from the other dictionary to the original Dictionary. It updates
the value of the keys if the keys exist in the original dictionary otherwise adds the
key:value pair to the original Dictionary.
Example:
>>> T20Cricketer
{'Name': 'Virat', 'Runs': 2794, 'Age': 31}
>>> T20Cricketer2
{'Name': 'Rohit', 'Age': 33, 'Country': 'India'}
>>> T20Cricketer.update(T20Cricketer2)
>>> T20Cricketer
{'Name': 'Rohit', 'Runs': 2794, 'Age': 33, 'Country': 'India'}
>>> T20Cricketer2
{'Name': 'Rohit', 'Age': 33, 'Country': 'India'}

6. del <Dictionary>[<key>]
Deletes key:value pair or element of the Dictionary.
Example:
>>> T20Cricketer
{'Name': 'Rohit', 'Runs': 2794, 'Age': 33, 'Country': 'India'}
>>> del T20Cricketer['Country']
>>> T20Cricketer
{'Name': 'Rohit', 'Runs': 2794, 'Age': 33}
7. del Dictionary
Deletes entire Dictionary
Example:
>>> del T20Cricketer2
>>> T20Cricketer2
NameError: name 'T20Cricketer2' is not defined
8. Dictionary.clear()
Removes all items of the Dictionary leaving the Dictionary empty.
Example:
>>> T20Cricketer2
{'Name': 'Rohit', 'Runs': 2773, 'Age': 33}
>>> T20Cricketer2.clear()
>>> T20Cricketer2
{}

PAGE:37
Nested Dictionary:
A Dictionary is called nested if there is at least one Dictionary as a value of key.
Example
>>> CSTeacher={'Name':{'Fname':'Rajat','Lname':'Bhatia'},'Desig':'PGT'}
>>> CSTeacher
{'Name': {'Fname': 'Rajat', 'Lname': 'Bhatia'}, 'Desig': 'PGT'}
>>> CSTeacher['Name']
{'Fname': 'Rajat', 'Lname': 'Bhatia'}
>>> CSTeacher['Name']['Fname']
'Rajat'

55 Objective Question (1 Mark )


Q1. What are the two modes of Python interpreter?
Ans Interactive mode and script mode
Q2. Identify the invalid identifier:
(a) sum1 (b) _sum (c) sum@ (d) SUM
Ans (c)
Q3. In ________ mode of Python, we can save the program.
Ans Script
Q4. Which is of the following is not a constant?
(a) True (b) “Hello” (c) 3.14 (d) sum
Ans (d)
Q5. Identify the immutable data type:
(a) dictionary (b) int (c) list (d) set
Ans (b)
Q6. Which one of the following is the correct extension of the Python file?
a) .py b) .python c) .p d) None of these
Ans (a)
Q7. Which is the correct operator for power(xy)?
a) X^y b) X**y c) X^^y d) None of the mentioned
Ans (b)
Q8. Python supports dynamic typing. – True / False
Ans True
Q9. a=5>2
What will be the data type of the variable a?
(a) True (b) int (c) bool (d) None of these
Ans (c) bool

PAGE:38
Q10. Which of the following is not a token :
(a) // (b) “a” (c) 3.14 (d) ##
Ans (d)
Q11 What will be the output of the following code snippet:
n=3
n=4
n=n+n
print(n)
(a) 7 (b) 6 (c) 1 (d) 8
Ans (d)
Q12 What will be the value of the following Python expression : 4 + 3 % 5
(a) 2 (b) 4 (c) 7 (d) Error
Ans (c)
Q13 Which function displays the memory location of an object/variable ?
Ans id( )
Q14 _____ spaces should be left for indentation.
(a) 2 (b) 3 (c) 4 (d) 1
Ans (c) 4
Q15 Python is case-sensitive – True / False.
Ans True
Q16. What keyword would you use to add an alternative condition to an if statement?
a) else if
b) elseif
c) elif
d) None of the above
Ans c) elif
Q17. How is a code block indicated in Python?
a) Brackets
b) Indentation
c) Key
d) None of the above
Ans b) Indentation
Q18. The order of execution of the statements in a program is known as:
a) flow of control
b) central flow
c)selection
d) iteration
Ans a) flow of control

PAGE:39
Q19. Number of elif in a program is dependent on the ___________
a) number of conditions to be checked
b) number of variables in a program
c) number of loops in a program
d) None of the above
Ans a) number of conditions to be checked
Q20. An ‘if’ condition inside another ‘if’ is called ___
a) Second if
b) nested if
c) another if
d) None of the above
Ans b) nested if
Q21. ____ is an empty statement in Python.
a) Jump
b) Fail
c) Empty
d) Pass
Ans d) Pass
Q22. Which of the following symbol is used to end an ‘if’ statement in Python?
a) Comma( , )
b) Colon( : )
c) Semi Colon( ; )
d) None of the above
Ans b) Colon( : )
Q23. Repetition of a set of statements in a program is made possible using _____________
a) Selection Constructs
b) Sequential Constructs
c) Looping Constructs
d) None of the above
Ans c) Looping Constructs
Q24. The statements in a loop are executed repeatedly as long as particular
condition _____________.
a) remains False
b) remains True
c) gives error
d) None of the above
Ans b) remains True
Q25. When the condition in loops becomes false, the loop _________
a) terminates
b) begin
c) restart
d) none of the above
Ans a) terminates
Q26 Consider the loop given below:
for i in range(7,4,-2) :
break
What will be the final value of i after this loop?
a) 4
b) 5
c) 7
d) -2
Ans b) 7

PAGE:40
Q27 Consider the loop given below:
for i in range(10,5,-3) :
print(i)
How many times will this loop run?
a) 3
b) 2
c) 1
d) Infinite
Ans b) 2
Q28 Consider the loop given below:
for i in range(3) :
pass
What will be the final value of i after this loop?
a) 0
b) 1
c) 2
d) 3
Ans c) 2
Q29 Consider the loop given below:
for i in range(2,4) :
print(i)
What value(s) are printed when it executes?
a) 3
b) 3 and 4
c) 2 and 3
d) 2,3 and 4
Ans c) 2 and 3
Q30 Function range(3) is equivalent to:
a) range(1,3)
b) range(0,3)
c) range(3,0,-1)
d) range(1,3,0)
Ans b) range(0,3)
Q31. Suppose L=[10,20,30,40,50,60] , then what is the value of L[::2]?
Ans [10, 30, 50]
Q32. If L1=[‘a’,’b’,’c’] then find 2*L1
Ans ['a', 'b', 'c', 'a', 'b', 'c']
Q33. Consider a list LST=[2,3,[1,5]] . Find the output of the statement: 1 in LST
Ans False.
Q34. If L=list(‘123’) then find the output of the statement : print(L)
Ans [‘1’,’2’,’3’]
Q35. If List1=[[‘a’,’b’,’c’],[10,20,30]] then find the value of len(List1)
Ans 2
Q36. Consider a list LST=[10,20,30,40]. Write a statement to insert element 50 at the last
position.
Ans LST.append(50)
Q37. Consider a list LST123=[1,2,3,4]. Write a statement to insert element 2.5 at index no
3.
Ans LST123.insert(3, 2.5)

PAGE:41
Q38. If LST = 'SUMMER' then find LST[::-1]
Ans REMMUS
Q39. Write a ststement to create an empty list.
Ans L=[] or L=list( )
Q40. Which of the following function is a standard library function and not a list function?
a. pop( ) b. max( ) c. extend( ) d. sort( )
Ans b. max( )
Q41 Which function is used to merge two lists into a single list?
Ans extend( )
Q42 Which operator will be used to make a copy of a list to another list?
a. = b. == c.+ d.*
Ans a.=
Q43 Write the result of the statement : print(list(range(5))
Ans [0,1,2,3,4]
Q44 Suppose a list L=[1,2,3,4,5]. Write a statement to remove all the elements a make an
empty list, i.e, L=[]
Ans L.clear()
Q45 Find the output: -
L=[0,[9,’a’],77.9,’KVS’,[‘Rahul’,’Viki’,’Vijay]]
print(L[:3]+L[1::-1])

Ans [0, [9, 'a'], 77.9, [9, 'a'], 0]


Q46. Which of the following is correct way of creating a dictionary?
a) Medals={‘Gold’=12,’Silver’=21,’Bronze’=32}
b) Medals={‘Gold’:12,’Silver’:21,’Bronze’:32}
c) Medals=[‘Gold’:12,’Silver’:21,’Bronze’:32]
d) Medals=(‘Gold’:12,’Silver’:21,’Bronze’:32)

Ans b) Medals={‘Gold’:12,’Silver’:21,’Bronze’:32}
Q47. Dictionary is a _______________
a) Set b) Sequence c) Mapping d) None of the options
Ans c) Mapping
Q48. Which one of the following statement is not True?
a) Dictionary is value mutable.
b) Dictionary is key immutable.
c) Dictionary is a mapping.
d) Dictionary is an ordered set of items.
Ans d) Dictionary is an ordered set of items.
Q49. Find out the odd one from the following:
a) Integer b) String c) Float d) Dictionary
Ans d) Dictionary
Q50. Which of the following statement is wrong?
a) D={1:2,3:4,4:5}
b) D={[1,2]:’Tarun’,[3,5]:’Komal’,[4,6,7]:’Sampreet’}
c) D=dict({1:’Madhu’,2:’Karan’,3:’Mohan’})
d) D={’Tarun’: [1,2],’Komal’: [3,5],’Sampreet’: [4,6,7]:}

Ans D={[1,2]:’Tarun’,[3,5]:’Komal’,[4,6,7]:’Sampreet’}

PAGE:42
Q51. T20Cricketer={'Name':'Virat', 'Runs':2794, 'Age':31}
Barun is trying to delete all the key value pairs of the dictionary using various
methods. Which of the following statement will not full fill his wish?
a) T20Cricketer.clear()
b) del T20Cricketer[‘Name’], T20Cricketer[‘Runs’], T20Cricketer[‘Age’]
c) T20Cricketer=dict()
d) del T20Cricketer
Ans del T20Cricketer
Q52. Predict the output of the following code:
T20Cricketer={'Name':'Virat', 'Runs':2794, 'Age':31}
print('Virat' in T20Cricketer)
a) False b) True c) Error d) ‘Virat’
Ans a) False
Q53. Predict the output of the following code:
Marks={‘Amar’:87,’Neel’:45,’Rupsa’:92}
print(len(Marks))
a) 6 b) 3 c) 5 d) Error
Ans b) 3
Q54. Predict the output of the following code:
Marks={‘Amar’:87,’Neel’:45,’Rupsa’:92}
for i in Marks:
print(i, end=’ ‘)
a) ‘Amar’ ‘Neel’ ‘Rupsa’
b) 87 45 92
c) 87
45
92
d) ‘Amar’
‘Neel’
‘Rupsa’
Ans a) ‘Amar’ ‘Neel’ ‘Rupsa’
Q55. Predict the output of the following code:
T20Cricketer={'Name':'Virat', 'Runs':2794, 'Age':31}
T20Cricketer2={'Name': 'Rohit', 'Age': 33, 'Country': 'India'}
T20Cricketer.update(T20Cricketer2)
print(T20Cricketer)
print(T20Cricketer2)
a) {'Name': 'Rohit', 'Runs': 2794, 'Age': 33}
{'Name': 'Rohit', 'Age': 33, 'Country': 'India'}
b) {'Name': 'Virat', 'Runs': 2794, 'Age': 31, 'Country': 'India'}
{'Name': 'Rohit', 'Age': 33, 'Country': 'India'}
c) {'Name': 'Rohit', 'Runs': 2794, 'Age': 33, 'Country': 'India'}
{'Name': 'Rohit', 'Age': 33, 'Country': 'India'}
d) {'Name': 'Rohit', 'Age': 33, 'Country': 'India'}
{'Name': 'Rohit', 'Runs': 2794, 'Age': 33, 'Country': 'India'}
Ans c) {'Name': 'Rohit', 'Runs': 2794, 'Age': 33, 'Country': 'India'}
{'Name': 'Rohit', 'Age': 33, 'Country': 'India'}

PAGE:43
20 Assertion and reason Based question ( 1 Mark )

Mark the correct choice as


(a) Both A and R are true and R is the correct explanation for A
(b) Both A and R are true and R is not the correct explanation for A
(c) A is True but R is False
(d) A is false but R is True
Q1. Assertion (A): We cannot change the value of an integer variable.
Reasoning (R): Integer is immutable.
Ans (a)
Q2. Assertion (A): Comments provide extra information in a program.
Reasoning (R): Comments are not executed.
Ans (b)
Q3. Assertion (A): Strings can be multi-line or single line.
Reasoning (R): Strings are mutable.
Ans (c)
Q4. Assertion (A): Interactive mode can be used for testing small lines of code.
Reasoning (R): It executes the lines of code in an interactive manner.
Ans (a)
Q5. Assertion (A): Bug is any error in a program.
Reasoning (R): Debugging is the process of removal of error in a program.
Ans (b)
Q6. Assertion.(A) Python’s pass statement is an empty statement
Reason(R). An empty statement does nothing

Ans (a)
Q7. Assertion. (A) The flow of control in a program can occur sequentially, selectively
or iteratively.
Reason. (R). The sequence construct means that the statement will get executed
sequentially.

Ans (b)
Q8. Assertion. (A) Python statement ‘if’ represents selection construct.
Reason. (R). The selection construct means the execution of a set of statements,
depending upon the outcome of a condition.
Ans (a)
Q9. Assertion. (A) The for loop is a counting loop that works with sequences of values.
Reason. (R). The range( ) function generates a sequence of list type.
Ans (b)
Q10. Assertion. (A) Both break and continue are jump statement
Reason. (R). Both break and continue can stop the loops and hence can substitute
one another.
Ans (c)

PAGE:44
Q11. Assertion (A): List can be changed after creation.
Reason (R): List are mutable.
Ans Option a.
Q12. Assertion (A): remove( ) method removes all elements from a list
Reason (R): len ( ) function is used to find the length of list
Ans d. A is false but R is true.
Q13. Assertion (A): Elements of a list are separated by comma.
Reason (R): List is enclosed by a pair of straight brackets.
Ans b. Both A and R are true but R is the not correct explanation of A.
Q14. Assertion (A): clear( ) method removes all elements from a list
Reason (R): sort ( ) function is used sort a list in descending order
Ans c. A is true but R is false.
Q15. Assertion (A): append( ) method is used to add an element at the end of a list
Reason (R): extend ( ) function is used to merge two lists into a single list
Ans b. Both A and R are true but R is the not correct explanation of A.
Q16. Assertion (A): Dictionaries are mutable data type.
Reasoning (R): We can change the values of the dictionaries.

Ans (a) Both (A) and (R) are true and (R) is the correct explanation for (A).
Q17. Assertion (A): Dictionaries are mutable data type.
Reasoning (R): We cannot change the keys of the dictionaries.

Ans (b) Both (A) and (R) are true and (R) is not the correct explanation for (A).
Q18. Assertion (A):Items in dictionaries are unordered.
Reasoning (R):Internally, the key: value pairs of a dictionary are associated with one
another with some internal function (called hash-function). This way of linking is
called mapping.
Ans (a) Both (A) and (R) are true and (R) is the correct explanation for (A).
Q19. Assertion (A): We can update values of a dictionary by the help of keys.
Reasoning (R):It is not necessary that the key has to present in the dictionary.

Ans (c) (A) is true but (R) is false.


Q20. Assertion (A): We can add new key, value pairsto a dictionary.
Reasoning (R): Key to be added must not exist in dictionary and must be unique. If
the Key already exist, then it will change the value of existing key and no new entry
will be added to dictionary.

Ans. (a) Both (A) and (R) are true and (R) is the correct explanation for (A).

20 Short Knowledge/Understanding/Application Based Questions (2 Marks)

Q1. Write any four rules for naming an identifier.


Ans (a) It should not be a reserved word
(b) It can start with an alphabet or underscore.
(c) It cannot contain any special character
(d) It can contain digits but not in the starting position.

PAGE:45
Q2. State any two differences between ‘=’ and ‘= =’.

Ans
= ==

Assignment operator Relational operator

No return value. Returns True / False.

Q3. State any two types of operators with example.

Ans Logical operator – and, or, not


Arithmetic operator - +, -, /, *
Q4. What is the difference between ‘/’ and ‘//’.
Ans

/ //

Division operator Floor division operator

E.g. 5 / 2 = 2.5 E.g. 5 // 2 = 2


Q5. Give two ways of writing multi-line strings.
Ans

Method 1 Method 2

s= “Hello \ s= ‘ ‘ ‘ Hello
Everyone” Everyone ‘ ‘ ‘
Q6. What is range() function? Give an example.

Ans The range() function returns a sequence of numbers, starting from 0 by default, and
increments by 1 (by default), and stops before a specified number.
Syntax: range(start, stop, step)
Example:
x = range(3, 7)
for n in x:
print(n)
Output:
3
4
5
6

PAGE:46
Q7. What is the difference between break and continue
Ans
Basis for
break continue
comparison

It is used for the termination of


It is used for the termination of all the
Use the only current iteration of the
remaining iterations of the loop.
loop.

The control will pass to the


Control after using
The line which is just after the loop will next iteration of that current
break/continue
gain control of the program. loop by skipping the current
statement
iteration.

It performs early execution of


Causes It performs the termination of the loop. the next loop by skipping the
current one.

Q8. Write the output of the following code:


x=5
while(x<15):
print(x**2)
x+=3
Ans 25
64
121
196
Q9. Write the output of the following code:
val = 10
total = 0

for count in range(1,val,3):


total = total + count
if count % 2 == 0:
print(count*10)
else:
print(count)
print (total)
Ans 1
40
7
12
Q10. Find errors in the following code and write the correct code after underlining it.
x = int(input(“Enter value”)
for k in range[0,20]
if x=k
print(x+k)
else:
Print(x-k)
Ans x = int(input("Enter value"))
for k in range(0,20):
if x==k:
print(x+k)
else:
print(x-k)

PAGE:47
Q11. Predict the output:-
L1, L2=[1,2,3],[1,2,3]
L3=[1,[2],3]
print(L1==L2)
print(L2==L3)
Ans True
False
Q12. What is the difference between pop(index) and pop( ) function?
Ans pop(index) function deletes the element from i th index of the list.
pop( ) function deletes the last element from the list.
Q13. What is the difference between remove( ) and pop( ) function?
Ans The argument of pop( ) function is an index. It deletes the element from the given
index of the list.
The argument of delete( ) function is an element. It deletes the first occurrence
element from the list.
Q14. Predict the output of the following code fragment:-
values =[ ]
for i in range (1,4):
values.append(i)
print(values)
Ans [1,2,3]
Q15. Predict the output of the following code:-
a=[4,3,2,5,6]
print(a[:-3:-1])
print(a[-3:4])
Ans [6, 5]
[2, 5]
Q16. Write a python statement to create a dictionary ‘Marks5Subs’ having following
items: (Please don’t consider the column headers)
Name Marks of 5 Subjects
Sawan 67,74,56,48,87
Ankit 34,46,39,21,41
Puja 91,87,73,82,95
Arnab 78,98,97,95,99

Ans Marks5Subs={'Sawan':[67,74,56,48,87],'Ankit':[34,46,39,21,41],
'Puja':[91,87,73,82,95],'Arnab':[78,98,97,95,99]}
Q17. Write a python statement to create a dictionary ‘Currency’ having following items:
(Please don’t consider the column headers)
Country Currency
India Indian Rupee
Russia Ruble
USA Dollar
Japan Yen
Ans Currency={'India':'Indian Rupee','Russia':'Ruble',
'USA':'Dollar','Japan':'Yen'}

PAGE:48
Q18. Write a python statement to create a dictionary ‘NationalBird’ having following
items: (Please don’t consider the column headers)
Country National Bird
India Peacock
Australia Emu
Bahamas Flamingo
Italy Sparrow
New Zealand Kiwi
Ans NationalBird={'India':'Peacock','Australia':'Emu','Bahamas':'Flamingo',
'Italy':'Sparrow','New Zealand':'Kiwi'}
Q19. Ranit has written a python code to create a dictionary and display the values of the
dictionary using a loop but it is showing errors. Help him to find out errors and
underline the corrections.
Stds={'IX';153,'X';143,'XI';147,'XII';89}
for i in Std:
Print(i)
Ans Stds={'IX':153,'X':143,'XI':147,'XII':89}
for i in Stds:
print(Stds[i])
Q20. Sharmili has written a python code to create a dictionary Stds that stores student’s
strength of classes IX, X, XI and XII and it will calculate the total student’s strength
it is showing errors, Help her to find out errors and underline the corrections.
Stds={'IX':153,'X':143,'XI':147,'XII':89
Sum=1
for i in Stds.value():
Sum=+i
print(Sum)
Ans. Stds={'IX':153,'X':143,'XI':147,'XII':89}
Sum=0
for i in Stds.values():
Sum+=i
print(Sum)
20 Short Knowledge/Understanding/Application Based Questions (3 Marks)
Q1. What is data type conversion? State its two types with example.
Ans Conversion of one data type to another is known as data type conversion.
Two types - implicit and explicit(type casting).
Implicit - 5 / 2 = 2.5
Explicit - int(3.25) → 3
Q2. Define Dynamic Typing. Give an example.
Ans The value allotted to a variable can be changed dynamically in a program.
E.g.:
a=10
print(a)
a=”Hello” # changing the value of the variable

PAGE:49
Q3. Using example, explain the difference between mutable and immutable datatype.
Ans If the value of variable of a data type can be changed without affecting its address
then it is known as mutable data type, else it is known as immutable data type.
Q4. What is the use of comments in a program ? What are its two types ?
Ans Comments provide extra information for increasing the readability of a program.
Two types - single line comment and multi-line comment.
Q5. What do you mean by the precedence of operators ?
Ans Operator precedence affects how an expression is evaluated.
For example, x = 7 + 3 * 2; here, x is assigned 13, not 20 because operator * has
higher precedence than +, so it first multiplies 3*2 and then adds into 7.

Q6. Write a program to find the sum of the given series.


1 + x^2/2 + x^3/3 + … x^n/n
Ans n=int(input("Enter the number of terms:"))
x=int(input("Enter the value of x:"))
sum1=1
for i in range(2,n+1):
sum1=sum1+((x**i)/i)
print("The sum of series is",round(sum1,2))
Q7. Write a program to reverse a number using while loop.
Ans num = int (input (“Enter a number: “))
reversed_num = 0
while num != 0:
digit = num % 10
reversed_num = reversed_num * 10 + digit
num = num/10
print("Reversed Number: " + str(reversed_num))
Q8. Write a program to calculate the factorial of a number.
Ans n = int (input (“Enter a number: “))
factorial = 1
if n >= 1:
for i in range (1, n+1):
factorial = factorial *i
print (“Factorial of the given number is: “, factorial)
Q9. Write a program to check whether the number entered by the user is Perfect number.
Ans n = int(input("Enter any number: "))
sum1 = 0
for i in range(1, n):
if(n % i == 0):
sum1 = sum1 + i
if (sum1 == n):
print("The number is a Perfect number!")
else:
print("The number is not a Perfect number!")

PAGE:50
Q10. Write a program to print the given pattern.
*
**
***
****
*****
Ans for i in range(1, 6):
for j in range(1, i+1):
print(‘*’, end = " ")
print()
Q11. Write a program to find the average from a given list of integers.
Ans L=[5,8,3,4,6]
sum=0
for i in L:
sum+=i
avg=sum/len(L)
print(avg)
Q12. Predict the output of the following code:-
M=[]
M1=[]
M2=[]
for i in range(1,10):
M.append(i)
for i in range(10,1,–2):
M1.append(i)
for i in range(len(M1)):
M2.append(M1[i]+M[i])
M2.append(len(M)-len(M1))
print(M2)
Ans [11, 10, 9, 8, 7, 4]
Q13. What is the difference between sort( ) and sorted( ) function?
Ans sort( ) function will modify the list from which the function has been called while
sorted( ) function will create a new list which is given as argument.
sort( ) function works upon list onlt while sorted( ) function will work upon any
iterative sequence.
Q14. Predict output of the following code:-
for Name in ['Jayes', 'Ramya', 'Taruna', 'Suraj'] :
print(Name)
if Name[0]=='T':
break
else :
print('Finished!')
print('Got it!')
Ans Jayes
Finished!
Got it!
Ramya
Finished!
Got it!
Taruna

PAGE:51
Q15. Write a program that takes first 5 and last 5 elements of a list and stores them into another list.
Ans L=[1,1,2,3,5,4,7,9,5,4,9,6]
if len(L)<10:
print("Insufficient elements")
else:
LST=L[:5]+L[-5:]
print(L)
print(LST)
Q16. Consider the following Dictionary.
Capital={'India':'New Delhi', 'Iran':'Teheran', 'Nepal':'Kathmandu', 'Russia':'Moscow'}
Write statements to do the following:
a) To insert a new item for the country Japan.
b) To display name of the countries from the dictionary Capital.
c) To display name of the capitals from the dictionary Capital.
Ans a) Capital['Japan']='Tokyo'
b) print(Capital.keys())
c) print(Capital.values())
Q17. Consider the following Dictionary.
Goals2023={‘Messi’:26,’Ronaldo’:35,‘Haaland’:25,’Neymar’:20}
Write statements to do the following:
a) To modify the Goals of Neymar as 18.
b) To delete the record of Haaland.
c) To display the goals of Ronaldo.
Ans a) Goals2023['Neymar']=18
b) del Goals2023['Haaland']
c) print(Goals2023[‘Ronaldo’])
Q18. Write a python program to store details of five teachers having Employee ID, Name and
Designation to a dictionary and display only the details of those teachers whose name starts
with ‘R’ and designation is ‘PGT’.
Ans Teacher={'Emp1':{'EmpId':3698,'Name':'Rabi','Desig':'PGT'},
'Emp2':{'EmpId':9821,'Name':'Sachin','Desig':'PRT'},
'Emp3':{'EmpId':8219,'Name':'Ruksana','Desig':'TGT'},
'Emp4':{'EmpId':2195,'Name':'Martin','Desig':'TGT'},
'Emp5':{'EmpId':1975,'Name':'Robin','Desig':'PGT'}}
for i in Teacher.values():
if i['Name'][0]=='R' and i['Desig']=='PGT':
print(i)
Q19. Predict the output of the following code:
Goals2023={'Messi':26,'Ronaldo':35,'Haaland':25,'Neymar':20}
for i in Goals2023:
if len(i)>6:
print(i)
for i in Goals2023:
if Goals2023[i]>25:
print(i,Goals2023[i])
for i in Goals2023:
if Goals2023[i]%2==0:
print(i,Goals2023[i])
Ans Ronaldo
Haaland
Messi 26
Ronaldo 35
Messi 26
Neymar 20

PAGE:52
Q20. Soham wants to write a Python Code to calculate frequency of each distinct element
of a list but he is struggling at some points help him to complete the code.
Example:
Input: [12, 34, 21, 45, 21, 45, 12, 21, 32, 21, 21]
Output: {12: 2, 34: 1, 21: 5, 45: 2, 32: 1}

Code:
L=[12,34,21,45,21,45,12,21,32,21,21]
D={}
for ____________: #Statement 1
if i_______D: #Statement 2
_______________ #Statement 3
else:
D[i]+=1
print(L)
print(D)
a) Complete Statement 1 to traverse each element of the list one by one.
b) Complete Statement 2 to check whether i is not present in D as keys.
c) Complete Statement 3 to insert an entry for i in D with appropriate value.
Ans. a) Statement 1: for i in L:
b) Statement 2: if i not in D:
c) Statement 3: D[i]=1
20 Short Knowledge/Understanding/Application Based Questions (4 Marks)
Q1. Vedansh is a Python programmer working in a school. He has written the following
code, but it contains mistakes.

n1=Int ( input ( “Enter the number)) # statement 1


2n=int ( input ( “Enter the number”)) # statement 2
rem= n1 % n2 # statement 3
print(“rem” ) # statement 4
As a Python expert, help him by answering the following questions:
(a) Identify the statements that don’t contain any errors.
(b) Write the correct code for the statements containing error.
(c) Which type of operator is being used in statement 3.
(d) What will be the output if the input is 10 and 6 respectively for n1 and n2.
Ans (a) statement 3
(b) n1=int ( input ( “Enter the number”)) # statement 1
n2=int ( input ( “Enter the number”)) # statement 2
print(rem) # statement 4
(c) Arithmetic operator
(d) 4

PAGE:53
Q2. Soham has chosen the following names for some variables, give reasons why they are
invalid :
(a) 1sum
(b) sum@
(c) sum of num
(d) class
Ans (e) 1sum - starts with digit
(f) sum@ - contains special character ‘@’
(g) sum of num - contains space
(h) class - keyword
Q3. Rohan is trying to guess the size of following strings , help him to do so:

(a) (b)
‘\n’ “Ram’s”

(c) (d)
“ “ “ Hi “Hi \
All “ “ “ All”
Ans (a) 1 (b) 5 (c) 6 (d) 5
Q4. Find the output of the following code:
a,b,c=10,20,30
a,c,b=b-5,a-3,c-6
print(a,b,c)
Ans 15 24 7
Q5. Find the output of the following code snippets:
(a) type(‘None’) (b) type(None)
(c) print( print(“OK”)) (d) type(0o56)
Ans (a) string (b) None (c) None (d) int
Q6. What do you mean by looping construct in Python? Explain for loop and while loop
with their syntax and appropriate examples.
Ans The looping construct means repetition of a set of statements on the basis of a
condition test. Furthermore, till the time a condition turns out to be true or false
depending upon the loop, the repetition of a set of statements takes place again and
again.
for loop
A for loop is a type of loop that runs for a preset number of times. It also has the
ability to iterate over the items of any sequence, such as a list or a string.

PAGE:54
Syntax
for i in <collection>:
<loop body>
Example
for i in range(10): # collection of numbers from 0 to 9
print(i)
Here, collection is a list of objects. The loop variable, i, takes on the value of the next
element in collection each time through the loop. The code within loop body keeps
on running until i reach the end of the collection.
while loop
With the while loop, we can execute a block of code as long as a condition is true.
Syntax
while <condition>:
<loop body>
In a while loop, the condition is first checked. If it is true , the code in loop body is
executed. This process will repeat until the condition becomes false.
This piece of code prints out integers between 0 and 9 .
Example
n=0
while n < 10: # while n is less than 10,
print(n) # print out the value of n
n += 1 #
Q7. What do you mean by jumping statements in Python? Explain break, continue and
pass with appropriate examples.
Ans In Python, jumping statements are used to control the flow of a program by altering the
normal execution sequence. They allow you to change the order in which statements are
executed in a loop or conditional block. The three common jumping statements in Python are
break, continue, and pass.
break:
The break statement is used to exit the current loop prematurely, whether it's a for loop or a
while loop.
It is typically used when a certain condition is met, and you want to terminate the loop
immediately.
Example:
for i in range(1, 6):
if i == 3:
break # This will exit the loop when i is equal to 3
print(i)
continue:
The continue statement is used to skip the current iteration of a loop and proceed to the next
iteration.
It is often used when you want to skip some specific values or conditions but continue with
the loop.
Example:
for i in range(1, 6):
if i == 3:
continue # This will skip iteration when i is equal to 3
print(i)
pass:

The pass statement is a placeholder statement that does nothing. It is often used as a
placeholder when you need a statement syntactically but don't want to execute any code.

PAGE:55
Example:
for i in range(1, 4):
if i == 2:
pass # This will do nothing when i is equal to 2
else:
print(i)
Q8. Write a program to check if input number is a prime number.
Ans num = int(input("Enter a number: "))
if num > 1:
# check for factors
for i in range(2,num):
if (num % i) == 0:
print(num,"is not a prime number")
break
else:
print(num,"is a prime number")
# if input number is less than
# or equal to 1, it is not prime
else:
print(num,"is not a prime number")
Q9. Write a program to check whether a year is leap year or not.
Ans input_year = int(input("Enter the Year to be checked: "))
if (( input_year%400 == 0) or (( input_year%4 == 0 ) and ( input_year%100 != 0))):
print("%d is Leap Year" %input_year)
else:
print("%d is Not the Leap Year" %input_year)
Q10. Write a program to display the Fibonacci series upto nth term.
Ans #Python program to generate Fibonacci series until 'n' value
n = int(input("Enter the value of 'n': "))
a=0
b=1
sum = 0
count = 1
print("Fibonacci Series: ", end = " ")
while(count <= n):
print(sum, end = " ")
count += 1
a=b
b = sum
sum = a + b

Q11. 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])

Ans Now@ 44 # 11
Now@ 55 # 22
Now@ 22 # 55
Now@ 11 # 44

PAGE:56
Q12. Write a program to count positive numbers, negetive numbers and zeroes from a list of
integers. The list elements will be entered by the user.
Ans L=[]
p,n,z=0,0,0
s=int(input("Enter size of the list:"))
for i in range(s):
x=int(input("Enter element:"))
L.append(x)
if x>0:
p=p+1
elif x<0:
n=n+1
else:
z=z+1
print(L)
print("Postive Numbers=",p)
print("Negative Numbers=",n)
print("Zeroes=",z)
Q13. Write a program to input a list and an element and remove all occurences of the given
element from the list.
Ans Lst=eval(input(“Enter a list”))
item=int(input(“Enter thr item to remove”))
c=Lst.count(item)
if c==0:
print(“Item not found”)
else:
while(c>0):
i=Lst.index(item)
Lst.pop(i)
c-=1
print(Lst)
Q14. Given a list of integers, write a program to sum of even mumbers and odd numbers.
Ans L=[5,8,9,7,5,4]
sumeven, sumodd=0,0
for i in L:
if i%2==0:
sumeven+=i
else:
sumodd+=i
print(L)
print("Sum of even Numbers=",sumeven)
print("Sum of odd Numbers=",sumodd)

Q15. Identify the operators along with their names from the following statements:-
a. 5 in [1,2,3,4,5]
b. [1,2,3]*2
c. [1,2,3,4,5][1:3]
d. [1,2,3]+[4,5]

Ans a. in – membership operator


b. * - replication operator
c. : - slice operator
d. + - concatenation operator

PAGE:57
Q16. Predict the output of the following code:
Teacher1,Teacher2={'EmpId':3698,'Name':'Robin','Desig':'PGT',
'Sub':'Chemistry'},{'EmpId':9821,
'Name':'Sachin','Desig':'PRT','HomeTown':'Patna'}
print(Teacher1)
print(Teacher2)
Teacher1.update(Teacher2)
print(Teacher1)
print(Teacher2)
Ans {'EmpId': 3698, 'Name': 'Robin', 'Desig': 'PGT', 'Sub': 'Chemistry'}
{'EmpId': 9821, 'Name': 'Sachin', 'Desig': 'PRT', 'HomeTown': 'Patna'}
{'EmpId': 9821, 'Name': 'Sachin', 'Desig': 'PRT', 'Sub': 'Chemistry', 'HomeTown':
'Patna'}
{'EmpId': 9821, 'Name': 'Sachin', 'Desig': 'PRT', 'HomeTown': 'Patna'}
Q17. Predict the output of the following code:
Marks5Subs={'Sawan':[67,74,56,48,87],'Ankit':[34,46,39,21,41],
'Puja':[91,87,73,82,95],'Arnab':[78,98,97,95,99]}
print(max(Marks5Subs['Sawan']))
print(min(Marks5Subs['Ankit']))
print(len(Marks5Subs['Arnab']))
print(len(Marks5Subs))
Ans 87
21
5
4
Q18. Predict the output of the following code:
Age={'Sawan':67,'Ankit':34,'Puja':21,'Arnab':23}
print(list(Age.items()))
del Age['Sawan']
print(Age)
Age.clear()
print(Age)
del Age
print(Age)
Ans [('Sawan', 67), ('Ankit', 34), ('Puja', 21), ('Arnab', 23)]
{'Ankit': 34, 'Puja': 21, 'Arnab': 23}
{}
NameError: name 'Age' is not defined
Q19. Predict the output of the following code:
Result={'PT1':{'Suresh':35,'Kabir':29,'Lisa':17,'Hina':36},
'HYE':{'Suresh':87,'Kabir':56,'Lisa':87,'Hina':65},
'PT2':{'Suresh':37,'Kabir':23,'Lisa':27,'Hina':33},
'SEE':{'Suresh':78,'Kabir':65,'Lisa':89,'Hina':75}}
T_Suresh=T_Kabir=T_Lisa=T_Hina=0
for i in Result:
T_Suresh+=Result[i]['Suresh']
T_Kabir+=Result[i]['Kabir']
T_Lisa+=Result[i]['Lisa']
T_Hina+=Result[i]['Hina']
print(T_Suresh)

PAGE:58
print(T_Kabir)
print(T_Lisa)
print(T_Hina)
Ans 237
173
220
209
Q20. Predict the output of the following code:
Teacher1=Teacher2={'EmpId':3698,'Name':'Robin','Desig':'TGT'}
Teacher1['Desig']='PGT'
Teacher2['Sub']='CS'
print(Teacher1)
print(id(Teacher1))
print(Teacher2)
print(id(Teacher2))
Ans. {'EmpId': 3698, 'Name': 'Robin', 'Desig': 'PGT', 'Sub': 'CS'}
50519352
{'EmpId': 3698, 'Name': 'Robin', 'Desig': 'PGT', 'Sub': 'CS'}
50519352
15 Case Based Questions (5 Marks)
Q1. Namita is trying to understand the concept of literal, help him by answering the
following questions:
(a) what is literal
(b) state any two types of literals
(c) Name the special literal
(d) give an example of integer literal
(e) what is Boolean literal ?
Ans (a) Literal represents a value of a particular data type
(b) string literal and boolean literal.
(c) None
(d) 527
(e) True / False
Q2. Rakesh is unable to understand the difference between statement and expression,
write differences between them along with examples.
Ans

PAGE:59
Q3. Shilu has to write a program to accept the name of a person and greet him/her in the
following manner:
Hello <name>, welcome to our class.
Help Shilu to write the program.
Ans n=input(“Enter the name:”)
print(“Hello”,n, “welcome to our class”)
Q4. Write a program to accept two numbers and print their sum in the following manner:
The sum of <n1> and <n2> is <n1+n2>.
Ans n1=int(input(“Enter the number:”))
n2=int(input(“Enter the number:”))
print(“The sum of” ,n1,” and “, n2,” is”,n1+n2)
Q5. Find the output of the following:
(a) “ “ and “Hello”
(b) 2 and 4
(c) ‘a’ or ‘b’
(d) True and ‘Hi’
(e) 0 or 5
Ans (f) “ “ and “Hello” → “Hello
(g) 2 and 4 → 4
(h) ‘a’ or ‘b’ → a
(i) True and ‘Hi’ → Hi
(j) 0 or 5 - 5
Q6. Mr. Aakash wants to calculate electricity charges based on the number of consumed
electricity units and other charges. Write a program in Python to generate electricity
bill as per the following conditions.
i. If unit consumed <= 100 then cost per unit is Rs 3.46
ii. If unit consumed >= 101 and <= 300 then cost per unit is Rs 7.43
iii. If unit consumed >= 301 and <= 500 then cost per unit is Rs 10.32
iv. If unit consumed >= 501 then the cost per unit is Rs 11.71
v. Line rent is Rs 1.45 per unit.
vi. Additional fixed Meter rent is Rs 100.
vii. The tax on the bill is 16 percent which can be taken as 0.16.
Ans unit = int(input("Enter your unit: "))
if unit <= 100:
bill = unit * 3.46
elif unit >= 101 and unit <= 300:
bill = 346 + ((unit - 100) * 7.43)
elif unit >= 301 and unit <= 500:

PAGE:60
bill = 346 + 1486 + ((unit - 300) * 10.32)
else:
bill = 346 + 1486 + 2064 + ((unit - 500) * 11.71)
print("Bill Per Unit:",bill)
bill = bill + (unit*1.45)
print("Bill after adding Line rent:",bill)
bill = bill + 100
print("Bill after adding Meter rent:",bill)
bill = bill + (bill*0.16)
print("Total Bill after adding tax:",bill)
Q7. Mr. Ravi is a class teacher in Modern Public School. He wants to determine the
student's grade based on the results of five subjects and the criteria given below.
Average Mark Grade
91-100 A1
81-90 A2
71-80 B1
61-70 B2
51-60 C1
41-50 C2
33-40 D
21-32 E1
0-20 E2
Write an appropriate program in Python to find out the grade of a student.
Ans print("Enter Marks Obtained in 5 Subjects: ")
markOne = int(input())
markTwo = int(input())
markThree = int(input())
markFour = int(input())
markFive = int(input())
tot = markOne+markTwo+markThree+markFour+markFive
avg = tot/5
if avg>=91 and avg<=100:
print("Your Grade is A1")
elif avg>=81 and avg<91:
print("Your Grade is A2")
elif avg>=71 and avg<81:
print("Your Grade is B1")
elif avg>=61 and avg<71:
print("Your Grade is B2")
elif avg>=51 and avg<61:
print("Your Grade is C1")
elif avg>=41 and avg<51:
print("Your Grade is C2")
elif avg>=33 and avg<41:
print("Your Grade is D")

PAGE:61
elif avg>=21 and avg<33:
print("Your Grade is E1")
elif avg>=0 and avg<21:
print("Your Grade is E2")
else:
print("Invalid Input!")
Q8. A list is a standard data type in Python that can store a sequence of values belonging to any
type. Lists are enclosed in a pair of square brackets. These are mutable, i.e, elements can be
changed by the user. Every element of a list has an index. Indexing begins from zero.
Questions:-
I.List defined within a list is called:-
a. nested list b. super list c. sub list d. hidden list
II. In Python, list is of type:-
a. Immutable b. Mutable c. Both a & B d. None of a & b
III. If a list contains n elements, then the index of the last element will be:-
a. 0 b. n c. n+1 d. n-1
IV. Which type of the bracket is used to define a list?
a. ( ) b. { } c. [ ] d. <>
V. List can contain values of these types:-
a. integers b. float c. string d. all of these
Ans I. a II.b III.d IV.c V.d
Q9. Amit has created two lists L1=[6,2,3,8] and L2=[1,5,4]
He has been asked by his teacher to write the code for the following tasks:-
I. To predict the output of the code:-

L3=L2.extend(L1)
print(L3)
II. To display smallest number from L3
III.To add 2nd element from L1 and 3rd element from L2
IV. To arrange the elements of L3 in descending order
V. To predict the output : L1[:2]+L2[2:]
Ans I. [1,5,4,6,2,3,8]
II. min(L3)
III. L1[1] + L2[2]
IV. L3.sort(reverse=True)
V. [6,2,4]
Q10. Rakesh wants to write a program to count the number of vowels from the word 'Alexander'
by converting it into a list. But the program does not run due to errors. Help Rakesh to
identify and rectify the errors so that program can run:-

L=List('Alexander')
count==0
For i in L:
if i within 'aeiouAEIOU'
count=+1
print(count)

Ans L=list('Alexander')
count=0
for i in L:
if i in 'aeiouAEIOU'
count+=1
print(count)

PAGE:62
Q11. Raman has stored record of a student in a list as follows:-
rec=[‘Thomas’,’C-25’,[56,98,99,72,69],78.8]
Suggest him the Python statements to do the following tasks:-
a. To find the percentage
b. To find marks of 5th subject
c. Maximum marks of the student
d. To find total marks
e. To change the name from ‘Thomas’ to ‘ Charles’
Ans a. rec[3]
b. rec[2][4]
c. max(rec[2])
d. rec[0]+rec[1]+rec[2]+rec[3]+rec[4] or sum(rec)
e. rec[0]=‘Charles’
Q12. Rehana has a list of both positive numebers. She has been given a task to separate
positive and negetaive numbers into two different lists and finally to delete the
original list. She has written a code where some statements incomplete. Complete the
imcomplete statements by filling in the blanks:-
Numbers=[5,-8,9,-7,5,-4]
Pos, Neg= ____ #Statement 1: To initialize empty lists
for i in range( ): # Statement 2: To write the range to access all elements
if Numbers[i]>=0:
____________ # Statement 3: To add element in POS
else:
_____________ # Statement 4: To add element in another list
____________ #Statement 5: To delete the original list
print (Pos)
print(Neg)
print("Task Completed")
Ans a. Statement 1: Pos, Neg=[],[]
b. Statement 2: for i in range(len(Numbers)):
c. Statement 3: Pos.append(Numbers[i])
d. Statement 4: Neg.append(Numbers[i])
e. Statement 5: del Numbers
Q13. Write a menu driven program to store marks of students with the following features:
Press 1 to add a new student’s record.
Press 2 to update an existing student’s record.
Press 3 to delete an existing student’s record who have taken TC
Press 4 to display a particular student’s record.
Press 5 to display records of all students
Press 6 to exit
Ans Record={}
while True:
print('Press 1 to add a new student’s record')
print('Press 2 to update an existing student’s record')
print('Press 3 to delete an existing student’s record who have taken TC')
print('Press 4 to display a particular student’s record')
print('Press 5 to display records of all students')
print('Press 6 to exit')
op=int(input('enter the value'))
if op==1:

PAGE:63
Name=input('Enter Name')
Marks=int(input('Enter Marks'))
Record[Name]=Marks
elif op==2:
Name=input('Enter Name')
Marks=int(input('Enter Marks'))
Record[Name]=Marks
elif op==3:
Name=input('Enter Name')
del Record[Name]
elif op==4:
Name=input('Enter Name')
print(Record[Name])
elif op==5:
print(Record)
elif op==6:
break
else:
print('Wrong Choice')
Q14. Write a menu driven program to show category wise student enrolment details of a
KV with the following features.
Press 1 to add a new category.
Press 2 to update an existing category.
Press 3 to delete an existing category
Press 4 to display enrolment of a particular category.
Press 5 to display all category wise enrolment.
Press 6 to exit
Ans Enrol={}
while True:
print('Press 1 to add a new category')
print('Press 2 to update an existing category')
print('Press 3 to delete an existing category')
print('Press 4 to display enrolment of a particular category')
print('Press 5 to display all category wise enrolment')
print('Press 6 to exit')
op=int(input('enter the value'))
if op==1:
Cat=input('Enter Category')
Tot=int(input('Enter enrolment under the Category'))
Enrol[Cat]=Tot
elif op==2:
Cat=input('Enter Category')
Tot=int(input('Enter enrolment under the Category'))
Enrol[Cat]=Tot
elif op==3:
Cat=input('Enter Category')
del Enrol[Cat]
elif op==4:
Cat=input('Enter Category')
print(Enrol[Cat])

PAGE:64
elif op==5:
print(Enrol)
elif op==6:
break
else:
print('Wrong Choice')
Q15. Write a menu driven program to simulate Bank Application with the following
features:
Press 1 to open a savings bank account
Press 2 to deposit money
Press 3 to withdraw money
Press 4 to check balance
Press 5 to exit
Ans Acc={}
AccNo=1000
while True:
print('Press 1 to open a savings bank account')
print('Press 2 to deposit money')
print('Press 3 to withdraw money')
print('Press 4 to check balance')
print('Press 5 to exit')
op=int(input('enter the value'))
if op==1:
Name=input('Enter Name')
Age=int(input('Enter Age'))
AccNo+=1
Acc[AccNo]={'Name':Name,'Age':Age,'Bal':0}
elif op==2:
Ac=int(input('Enter Account No'))
Amt=int(input('Enter the amount to be deposited'))
for i in Acc:
if i==Ac:
Acc[i]['Bal']+=Amt
elif op==3:
Ac=int(input('Enter Account No'))
Amt=int(input('Enter the amount to be deposited'))
for i in Acc:
if i==Ac:
Acc[i]['Bal']-=Amt
elif op==4:
Ac=int(input('Enter Account No'))
for i in Acc:
if i==Ac:
print(Acc[i])
elif op==5:
break
else:
print('Wrong Choice')

PAGE:65
Name of the chapter : Database concepts and the
Structured Query Language
Topic Covered
• Database Concepts: Introduction to database concepts and its need,Database Management
System.

Relational data model: Concept of domain, tuple,relation, candidate key, primary key, alternate
key
• Advantages of using Structured Query Language, Data Definition Language, Data Query
Language and Data Manipulation Language, Introduction to MySQL, Creating a
databaseusing MySQL,Data Types
• Data Definition:CREATE DATABASE, CREATE TABLE, DROP, ALTER
• Data Query: SELECT, FROM, WHERE with relational operators, BETWEEN, logical operators,
IS NULL, IS NOT NULL
• Data Manipulation: INSERT, DELETE,UPDATE
Key Points
Candidate KeyAll the attributes combinations inside a relation that can serve as primary key.
Constraint Rule and conditions set for data being stored in a database.
DDL Data Definition Language. SQL part-language that facilitates defining creation/ modification
etc. of database objects such as tables, indexes, sequences etc.
DML Data Manipulation Language. SQL part-language that facilitates manipulation (addition/
deletion/ modification) of data residing in database object.
Primary Key A set of one or more attributes that can uniquely identify tuples within the relation.
Relation A table having non-empty atomic values with unordered rows and columns is relation.
SQL Structured Query Language. A non-procedural UGL used for querying upon relational database.
Tuple A row in a relation is called tuple. View A virtual table that does not really exist in its own
right but is instead derived from one or more underlying base tables in called a view

(i) Data Query: SELECT, FROM, WHERE with operators


Syntax :

Execution :

PAGE:66
Fundamental components of a query used to retrieve specific data from a database table.
This clauses allow you to specify :
❖ What data you want to retrieve (SELECT),
❖ Which table it should come from (FROM),
❖ Which specific rows should be included based on a condition (WHERE).
Description of each:
(i) SELECT:
➢ used to specify which columns or expressions you want to retrieve from a database
table.
➢ It is followed by a comma-separated list of column names or expressions enclosed in
parentheses.
(ii) 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,
separated by commas.
(iii) WHERE:
➢ Used to filter the rows that are returned from the database table based on a specified
condition.
➢ It follows the FROM clause and is followed by a condition that determines which
rows should be included in the result set.
➢ The condition can include
o Relational Operators (e.g., '=', '<', '>', '<=', '>=', '<>'),

PAGE:67
o Logical Operators (e.g., AND, OR),
o Other functions or expressions.
Example: SELECT
column1, column2
FROM
table_name
WHERE
column1 <= 'value';

(a) Relational Operator :


Operator Symbol Description
> greater than
< less than
>= greater than equal to
<= less than equal to
= equal
! = or <> not equal to

(b) Range Operator Between. : The BETWEEN operator in SQL is used to filter rows based on a
specified range of values.
SELECT
ProductName, Price
FROM
Products
WHERE
Price BETWEEN 10 AND 50;

(c) Logical Operator : Logical operator is used to combine two or more logical expression,
(i) And – evaluated true if all the logical expression is true otherwise false. E.g.
SELECT
*
FROM
Customers
WHERE
Country = 'USA' AND City = 'New York';

(ii) Or - evaluated true if any the logical expression is true otherwise false. e.g.
SELECT
*
FROM
Products
WHERE
Category = 'Electronics' OR Price < 50;
(d) Comparing NULL :
is null, is not null NULL (Absence of value) value cannot be compared using Relational
operator.

PAGE:68
This statement is used to check whether column contains NULL or not. E.g.
SELECT
*
FROM
Customers
WHERE
PhoneNumber IS NULL;

30 Objective Question (1 Mark )


Q1. A ____ is a property of the entire relation, which ensures through its value that each tuple is
unique in a relation
Ans Attributes
Q2. A row also called a Record or _________ represents a single, data item in a table.
a. Column b. Tuples c. Fields d. None of the above
Ans Tuples
Q3. The Primary key is selected from the set of __________
Ans Candidate keys
Q4. Which of the following is a group of one or more attributes that uniquely identifies a row? (a)
Key (b) Determinant (c) Tuple(d) Relation
Ans (a) Key
Q5. Which of the following is a DDL command? (a) SELECT (b) ALTER (c) INSERT (d)
UPDATE

Ans (b) ALTER


Q6. In SQL, which of the following will select only one copy of each set of duplicate rows from a
table. (a) SELECT UNIQUE (b) SELECT DISTINCT (c) SELECT DIFFERENT (d) All of
these
Ans (b) SELECT DISTINCT
Q7. We can change the structure of a table ie. add, remove or change its column(s) using the
_________ statement.
Ans Alter Table
Q8. The keyword _________ is used to eliminate redundant data from display.
a. Modify b. Distinct c. Describe d. None of the above
Ans Distinct
Q9. Give the example of wild card character _______
a. % b. _ c. Both a) and b) d. None of the above
Ans Both a) and b)
Q10. The results of the SELECT statement can be displayed in the ascending or descending order
of a single column or columns using _________ clause.
a. Non Order by b. Modular c. Order by d. Where cause
Ans Order by
Q11 When the same piece of data is stored in two or more locations, it is called ______________.
a. Data Redundancy b. Data Integrity c. Data Consistency d. None of the above
Ans a. Data Redundancy
Q12 The unique field present in the table is called __________.
a. Primary Key b. Candidate Key c. Foreign Key d. None of the above
Ans Primary Key
Q13 SQL stands for _____________.

PAGE:69
Ans Structured Query Language
Q14 A ____________ is a subset of DML that just deals with information retrieval.
a. Query Language
b. Structure Language
c. Both a) and b)
d. None of the above
Ans Query Language
Q15 A ______________ is a language that enables users to access and manipulate data in a
database.
a. Data Manipulation Language (DML)
b. Data Definition Language (DDL)
c. Both a) and b)
d. None of the above
Ans Data Manipulation Language (DML)
Q16. What SQL clause is used to specify the columns you want to retrieve from a table?
(A) SELECT
(B) FROM
(C) WHERE
(D) INSERT
Ans A) SELECT
Q17. Which SQL clause specifies the table from which data should be retrieved?
(A) SELECT
(B) FROM
(C) WHERE
(D) UPDATE
Ans B) FROM
Q18. What SQL operator is used for exact value matching in a WHERE clause?
(A) LIKE
(B) BETWEEN
(C) =
(D) AND
Ans C) =
Q19. Which SQL operator is used to check if a column value falls within a specified range?
(A) LIKE
(B) BETWEEN
(C) =
(D) AND
Ans B) BETWEEN
Q20. What is the purpose of the IS NULL operator in SQL?
(A) It checks if a column contains a specific value.
(B) It checks if a column is empty.
(C) It checks if a column is not empty.
(D) It checks if a column exists.
Ans B) It checks if a column is empty.

Q21. Which logical operator combines multiple conditions in a WHERE clause with an OR
relationship?
(A) AND
(B) OR

PAGE:70
(C) NOT
(D) XOR
Ans B) OR
Q22. What SQL statement is used to add new records to a database table?
(A) INSERT
(B) DELETE
(C) UPDATE
(D) ALTER
Ans A) INSERT
Q23. Which SQL clause is used to delete records from a database table?
(A) INSERT
(B) DELETE
(C) UPDATE
(D) ALTER
Ans B) DELETE
Q24. Which SQL clause is used to modify existing records in a database table?
(A) INSERT
(B) DELETE
(C) UPDATE
(D) ALTER
Ans C) UPDATE
Q25. Which SQL statement is used to remove all records from a table?
(A) TRUNCATE
(B) DROP
(C) DELETE
(D) REMOVE
Ans C) DELETE
Q26 What does the SQL WHERE clause do?
(A) It specifies which columns to retrieve.
(B) It filters the rows to include based on a condition.
(C) It specifies the table to query.
(D) It sorts the result set.
Ans B) It filters the rows to include based on a condition.
Q27 What is the purpose of the NOT operator in a SQL WHERE clause?
(A) It negates a condition.
(B) It checks if a column is empty.
(C) It checks if a column exists.
(D) It combines conditions with OR.
Ans A) It negates a condition.
Q28 Which SQL clause is used to update data in a table with new values?
(A) INSERT
(B) DELETE
(C) UPDATE
(D) ALTER
Ans C) UPDATE
Q29 What SQL operator is used for pattern matching in a WHERE clause?
(A) LIKE
(B) BETWEEN
(C) =

PAGE:71
(D) AND
Ans A) LIKE
Q30 Which SQL operator checks if a column value is not equal to a specified value in a WHERE
clause?
(A) LIKE
(B) BETWEEN
(C) <>
(D) AND
Ans C) <>
10 Assertion and reason Based question ( 1 Mark )

In the following questions, a statement of Assertion (A) is followed by statement of Reason . (R).
Mark the correct choice as :
(a) Both A and R are true and R is the correct explanation of A.
(b) Both A and R are true and R is not the correct explanation of A.
(c) A is true but R is false (or partly true)
(d) A is false (or partly true ) but R is true.
(e) Both A and R are false or not fully true.
Q1. Assertion : A data table can have only one Primary key.
Reason : In a data table, there can be only one attribute/field containing
unique values for each row.
Ans A is true but R is false (or partly true)

Q2. Assertion : There can be multiple options for choosing a primary key in a data
table.
Reason : All attribute combinations inside a data table that contain unique values
for each row, are the candidates keys.

Ans Both A and R are true and R is not the correct explanation of A
Q3. Assertion : All types of keys contain unique values A data table can have only one
Primary key.
Reason : In a data table, there can be only one attribute/field containing
unique values for each row.

Ans A is true but R is false (or partly true)


Q4. Assertion : A data table can have only one Primary key.
Reason : In a data table, there can be only one attribute/field containing
unique values for each row.
Ans Both A and R are true and R is not the correct explanation of A.
Q5. Assertion : Foreign key is a non-key attribute whose value is derived from primary key of
another table.
Reason : Each foreign key refers a candidate key in a relation.
Ans Both (A) and (R) are correct and (R) is not the correct explanation of (A).
Q6. Assertion: The SQL SELECT statement is used to update records in a database.
Reason : The SELECT statement allows you to retrieve data from a database table.
Ans (C) The assertion is true, but the reason is false.
Q7. Assertion: The SQL WHERE clause is used for sorting the result set of a query.

PAGE:72
Reason : The WHERE clause specifies conditions to filter rows in a query.
Ans (C) The assertion is true, but the reason is false.
Q8. Assertion: The IS NULL operator in SQL checks if a column has a value.
Reason : The IS NULL operator checks if a column contains a specific value.
Ans (C) The assertion is true, but the reason is false.
Q9. Assertion: The SQL DELETE statement is used to add new records to a database table.
Reason : The DELETE statement removes records from a database table.
Ans (B) Both the assertion and reason are true, but the reason does not explain the assertion.
Q10. Assertion: The SQL BETWEEN operator is used for exact value matching in a WHERE
clause.
Reason : The BETWEEN operator checks if a column value falls within a specified range.
Ans (A) Both the assertion and reason are true, and the reason correctly explains the assertion.
10 Short Knowledge/Understanding/Application Based Questions (2 Marks)

Q1. Differentiate between DDL and DML with one Example each.
Ans DDL DML
Stands for Data definition language Stands for Data manipulation language
Consists of commands used to Consist of commands used to modify the
modify the metadata of a table. data of a table.
Example- create table, alter table, Example- insert, delete, update
drop table

Q2. Correct the error in the following query.


Select * from RECORD where Rname = %math%;

Ans Correct Query: Select * from RECORD where Rnamelike %math%;


Q3.
Observe the following tables TRANSACTIONS and CUSTOMERS carefully and answer the
questions that follows :

Table : Transaction

TNo Type Amount CNo

T1 CREDIT 1000 C3

T2 DEBIT 1500 C1

CNo CNAME

C1 ZEESHAN

C2 AMAN

PAGE:73
C3 JASPREET Table : Customer

(i) What is the degree of the table Transaction ? what is the cardinality of the table
Customers ?

ii. Identify the primary key and candidate keys from the table Transcations.

Ans (i) Degree of the table TRANSACTIONS=4 Cardinality of table CUSTOMERS=3


(ii) TNO PRIMARY KEY; TNO, CNO CANDIDATES KEYS
Q4. Anjali writes the following commands with respect to a table employee having fields, empno,
name, department, commission. Command1: Select count(*) from employee; Command2
:Select count(commission) from employee; She gets the output 4 for the first command but
get an output 3 for the second command. Explain the output with justification.
Ans The Count(*) function returns the total number of records in the table while count() will
return the count of non-null values in the given field and this is the reason for the different
results by the given queries above. The field commission must be containing a NULL value
and thus count(commission) returned the count of non-null values and count(*) return total
number of records (Irrespective of NULL values in the field).
Q5. Identify the problem/issue with the following SQL query :
SELECT house, count(*)
FROM student;
Ans The problem with the given SQL query is that there is no GROUP BY clause is given and thus,
it will lead to an error. The reason being that the select list use COUNT() function, which is an
aggregate function, along with a field. When we use an aggregate function in the select list along with
a database field, we need to add a GROUP BY clause.
To correct the error it should use GROUP BY clasue. SELECT house, count(*) FROM student
GROUP BY house;
Q6. 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. Example:
SELECT FirstName, LastName FROM Employees;
Q7. What is the difference between the SQL WHERE and HAVING clauses? Provide an example
of when you would use each of them in a query.
Ans The SQL WHERE clause is used to filter rows before the grouping (e.g., filtering rows before
an aggregation),
while the HAVING clause is used to filter rows after the grouping (e.g., filtering groups based
on aggregate results).
Example: Use WHERE to filter employees with a salary above 50,000;
Use HAVING to filter departments with an average salary above 60,000.
Q8. You have a database table named "Employees" with columns "EmployeeID," "FirstName,"
and "LastName." Write an SQL query to retrieve the first and last names of all employees
whose first name is "John."
Ans SELECT FirstName, LastName FROM Employees WHERE FirstName = 'John';
Q9. Describe the primary function of the SQL INSERT statement and provide an example of how
it is used to add new records to a database table.
Ans The primary function of the SQL INSERT statement is to add new records to a database table.
Example: INSERT INTO Employees (FirstName, LastName) VALUES ('Jane', 'Doe');
Q10. You have a table named "Products" with columns "ProductID," "ProductName," and "Price."

PAGE:74
Write an SQL query to update the price of a product with a ProductID of 101 to $25.50.
Ans UPDATE Products SET Price = 25.50 WHERE ProductID = 101;
10 Short Knowledge/Understanding/Application Based Questions (3 Marks)
Q1. Differentiate between Primary Key and Alternate Key.
Ans Primary keys Alternate keys
Primary keys - Contain one or more Alternate keys - Contain one or more
columns whose combined values columns whose combined values
uniquely identify every row in a uniquely identify every row in a table.
table. Each table can have only one
primary key.

Q2. In a multiplex, movies are screened in different auditoriums. One movie can be shown in
more than one auditorium. In order to maintain the record of movies,
the multiplex maintains a relational database consisting of two relations viz. MOVIE and
AUDI respectively as shown below:
Movie(Movie_ID, MovieName, ReleaseDate)
Audi(AudiNo, Movie_ID, Seats, ScreenType,TicketPrice)
a) Is it correct to assign Movie_ID as the primary key in the MOVIE relation? If no, then
suggest an appropriate primary key.
b) Is it correct to assign AudiNo as the primary key in the AUDI relation? If no, then suggest
appropriate primary key.
c) Is there any foreign key in any of these relations?
Ans a) Yes, because every movie will have it's unique id.
b) Yes, because every auditorium will be assigned a unique id. No two auditoriums will have same id.
c) Yes, Movie_ID in Audi table is the foreign because it references the Movie_ID in the Movie table.
Q3. An organisation wants to create a database EMPDEPENDENT to maintain following details
about its
employees and their dependent.
EMPLOYEE(AadharNumber, Name, Address,Department,EmployeeID)
DEPENDENT(EmployeeID, DependentName, Relationship)
a) Name the attributes of EMPLOYEE, which can be used as candidate keys.
b) The company wants to retrieve details of dependent of a particular employee. Name the
tables and the key which are required to retrieve this detail
c) What is the degree of EMPLOYEE and DEPENDENT relation?

Ans a) AadharNumber and EmployeeID can be used for candidate keys because they are unique to
every employee.
b) Employee and Dependent tables are required. EmployeeID is the key to retrieve the
required data.
c) Degree of Employee relation = 5 and degree of Dependent relation = 3
The number of attributes in a relation is called the Degree of the relation.
Q4. Why foreign keys are allowed to have NULL values? Explain with an example.
Ans In a relational database, a foreign key is a field that refers to the primary key in another table.
The foreign key establishes a link or relationship between two tables.
In some database systems, foreign keys are allowed to have NULL values,
Allowing foreign keys to have NULL values can be useful in certain scenarios,
such as when one have optional relationships between tables. In such cases,
the absence of a foreign key value indicates that there is no corresponding
entry in the referenced table.
Q5. Compared to a file system, how does a database management system avoid redundancy in

PAGE:75
data through a database?

Ans A database management system (DBMS) is designed to provide a structured and efficient way
to store, retrieve, and manage data. Compared to a file system, a DBMS offers several
features and mechanisms to avoid redundancy in data and promote data integrity. Here are
some key ways in which a DBMS
achieves this:
Data Normalization:
Reduction of Redundant Data:
Foreign Keys: DBMSs use foreign keys to establish relationships between tables.
Data Type Enforcement: DBMSs enforce consistent data types for columns, preventing the
storage of incompatible data.
Constraints: Integrity constraints, such as unique constraints and check constraints, ensure
that data adheres to specified rules, preventing the insertion of duplicate or inconsistent
information.
ACID Properties:
Atomicity, Consistency, Isolation, Durability (ACID): DBMSs adhere to these fundamental
properties
Q6. Explain the purpose of SQL transactions and why they are important in database
management.
Ans SQL transactions are used to ensure the atomicity, consistency, isolation, and durability
(ACID) properties of a database. Transactions are important to maintain data integrity by
allowing a series of SQL statements to be executed as a single, indivisible unit, ensuring that
either all changes are applied or none.
Q7. Describe the differences between the SQL INNER JOIN, LEFT JOIN, and RIGHT JOIN
operations. Provide an example for each
Ans INNER JOIN: Returns records that have matching values in both tables.
Example: SELECT * FROM Table1 INNER JOIN Table2 ON Table1.ID = Table2.ID;
LEFT JOIN: Returns all records from the left table (Table1), and the matched records from
the right table (Table2). Unmatched records from Table2 will contain NULL values.
Example: SELECT * FROM Table1 LEFT JOIN Table2 ON Table1.ID = Table2.ID;
RIGHT JOIN: Returns all records from the right table (Table2), and the matched records
from the left table (Table1). Unmatched records from Table1 will contain NULL values.
Example: SELECT * FROM Table1 RIGHT JOIN Table2 ON Table1.ID = Table2.ID;
Q8. You have a database table named "Orders" with columns "OrderID," "CustomerID," and
"OrderDate." Write an SQL query to retrieve the number of orders placed by each customer.
Ans SELECT
CustomerID, COUNT(OrderID) AS OrderCount
FROM
Orders
GROUP BY
CustomerID;
Q9. Describe the purpose of SQL indexes and their significance in database performance
optimization.
Ans SQL indexes are data structures that improve the speed of data retrieval by allowing the
database management system to locate specific rows more quickly, similar to the index in a
book. They enhance database performance by reducing the need for the database engine to
scan the entire table when searching for specific data.
Q10. 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.

PAGE:76
Ans DELETE FROM Students WHERE Age < 18;
10 Short Knowledge/Understanding/Application Based Questions (4 Marks)
Q1. Consider the following table ACTIVITY and COACH and answer the following parts of this
question :Table : ACTIVITY

TABLE COACH

Give the output of the following SQL queries:


(i) SELECT COUNT(DISTINCT ParticipantsNum) FROM ACTIVITY;
(ii) SELECT MAX(ScheduleDate), MIN(ScheduleDate) FROM ACTIVITY;
(iii) SELECT Name,ActivityName FROM ACTIVITY A, COACH C WHERE
A.Acde=C.Acode AND A.ParticipantsNum=10;
(iv) SELECT DISTINCT ParticipantsNum FROM ACTIVITY;
Ans (i) COUNT(DISTINCT ParticipantsNum) ------------------------------- 3
(ii) MAX(ScheduleDate) MIN(ScheduleDate) ------------------ 19-Mar-04 12-Dec-03
(iii) Name ActivityName ------------------------------------ Ravubder Discuss Throw
(iv) DISTINCT ParticipantsNum ----------------------------------- 16 10 12
Q2. Choose appropriate answer with respect to the following code snippet.
CREATE TABLE student ( name CHAR(30), student_id INT, gender CHAR(1), PRIMARY
KEY (student_id) );
a) What will be the degree of student table?
b) What does ‘name’ represent in the above code snippet?
c) What is true about the following SQL statement?
Select * FROM student;
i) Displays contents of table ‘student’
ii) Displays column names and contents of table ‘student’
iii) Results in error as improper case has been used
iv) Displays only the column names of table ‘student’
d) In the following query how many rows will be deleted?
DELETE student
WHERE student_id=109;
Ans a) 3, b) a column c) Displays column names and contents of table ‘student’
e) All the rows where student ID is equal to 109
Q3. TID TName TSal TDept TDesig

PAGE:77
1 Amit 2000 IT PGT
2 Sunit 1500 HISTORY TGT
3 Naina 1800 MATH PGT

Write the sql command for the following queries and answer the question
a. What is degree and Cardinality of the Table : Teacher
b. Identify the primary key in the table
c. Display the records of all PGT staff
d. Increase the salary of teachers of Math Department.
Ans a. Degree 5, Cardinality 3
b. b.TID
c. Select * from Teacher Where TDesig =PGT;
d. Update Teacher set salary= salary + salay *20/100 Where TDept=Math
Q4. Suppose your school management has decided to conduct cricket matches between
students of class XI and Class XII. Students of each class are asked to join any one of the
four teams — Team Titan, Team Rockers, Team Magnet and Team Hurricane. During
summer vacations, various matches will be conducted between these teams. Help your
sports teacher to do the following:
a) Create a database “Sports”.
b) Create a table “TEAM” with following considerations:
i) It should have a column TeamID for storing an integer value between 1 to 9,
which refers to unique identification of a team.
ii) Each TeamID should have its associated name (TeamName), which should be a
string of length not less than 10 characters
c. Using table level constraint, make TeamID as primary key
d. Show the structure of the table TEAM using SQL command.
Ans a.Create database Sports;
use Sports
b. create table team (teamidint(1), teamname varchar(10));
c. alter table team add primary key (teamid);
d. desc team;
Q5. Consider the following table STOCK and DEALERS and answer the following parts of this
question :
Table :STOCK
Item
No Item Dcode Qty UnitPrice StockDate
5005 Ball Pen 0.5 102 100 16 31-Mar-10
5003 Bal Pen 0.25 102 150 20 01-Jan-10
5002 Gel Pen Premium 101 125 14 14-Feb-10
5006 Gel Pen Classis 101 200 22 01-Jan-09
5001 Eraser Small 102 210 5 19-Mar-09
5004 Eraser Big 102 60 10 12-Dec-09
5009 Sharpener Classis 103 160 8 23-Jan-09

Table :DEALERS
Dcode Dname
101 Reliable Stationers

PAGE:78
103 Classis Plastics
102 Clear Deals
Give the output of the following SQL queries:
(i) SELECT COUNT(DISTINCT Dcode)
FROM STOCK;
(ii) SELECT QTY*UnitPrice FROM STOCK WHERE ItemNo=5006;
(iii) SELECT Item, Dname FROM STOCK S DEALERS D WHERE
S.Dcode=D.Dcode AND ItemNo=5004;
(iv) (iv) SELECT MIN(StockDate) FROM STOCK;

Ans (i) COUNT(DISTINCT Dcode) ------------------------------ 3


(ii) QTY*UnitPrice ------------------ 4400
(iii) Item Dname
(iv) MIN(StockDate) --- ------------------------ Eraser Big Clear Deals 01-Jan-09
Q6. Describe the differences between a primary key and a foreign key in a database table. Provide
an example of how they are used in a real-world scenario.
Ans A primary key is a unique identifier for a record in a table, ensuring that each row has a
distinct value. A foreign key is a field in one table that refers to the primary key in another
table, establishing a relationship between the two. For example, in a database for an e-
commerce site, the "CustomerID" in the "Orders" table is a foreign key that links to the
"CustomerID" in the "Customers" table.
Q7. You have two database tables: "Customers" and "Orders." Write an SQL query to retrieve the
names of customers who have placed more than five orders.
Ans SELECT
Customers.CustomerName
FROM
Customers JOIN Orders ON Customers.CustomerID = Orders.CustomerID
GROUP BY
Customers.CustomerName
HAVING
COUNT(Orders.OrderID) > 5;
Q8. You are tasked with designing a database TABLES for a library. Describe the necessary
tables, including primary keys and foreign keys, to store information about books, authors,
borrowers, and book loans.
Ans (i) Table "Books": BookID (PK), Title, ISBN, AuthorID (FK).
(ii) Table "Authors": AuthorID (PK), FirstName, LastName.
(iii) Table "Borrowers": BorrowerID (PK), FirstName, LastName, ContactInfo.
(iv) Table "BookLoans": LoanID (PK), BookID (FK), BorrowerID (FK), LoanDate,
ReturnDate

Q9. Consider the following tables customer and orders:


Customers
CustomerName Country
CustomerID ContactName
1 Customer A John Doe USA
2 Customer B Jane Smith Canada
3 Customer C David UK
Johnson
4 Customer D Emily Brown Australia

PAGE:79
5 Customer E Michael Lee Germany

Orders
OrderID CustomerID OrderDate TotalAmount
101 1 2023-01-15 500.00
102 2 2023-02-20 750.00
103 1 2023-03-10 300.00
104 3 2023-04-05 900.00
105 4 2023-05-15 600.00

(A) Write an SQL query to retrieve the names of customers (CustomerName) who have
placed orders.
(B) Write an SQL query to calculate the total amount of orders placed by each customer.
Display the customer's name (CustomerName) and the total order amount.
(C) Write an SQL query to find the customer (CustomerName) who placed the highest total
order amount and the corresponding total amount.
(D) Write an SQL query to retrieve the CustomerName and OrderDate for orders placed in
the year 2023.
Ans (A) SELECT DISTINCT c.CustomerName
FROM Customers c
INNER JOIN Orders o ON c.CustomerID = o.CustomerID;

(B) SELECT c.CustomerName, SUM(o.TotalAmount) AS TotalOrderAmount


FROM Customers c
INNER JOIN Orders o ON c.CustomerID = o.CustomerID
GROUP BY c.CustomerName;

(C) SELECT TOP 1 c.CustomerName, SUM(o.TotalAmount) AS TotalOrderAmount


FROM Customers c
INNER JOIN Orders o ON c.CustomerID = o.CustomerID
GROUP BY c.CustomerName
ORDER BY TotalOrderAmount DESC;

(D) SELECT c.CustomerName, o.OrderDate


FROM Customers c
INNER JOIN Orders o ON c.CustomerID = o.CustomerID
WHERE YEAR(o.OrderDate) = 2023;
Q10. Consider the following tables:
Employees Salaries
EmployeeID EmployeeID Salary
FirstName LastName
1 John Doe 1 60000
2 Jane Smith 2 55000
3 Michael Johnson 3 62000
4 Sarah Davis 4 58000
5 Kevin Lee 5 63000
(a) Write an SQL query to retrieve the first names, last names, and salaries of employees.
(b) Write an SQL query to calculate the average salary of employees.
(c)Write an SQL query to find the first names of employees whose salary is higher than the

PAGE:80
average salary.
(d) Write an SQL query to increase the salary of employees by 10% if their salary is less than
60000.
Ans (a) SELECT
E.FirstName, E.LastName, S.Salary
FROM
Employees E
JOIN Salaries S ON E.EmployeeID = S.EmployeeID;

(b) SELECT
AVG(Salary) AS AverageSalary
FROM
Salaries;

(c) SELECT
FirstName
FROM
Employees
WHERE
Salary > (SELECT AVG(Salary) FROM Salaries);
(d) UPDATE
Salaries
SET
Salary = Salary * 1.10
WHERE
Salary < 60000;
07 Case Based Questions (5 Marks)
Q1. A library uses database management system(DBMS) to store the details of the books that it
stocks, its registered members and the book-loan that the library has made. These details are
stored in a database using the following three relations. Name of the Database : KV Library
• Book (BookID : Char(5), Title : Varchar(25), Author :Varchar(25), Publisher : Varchar(100))
•Member(MemberID:Char(5), LastName:Varchar(25), FirstName:Varchar(25),
Correspondence-Address : Varchar(100), Pincode : Char(6), DateofBirth : Date, EmailID :
Varchar(50))
•Loan(MemberID: Char(5), BookID:Char(5), LastDate:Date, DueBackDate:Date, Returned
:Boolean)
Note : The Library does not stock more than one copy of the same book
(a) Identify following types of keys from all the relations of the given database Foreign
keys along with parent relations. 2
(b) Can a relation have multiple foreign keys? Give example. 1
(c) Can a foreign key be part of a primary key? Give example 1
(d) Write a SQL query to retrieve the names and email addresses of the 1members
belonging to KVS (they have email ids as _____@kvs.in) and have not returned their
books
Ans (a) (iii) Loan Table
(b) I. (i) Book : Title (ii) Member: EmailID
II. No, the Loan relation cannot have alternate key as its primary key is a composite key
having foreign key.
(c) INSERT INTO Loan Values(‘M1255’, ‘B3100’, ‘02/02/2020’, ‘09/02/2020’, False)
(d) Select FirstName, LastName, EmailID

PAGE:81
From Member, Loan
Where Member.MemberID=Loan.MemberID
AND Returned = ‘False’;
Q2. Rachana Mittal runs a beauty parlor. She uses a database management system(DBMS) to
store the information that she needs to manage her business. This information includes
customer contact details, staff names, the treatments that the parlor offer (for example, ‘’Hair
Massage’) and appointment that customers have made for treatments. A separate appointment
must be made for each treatment.
The details are stored in a database using the following four relations:
Customer: (CustomerID, FirstName, LastName, TelephoneNumber, EmailAddress)
Staff: (StaffID, FirstName,LastName, IsQualified) Treatment:
(TreatmentName,Price,TimeTaken,NeedsQualification) Appointment :
(CustomerID,TreatmentName,ApDate,ApTime)
• The IsQualified attribute for a member of staff stores one of the value True or False, to
indicate if the member of staff is fully qualified or not.
•The NeedsQualifiction attribute for a treatment stores True or False to indicate if the
treatment can only be given by a qualified member of staff.
•The TimeTaken attribute for a treatment is the number of minutes (a whole number) that the
treatment takes.
(a) Write a SQL statement to create the table staff.
(b) Write a query to Insert a record in the table Staff with following data ; (2009, ‘Sheril’,
‘Mark’, ‘True’)
(c) Which table’s records can be deleted without affecting any other table?
(i) Customer (ii) Staff (iii) Treatment (iv) Appointment

(d) Write a query to Modify table Appointment to add a new column StaffID, which should
hold a legal StaffID value from the staff table.
(e) Rachana wants to send e-mail advertisement to all the customers who had a ‘RF Facial’
treatment in 2020. To send the email, the customer’s email address, firstname and lastname
are needed.
Write a SQL query to retrieve the email address, firstname and lastname of each customer to
whom email should be sent.

Ans (a) Create Table Staff ( StaffID Number(4,0) NOT NULL PRIMARY KEY, FirstName
Varchar(20) NOT NULL, LastNameVarchar(20), ISQualifiedChar(4) Check (IsQualified
IN(‘True’, ‘False’)));
(b) INSERT INTO Staff Values(2009, ‘Sheril’, ‘Mark’, ‘True’);
(c) (ii) Staff table’s records can be deleted without affecting any other table as of now,
because this table is not linked with any other table yet.
(d) Alter Table Appointment Add StaffIDNumber(4,0) NOT NULL Reference Staff(StaffID);
(e) Select EmailAddress, FirstName,LastName From Customer C, Appointment A Where
C.CustomerID=A.CustomerID AND TreatmentName= ‘RF Facial’;
Q3. Online Store: You are managing an online store database with two tables: "Products" and
"Orders."

Products Orders
ProductID ProductName UnitPrice OrderID ProductID Quantity
1 Laptop 800 101 1 2
2 Smartphone 500 102 2 3
3 Tablet 350 103 1 1

PAGE:82
Question: Write SQL queries to perform the following tasks:
(a) Retrieve the total sales revenue for each product (sales = quantity * unit price).
(b) Find the product total sales revenue in highest to lowest order.
(c) Retrieve the product names that have not been ordered.
(d) Increase the unit price of all products by 10%. e. Delete the order with OrderID 102.

Ans (a) SELECT P.ProductName, SUM(O.Quantity * P.UnitPrice) AS TotalRevenue


FROM Products P
LEFT JOIN Orders O ON P.ProductID = O.ProductID
GROUP BY P.ProductName;
(b) SELECT P.ProductName
FROM Products P
LEFT JOIN Orders O ON P.ProductID = O.ProductID
GROUP BY P.ProductName
ORDER BY SUM(O.Quantity * P.UnitPrice) DESC;
(c) SELECT P.ProductName
FROM Products P
LEFT JOIN Orders O ON P.ProductID = O.ProductID
WHERE O.OrderID IS NULL;
(d) UPDATE Products
SET UnitPrice = UnitPrice * 1.10;
(e) DELETE FROM Orders WHERE OrderID = 102;
Q4. Employee Performance
You are managing an employee performance database with a "Performance" table.

Performance
Month Rating
EmployeeID
1 Jan 4
2 Jan 5
1 Feb 5
2 Feb 4

Question: Write SQL queries to perform the following tasks:


(a) Calculate the average rating for each employee for the months of January and February.
(b) Find the employee rating in ascending order.
(c) Identify employees who received a rating of 4 or higher in both January and February.
(d) Increase the rating of all employees by 1 for the month of March.
(e) Delete all records for employees with an average rating below 4.
Ans (a) SELECT EmployeeID, AVG(Rating) AS AverageRating
FROM Performance
WHERE Month IN ('Jan', 'Feb')
GROUP BY EmployeeID;

(b) SELECT EmployeeID


FROM Performance
ORDER BY RATING

(c) SELECT EmployeeID

PAGE:83
FROM Performance
WHERE Month IN ('Jan', 'Feb')
GROUP BY EmployeeID
HAVING MIN(Rating) >= 4;

(d) UPDATE Performance


SET Rating = Rating + 1
WHERE Month = 'Mar';

(e) DELETE FROM Performance


WHERE EmployeeID IN ( SELECT EmployeeID
FROM Performance
WHERE Month IN ('Jan', 'Feb')
GROUP BY EmployeeID
HAVING AVG(Rating) < 4
);

Q5. Student Enrollment


You are managing a student enrollment database with two tables: "Students" and "Courses."

Students Courses
StudentID FirstName LastName CourseID CourseName
1 Alice Smith 101 Math
2 Bob Johnson 102 History
3 Carol Davis 103 Science

Question: Write SQL queries to perform the following tasks:


(a) Retrieve the total number of students enrolled in each course.
(b) Insert a new the student with following details (Id= 1, Name = Don Bradman)
(c) Retrieve the courses that have not been enrolled in.
(d) Update the last name of student with StudentID 1 to "Brown."
(e) Delete the enrollment record for StudentID 3 in CourseID 103.

Ans (a) SELECT C.CourseName, COUNT(E.StudentID) AS Enrollments


FROM Courses C
LEFT JOIN StudentsEnrollments E ON C.CourseID = E.CourseID
GROUP BY C.CourseName;

(b) INSERT INTO students


VALUES (1, “Don”, “Bradman”)

(c) SELECT C.CourseName


FROM Courses C LEFT JOIN StudentsEnrollments E ON C.CourseID =
E.CourseID
WHERE E.StudentID IS NULL;

(d) UPDATE Students


SET LastName = 'Brown'
WHERE StudentID = 1;

PAGE:84
(e) DELETE FROM StudentsEnrollments
WHERE StudentID = 3 AND CourseID = 103;

Q6. Employee Records


You are managing an employee records database with a single table: "Employees."
Employees
EmployeeID FirstName LastName Department Salary
1 John Doe Sales 50000
2 Jane Smith Marketing 55000
3 Michael Johnson IT 60000
4 Sarah Davis Sales 52000
5 Kevin Lee IT 62000
Question: Write SQL queries to perform the following tasks:
(a) Retrieve the average salary for each department.
(b) Find the department with the highest salary.
(c) Insert a new row in table with suitable data.
(d) Update the salary of John Doe (EmployeeID 1) to 52000.
(e) Delete the employee with the lowest salary.
Ans (a) SELECT Department, AVG(Salary) AS AvgSalary
FROM Employees
GROUP BY Department;

(b) SELECT Department, MAX (Salary)


FROM Employees
(c) INSERT INTO Employees
VALUES (6, “Brain”, “Lara”, “IT”, 92000);

(d) UPDATE Employees


SET Salary = 52000
WHERE EmployeeID = 1;

(e) DELETE FROM Employees


WHERE Salary = ( SELECT MIN (Salary) FROM Employees );
Q7. Online Bookstore : You are managing an online bookstore database with two tables: "Books"
and "Authors."

Books Authors
BookID Title AuthorID Price AuthorID AuthorName
1 To Kill a Mockingbird 1 15.99 1 Harper Lee
2 1984 2 12.49 2 George Orwell
3 The Great Gatsby 3 10.99 3 F. Scott Fitzgerald

Question: Write SQL queries to perform the following tasks:


(a) Retrieve the titles and prices of all books.
(b) Retrieve the names of authors who have books priced at or above 15.00.
(c) Update the price of "1984" (BookID 2) to 13.99.
(d) Delete the book with BookID 3 from the database.
(e) Add a new book titled "Pride and Prejudice" by "Jane Austen" with a price of 14.50.

PAGE:85
Ans (a) SELECT Title, Price
FROM Books;

(b) SELECT A.AuthorName


FROM Authors A
INNER JOIN Books B ON A.AuthorID = B.AuthorID
WHERE B.Price >= 15.00;

(c) UPDATE Books


SET Price = 13.99
WHERE BookID = 2;

(d) DELETE FROM Books


WHERE BookID = 3;

(e) INSERT INTO Books (Title, AuthorID, Price)


VALUES ('Pride and Prejudice', 4, 14.50);

PAGE:86
Name of the chapter : Introduction to Emerging Trends
Topics Covered
• Artificial Intelligence, Machine Learning, Natural Language Processing,
Immersive experience(AR,VR),Robotics,Big data and its characteristics
• Internet of Things(IoT),Sensors,Smartcities,Cloud Computing and Cloud
Services(SaaS, IaaS,PaaS);Grid Computing,Block chain technology.

Key Points

Artificial Intelligence (AI)


Artificial intelligence refers to devices or programmes that resemble human intelligence in
order to carry out tasks and have the ability to iteratively improve themselves based on the
data they gather

Machine Learning
Machine learning is a branch of artificial intelligence that enables computers to learn from
data using statistical methods without explicit human programming. It includes algorithms
that use information to learn on their own and anticipate the future.

Natural Language Processing (NLP)


Natural Language Processing (NLP) It deals with how people and computers communicate
using human spoken languages like Hindi, English, etc. In fact, using our voice to conduct a
web search, use a device, or control another device is achievable.

Virtual Reality – Virtual Reality (VR) is a three-dimensional, computer-generated situation


that simulates the real world. The user can interact with and explore that environment by
getting search immersed in it while interacting with the objects and other actions of the user.

Augmented Reality – The term “augmented reality” refers to the superimposition of


computer-generated perceptual information over the actual physical surroundings (AR).
Consider Pokémon Go as an illustration, where players look for animated characters that
appear in their real-world surroundings on their phone or tablet.

Internet of Things (IoT)


The “Internet of Things” is a collection of interconnected devices that can connect to one
another and exchange data in the same network or you can say, It is a overall network of
interconnected devices as well as the technology that enables communication between them.

Sensors
Sensors are frequently used as monitoring and observing components. The development of
IoT is being greatly aided by the evolution of smart electronic sensors. It will result in the
development of fresh, intelligent systems with sensors.

smart city use the information and communication technologies (ICT), for creating,
implementing, and promoting sustainable development methods to handle the issues of

PAGE:87
expanding urbanization

Cloud Computing
Cloud computing is a new trend where computer-based services are supplied via the Internet
or the cloud and are accessible to the user from any location using any device. C

Grid Computing
Grid computing refers to a network of computers from various administrative domains
cooperating to complete a task. Grid computing enables simple completion of complicated
tasks that may be intractable for a single computer machine.

Artificial Intelligence, Machine Learning, Natural Language Processing, Immersive


experience (AR, VR), Robotics, Big data and its characteristics, Internet of Things (IoT),
Sensors, Smart cities, Cloud Computing and Cloud Services (SaaS, IaaS, PaaS); Grid
Computing, Block chain technology.
15 Objective Question (1 Mark )
Q1. Which of the following is a characteristic of Cloud Computing?
A. Requires physical installation of software
B. On-demand self-service
C. Limited scalability
D. No remote access

Ans B. On-demand self-service


Q2. What is grid computing primarily designed to do?
A. Process data sequentially
B. Connect individual computers into a single supercomputer
C. Manage local area networks
D. Improve internet speed
Ans B. Connect individual computers into a single supercomputer
Q3. What is a block in a blockchain?
A. A unit of digital currency
B. A collection of transactions
C. A type of encryption key
D. A computer algorithm
Ans B. A collection of transactions
Q4. What is Natural Language Processing (NLP)?
A. A programming language used for web development
B. A branch of artificial intelligence focused on the interaction between
computers and human language
C. A specialized type of computer hardware for linguistic tasks
D. A type of human language translation service
Ans B. A branch of artificial intelligence focused on the interaction between
computers and human language.
Q5. Which cloud computing term refers to the practice of using a network of remote
servers hosted on the internet to store, manage, and process data, rather than a
local server or a personal computer?
A. Cloud Storage
B. Cloud Computing
C. Cloud Hosting

PAGE:88
D. Cloud Data
Ans B. Cloud Computing
Q6. What is the main goal of machine learning?
A. To enable computers to make decisions without human intervention
B. To replace human intelligence with artificial intelligence
C. To eliminate the need for data in computer systems
D. To make computers faster and more powerful

Ans A. To enable computers to make decisions without human intervention


Q7. What does "decentralized" mean in the context of blockchain?
A. The technology is managed by a central authority
B. The ledger is distributed across multiple computers or nodes
C. It is only accessible by a single user
D. It is controlled by a single company
Ans B. The ledger is distributed across multiple computers or nodes
Q8. What is the primary difference between Augmented Reality and Virtual
Reality?
A. Augmented Reality adds digital elements to the real world, while Virtual
Reality creates a fully simulated environment.
B. Augmented Reality is only used in the gaming industry, while Virtual
Reality has broader applications.
C. Augmented Reality requires specialized headsets, while Virtual Reality can
be experienced on any device.
D. Augmented Reality is completely independent of the real world, while
Virtual Reality interacts with physical surroundings.

Ans A. Augmented Reality adds digital elements to the real world, while Virtual
Reality creates a fully simulated environment.
Q9. What is Artificial Intelligence (AI)?
A. A type of computer program
B. The ability of machines to perform tasks that typically require human
intelligence
C. A branch of computer hardware engineering
D. A form of virtual reality technology
Ans B. The ability of machines to perform tasks that typically require human
intelligence
Q10. Which of the following best defines the Internet of Things (IoT)?
A. A network of physical devices connected to the internet, capable of
collecting and exchanging data.
B. A virtual reality system for gaming and simulations.
C. A system of interconnected computer servers used for data storage.
D. A type of advanced computer programming language.

Ans A. A network of physical devices connected to the internet, capable of collecting


and exchanging data.
Q11 What is one potential benefit of widespread IoT implementation?
• A. Reduced need for cybersecurity measures
• B. Increased energy efficiency and resource conservation
• C. Decreased reliance on cloud computing

PAGE:89
• D. Limited accessibility to data and information
Ans B. Increased energy efficiency and resource conservation

Q12 Which of the following is a characteristic of AI?


A. It only works in controlled laboratory environments
B. It can learn and adapt from experience
C. It is limited to a specific set of pre-programmed tasks
D. It is exclusively used for playing video games

Ans B. It can learn and adapt from experience


Q13 Which cloud service model provides applications over the internet on a
subscription basis?
A. Infrastructure as a Service (IaaS)
B. Platform as a Service (PaaS)
C. Software as a Service (SaaS)
D. Function as a Service (FaaS)

Ans C. Software as a Service (SaaS)


Q14 What is the primary goal of robotics?
A. To create artificial intelligence capable of human-level cognition
B. To build machines that can perform tasks or functions autonomously
C. To develop virtual reality environments for simulation purposes
D. To study the history of mechanical engineering
Ans B. To build machines that can perform tasks or functions autonomously
Q15 What does "algorithm" refer to in the context of AI?
A. A specific type of computer hardware used in AI
B. A sequence of steps or rules followed by a computer to perform a task
C. A type of virtual reality headset used in AI simulations
D. A visual representation of data in AI systems

Ans B. A sequence of steps or rules followed by a computer to perform a task


05 Assertion and reason Based question ( 1 Mark )

(a) Both A and R are true and R is the correct explanation for A
(b) Both A and R are true and R is not the correct explanation for A
(c) A is True but R is False
(d) A is false but R is True
Q1. Assertion: Cloud computing reduces the need for physical infrastructure and on-
premises hardware.
Reasoning: In cloud computing, resources are hosted and managed by cloud service
providers, eliminating the need for organizations to maintain their own physical
servers and hardware.

Ans (a) Both A and R are true and R is the correct explanation for A
Q2. Assertion: IoT devices are interconnected physical objects capable of collecting and
exchanging data over a network.
Reasoning: IoT enables devices to communicate and share information, leading to
increased automation and efficiency in various domains.

PAGE:90
Ans (a) Both A and R are true and R is the correct explanation for A .

Q3. Assertion: Natural Language Processing (NLP) is an application of Artificial


Intelligence.
Reasoning: NLP involves enabling computers to understand, interpret, and generate
human language.

Ans (a) Both A and R are true and R is the correct explanation for A

This statement is true. NLP is a field within AI that focuses on enabling computers to
process and understand human language, including tasks like language translation,
sentiment analysis, and chatbots.
Q4. Assertion: Public blockchains allow anyone to participate in the network and
validate transactions.
Reasoning: In public blockchains, nodes compete to validate transactions through a
process called mining.

Ans (a) Both A and R are true and R is the correct explanation for A
This statement is true. Public blockchains are open and permission less, allowing
anyone to join the network, validate transactions, and participate in consensus
mechanisms like Proof of Work (mining) to secure the network.
Q5. Assertion: Software as a Service (SaaS) delivers electricity over the internet on a
subscription basis.
Reasoning: SaaS applications are hosted and maintained by a service provider,
eliminating the need for users to install or manage the software locally.

Ans (d) A is false but R is True


05 Short Knowledge/Understanding/Application Based Questions (2 Marks)
Q1. What is the significance of Machine Learning in Artificial Intelligence?
Ans Machine Learning is a subset of Artificial Intelligence that focuses on
enabling machines to learn from data and improve their performance on
specific tasks without being explicitly programmed. It allows AI systems to
recognize patterns, make predictions, and learn from experience. Machine
Learning is crucial in building AI models that can adapt to new information
and perform tasks more accurately as they are exposed to more data.
These questions aim to assess your understanding of fundamental concepts in
Artificial Intelligence, including its goals, types of AI, and the role of Machine
Learning.
Q2. What is Machine Learning?
Ans Machine Learning is a subset of AI that involves the development of algorithms that
enable computers to learn from data and improve their performance on specific tasks
without being explicitly programmed.
Q3. Define Robotics and provide an example of a real-world application where
robotics is commonly used.
Ans • Definition: Robotics refers to the interdisciplinary field of engineering and
computer science that focuses on the design, construction, operation, and use
of robots.
• Example Application: Manufacturing Industry - Robots are commonly used

PAGE:91
in manufacturing processes for tasks like welding, assembly, painting, and
packaging.

Q4. What are some common applications of Augmented Reality (AR)?


Ans • Gaming: AR games, like Pokémon Go, use the real world as a backdrop and
superimpose virtual elements for an interactive experience.
• Navigation and Wayfinding: AR can provide visual directions and
information about the user's surroundings in real time, helping with
navigation.
• Education and Training: AR can enhance learning by providing interactive
and immersive educational experiences.
• Retail and E-commerce: AR allows customers to virtually try on clothing,
visualize furniture in their homes, or see products in 3D before making a
purchase.
• Industrial and Maintenance: AR can provide real-time guidance for
technicians during complex tasks, overlaying information on machinery or
equipment.

Q5. How does Grid Computing differ from other computing paradigms like Cluster
Computing or Cloud Computing?
Ans Cloud Computing: Cloud computing involves accessing computing resources (like
servers, storage, databases, networking, etc.) over the internet through a service
provider's infrastructure. It is highly scalable and provides on-demand access to
resources, while grid computing often involves a network of resources contributed by
multiple organizations or entities.
05 Short Knowledge/Understanding/Application Based Questions (3 Marks)
Q1. What are the three primary service models in cloud computing? Provide
examples for each.
Ans 1. Infrastructure as a Service (IaaS):
• Definition: IaaS provides virtualized computing resources over the
internet. Users can rent virtual machines, storage, and networking
resources on a pay-as-you-go basis.
• Example: Amazon Web Services (AWS) Elastic Compute Cloud
(EC2) provides virtual servers (instances) that users can rent to run
applications or host websites. Users have control over the operating
system, software, and network configuration.
2. Platform as a Service (PaaS):
• Definition: PaaS offers a platform that allows developers to build,
deploy, and manage applications without having to worry about the
underlying infrastructure. It provides a framework and environment
for application development.
• Example: Google App Engine allows developers to build, deploy, and
scale applications without managing the underlying infrastructure. It
supports various programming languages like Python, Java, and Go.
3. Software as a Service (SaaS):
• Definition: SaaS delivers software applications over the internet on a
subscription basis. Users can access these applications through a web
browser, without needing to install or maintain them on their local
devices.
• Example: Salesforce is a customer relationship management (CRM)

PAGE:92
platform delivered as a SaaS. Users can access Salesforce through a
web browser to manage customer relationships, sales pipelines, and
more.
Q2. Provide three real-world applications where AI is currently being utilized and
briefly describe how it benefits those applications.
Ans Any three valid examples.

Q3. What is Augmented Reality (AR) and how does it differ from Virtual Reality
(VR)?
Ans • Augmented Reality (AR): AR is a technology that overlays digital
information, such as images, sounds, or text, onto the real world. This can be
done through devices like smartphones, tablets, or AR headsets. AR enhances
the user's perception of the real world by adding virtual elements.
• Virtual Reality (VR): VR immerses users in a completely virtual
environment. It typically involves the use of a VR headset that completely
covers the user's field of vision, replacing the real world with a computer-
generated environment. VR aims to create a sense of presence, making the
user feel like they are physically present in a different world.

Q4. What is Cloud Computing and how does it differ from traditional computing?
Ans Cloud Computing: Cloud computing refers to the delivery of computing services
(such as storage, processing, networking, databases, etc.) over the internet. It allows
users to access and use resources hosted on remote servers, which are maintained and
managed by a cloud service provider.
Difference from Traditional Computing: In traditional computing, applications and
data are stored and processed on local computers or on-premises servers. In contrast,
cloud computing offloads these tasks to remote servers, providing scalability,
accessibility, and cost-efficiency benefits.

Q5. What is the purpose of Natural Language Processing (NLP) in AI?


Ans Natural Language Processing (NLP) is a branch of AI that focuses on enabling
computers to understand, interpret, and generate human language. It allows machines
to interact with and process text or speech data, enabling tasks like language
translation, sentiment analysis, and chatbot interactions.02 Marks
Valid e.g1 mark
05 Short Knowledge/Understanding/Application Based Questions (4 Marks)

Q1. Define Blockchain and explain its key characteristics.


Ans Blockchain is a decentralized and distributed digital ledger technology that records
transactions across multiple computers in a way that ensures security, transparency,
and immutability.
Key Characteristics:
1. Decentralization: No single entity or authority has control over the entire
blockchain network.
2. Distributed Ledger: The ledger is maintained by a network of nodes, and
every participant has a copy of the entire ledger.
3. Immutability: Once a transaction is added to the blockchain, it cannot be
altered or deleted.
4. Transparency: All transactions are visible to all participants in the network.
5. Security: Blockchain uses cryptographic techniques to secure transactions

PAGE:93
and prevent unauthorized alterations.

Q2. Discuss one potential challenge or limitation in the field of AI and propose a
possible solution to address it.
Ans One potential challenge in the field of AI is the issue of bias and fairness. When these
biases are not addressed, AI models can perpetuate and even amplify existing social,
cultural, or economic inequalities. This can result in discriminatory outcomes,
particularly in sensitive areas like hiring, lending, or criminal justice.

Proposed Solution:
1. Diverse and Representative Training Data:
2. Bias Detection and Mitigation:
3. Transparent and Explainable Models:
4. Diverse Development Teams:
5. Ongoing Monitoring and Evaluation:
6. User Feedback and Accountability:
7. Regulations and Standards:

Q3. What are the key advantages of Grid Computing?


Ans 1. Resource Sharing: Grid computing allows organizations to share resources
across different locations, optimizing resource utilization and reducing the
need for excess capacity.
2. Cost Efficiency: By pooling resources, organizations can save costs
associated with maintaining dedicated infrastructures for specific tasks.
3. High Performance and Scalability: Grids can provide significant
computational power by harnessing the combined capabilities of multiple
machines, making it suitable for large-scale, computationally intensive tasks.
4. Flexibility and Load Balancing: Grid systems can dynamically allocate
resources based on demand, ensuring optimal performance and balancing
workloads.
5. Fault Tolerance: Grids often incorporate redundancy and failover
mechanisms to ensure continued operation even in the event of hardware
failures.

Q4. What are the key characteristics of cloud computing?


Ans 1. On-Demand Self-Service: Users can provision and manage computing
resources as needed, without requiring human intervention from the service
provider.
2. Broad Network Access: Cloud services can be accessed over the internet via
various devices like laptops, smartphones, tablets, etc.
3. Resource Pooling: Cloud providers use multi-tenant models, where resources
are pooled together and shared among multiple users, ensuring efficient
resource utilization.
4. Rapid Elasticity: Cloud resources can be rapidly scaled up or down based on
demand. This allows for flexibility in resource allocation.
5. Measured Service: Cloud resources usage can be metered, monitored, and
billed based on actual usage. This provides transparency and cost control for
users.

PAGE:94
Q5. What is a blockchain and how does it ensure security and transparency in transactions?
Provide an example scenario.
Ans Blockchain Definition:
Security and Transparency:
1. Cryptography: Transactions are secured using cryptographic techniques. Each
transaction is verified and recorded in a way that makes it extremely difficult to alter
or forge.
2. Decentralization: The ledger is maintained by a network of nodes (computers)
rather than a central authority. This decentralization reduces the risk of a single point
of failure or malicious attack.
3. Consensus Mechanisms: Blockchain networks use consensus algorithms (e.g.,
Proof of Work, Proof of Stake) to validate and agree on the state of the ledger. This
ensures that all nodes agree on the validity of transactions.
Example Scenario: Consider a scenario where Alice wants to send 5 Bitcoins to Bob using a
blockchain-based cryptocurrency. When Alice initiates the transaction, it is broadcasted to
the network. Miners validate the transaction using cryptographic algorithms, and once
verified, the transaction is grouped with others into a block.
This block is then added to the blockchain, creating a permanent record of the transaction.
The ledger is updated across all nodes in the network, providing transparency. If anyone
attempts to alter the transaction, it would require the consensus of a majority of nodes,
making it computationally infeasible.

05 Case Based Questions (5 Marks)

Q1. ABC Corporation implemented an AI-powered chatbot to enhance their customer service
experience. The chatbot uses Natural Language Processing (NLP) to understand customer
queries and provide relevant responses. It is designed to handle common inquiries, such as
order status, product information, and troubleshooting.
Question 1: What technology does the chatbot in this case study primarily rely on?
A) Machine Learning
B) Natural Language Processing (NLP)
C) Computer Vision
D) Neural Networks
Question 2: What is the main purpose of implementing the chatbot?
A) Enhance customer service
B) Streamline internal communication
C) Monitor employee performance
D) Improve product development
Question 3: What type of inquiries is the chatbot designed to handle?
A) Technical support only
B) Common inquiries
C) Legal inquiries
D) Marketing inquiries
Question 4: How does the chatbot understand and respond to customer queries?
A) Through complex algorithms
B) By analyzing facial expressions
C) Using Natural Language Processing (NLP)
D) By accessing external databases
Question 5: What is one potential benefit of using a chatbot in customer service?
A) Decreased customer satisfaction
B) Reduced response time

PAGE:95
C) Limited scalability
D) Increased manual workload

Ans Solution 1: B) Natural Language Processing (NLP)


Solution 2: A) Enhance customer service
Solution 3: B) Common inquiries
Solution 4: C) Using Natural Language Processing (NLP)
Solution 5: B) Reduced response time

Q2. ABC Web Services, a web hosting company, transitioned their hosting infrastructure
to the cloud. They chose a cloud provider known for its reliability and scalability.
This allows ABC Web Services to easily handle fluctuations in website traffic and
provide a seamless experience for their clients.
MCQ Questions:
Question 1: Why did ABC Web Services transition their hosting infrastructure to the
cloud?
A) To reduce website traffic
B) To handle fluctuations in website traffic and provide scalability
C) To limit their hosting options
D) To decrease reliability
Question 2: What is one benefit of using a reliable cloud provider for web hosting?
A) Limited scalability options
B) Reduced accessibility
C) Ability to handle fluctuations in website traffic
D) Decreased security
Question 3: How does cloud hosting help ABC Web Services with scalability?
A) It restricts website traffic
B) It allows for easy adjustment of resources based on demand
C) It limits the number of websites hosted
D) It does not affect scalability
Question 4: What is one potential benefit of using cloud hosting for web services?
A) Limited control over resources
B) Inability to handle fluctuations in traffic
C) Improved website performance and reliability
D) Higher costs compared to traditional hosting
Question 5: What is one consideration ABC Web Services should have regarding
data security when using cloud hosting?
A) No need to worry about data security
B) Ensuring proper security measures and encryption are in place
C) Ignoring data security concerns
D) Reliance solely on the cloud provider for security
Ans Solution 1: B) To handle fluctuations in website traffic and provide scalability
Solution 2: C) Ability to handle fluctuations in website traffic
Solution 3: B) It allows for easy adjustment of resources based on demand
Solution 4: C) Improved website performance and reliability
Solution 5: B) Ensuring proper security measures and encryption are in place
Q3. ABC Corporation, a global food distributor, implemented a blockchain-based supply chain
solution. The system tracks the journey of food products from the farm to the consumer's
table. Each step of the process, including harvesting, processing, packaging, and
transportation, is recorded on the blockchain. This provides consumers with transparent and
verifiable information about the origin and handling of the food they consume.

PAGE:96
MCQ Questions:

Question 1: What is the primary purpose of implementing blockchain in ABC Corporation's


supply chain?
A) To decrease transparency in the supply chain
B) To provide consumers with transparent and verifiable information about the origin
and handling of food products
C) To limit the tracking of food products
D) To reduce the efficiency of the supply chain
Question 2: How does the blockchain system record information in this supply chain?
A) By storing physical labels on food products
B) By recording each step of the process on the blockchain
C) By encrypting data on a central server
D) By using a centralized database
Question 3: What benefit does the blockchain-based system provide to consumers?
A) Limited information about the origin of food products
B) Transparent and verifiable information about the journey of food products
C) Reduced accessibility to information
D) Decreased trust in the supply chain
Question 4: What is one potential advantage of using blockchain in the food supply chain?
A) Decreased consumer trust
B) Enhanced traceability and accountability in the supply chain
C) Limited access to information
D) Increased inefficiency in tracking products
Question 5: What type of data is primarily recorded on the blockchain in this case study?
A) Financial transactions
B) Information about the origin and handling of food products
C) Personal identification information
D) Entertainment content
Ans Solution1 : B) To provide consumers with transparent and verifiable information
about the origin and handling of food products
Solution 2: B) By recording each step of the process on the blockchain
Solution3 : B) Transparent and verifiable information about the journey of food products
Solution 4: B) Enhanced traceability and accountability in the supply chain
Solution 5: B) Information about the origin and handling of food products
Q4. ABC Retail, a multinational clothing brand, integrated augmented reality (AR) into their
mobile app. Customers can use the app to virtually try on clothes before making a purchase.
The AR feature superimposes virtual clothing onto the customer's live video feed, allowing
them to see how the clothes fit and look in real-time.
MCQ Questions:
Question 1: What is the main application of AR in ABC Retail's case study?
A) Virtual tour of the store
B) Virtual try-on of clothes
C) Online payments
D) Virtual store navigation
Question 2: How does the AR feature work in the ABC Retail app?
A) By providing a 360-degree view of the store
B) By superimposing virtual clothing onto the customer's live video feed
C) By offering augmented reality games
D) By providing product descriptions
Question 3: What is one benefit of using AR in retail for customers?
A) Limited access to products
B) Ability to virtually try on clothes before purchasing

PAGE:97
C) Reduced interaction with store staff
D) Decreased product variety

Question 4: What is one potential advantage for ABC Retail in implementing AR?
A) Decreased customer engagement
B) Enhanced customer experience and increased conversion rates
C) Reduced use of technology
D) Limited customer interaction
Question 5: What type of technology is primarily used in this case study?
A) Virtual Reality (VR)
B) Augmented Reality (AR)
C) Mixed Reality (MR)
D) Artificial Intelligence (AI)
Ans Solution 1: B) Virtual try-on of clothes
Solution 2: B) By superimposing virtual clothing onto the customer's live video feed
Solution 3: B) Ability to virtually try on clothes before purchasing
Solution 4: B) Enhanced customer experience and increased conversion rates
Solution 5: B) Augmented Reality (AR)
Q5. XYZ Consulting, a small business, decided to migrate their data storage to the cloud. They
opted for a popular cloud storage service that offers secure, scalable, and cost-effective
storage solutions. The cloud storage allows XYZ Consulting to access their files from
anywhere with an internet connection and enables easy collaboration among team members.
MCQ Questions:
Question 1: What is one benefit of using cloud storage for XYZ Consulting?
A) Limited access to files
B) Scalable and cost-effective storage
C) Restricted collaboration options
D) Dependence on physical hardware
Question 2: Why did XYZ Consulting choose to migrate their data storage to the cloud?
A) To decrease accessibility
B) To limit collaboration
C) To access files from anywhere with an internet connection
D) To increase dependence on physical hardware
Question 3: What is a key advantage of using a cloud storage service?
A) Decreased security
B) Limited storage capacity
C) Easy collaboration among team members
D) Higher costs compared to physical storage
Question 4: How does cloud storage benefit XYZ Consulting in terms of scalability?
A) It provides limited storage options
B) It allows for easy expansion of storage capacity as needed
C) It restricts access to files
D) It does not affect storage capacity
Question 5: What is one potential risk of relying solely on cloud storage?
A) Limited accessibility to files
B) Dependency on physical hardware
C) Data security concerns
D) Difficulty in collaboration
Ans Solution 1: B) Scalable and cost-effective storage
Solution 2: C) To access files from anywhere with an internet connection
Solution 3: C) Easy collaboration among team members
Solution 4: B) It allows for easy expansion of storage capacity as needed
Solution 5: C) Data security concerns

PAGE:98

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy