0% found this document useful (0 votes)
29 views

Notes XI IP With Question Bank 123

Notes of IP

Uploaded by

Sumit Shekher
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

Notes XI IP With Question Bank 123

Notes of IP

Uploaded by

Sumit Shekher
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 135

के न्द्रीय विद्यालय सगं ठन, जयपरु सभं ाग

KENDRIYA VIDYALAYA SANGATHAN, JAIPUR REGION

सत्र – 2022-23

कक्षा 11 - अध्ययन सामग्री


CLASS XI - STUDY MATERIAL

इन्फोमेटिक्स प्रेटक्िस
INFORMTICS PRACTICES
CHIEF PATRON

Ms. Nidhi Pandey, IIS


Commissioner
Kendriya Vidyalaya Sangathan

PATRON

Mr. B. L. Morodia
Deputy Commissioner
KVS Regional Office, Jaipur

MENTORS

Mr. Digg Raj Meena Mr. M. R. Rawal


Assistant Commissioner Assistant Commissioner
KVS Regional Office, Jaipur KVS Regional Office, Jaipur
Our Team

Coordinator
Mr. Manoj Kumar Pandey,
Principal,
Kendriya Vidyalaya Itarana, Alwar

Members

S.No. Name of Teacher Designation Kendriya Vidyalaya


1 Mr. Sandeep Sharma PGT (CS) No.1, Kota
2 Mr. Navneet Sadh PGT (CS) Churu
3 Mr. Aakib Javed PGT (CS) BSF Jodhpur
4 Mr. Sandeep Arora PGT (CS) No.1, Udaipur
5 Mr. Satish Jangid PGT (CS) No.3, Jaipur
6 Mr. Narayan Mali PGT (CS) No.1, Udaipur
7 Mr. Rajesh Dwivedi PGT (CS) Jalore
Unit Wise syllabus
Distribution of Marks

Unit No. Unit Name Marks


1 Introduction to Computer System 10
2 Introduction to Python 25
3 Database concepts and the Structured Query Language 30
4 Introduction to the Emerging Trends 5

Unit 1: Introduction to Computer System


Introduction to computer and computing: evolution of computing devices, components of a computer
system and their interconnections, Input/output devices.
Computer Memory: Units of memory, types of memory – primary and secondary, data deletion, its recovery
and related security concerns.
Software: purpose and types – system and application software, generic and specific purpose software.

Unit 2: Introduction to Python


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, for loop
Lists: list operations - creating, initializing, traversing and manipulating lists, list methods and built-in
functions.
Dictionary: concept of key-value pair, creating, initializing, traversing, updating and deleting elements,
dictionary methods and built-in functions.

Unit 3: Database concepts and the Structured Query Language


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 database using MySQL, Data
Types
Data Definition: CREATE TABLE
Data Query: SELECT, FROM, WHERE.
Data Manipulation: INSERT

Unit 4: Introduction to the Emerging Trends


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.
XI IP CBSE BLUEPRINT 2022-23
Marks Section

Weightage
Unit and Topic 1 2 3 5 4 A B C D E

Unit 1: Introduction to Computer


10
System
Introduction to computer and
computing,evolution of computing
devices, components of a computer 1 1 3 1 21
system and their interconnections,
Input/output devices.
Computer Memory:Units of memory,
types of memory – primary and 1 1 3 7 25
secondary, data deletion, its recovery and
related security concerns.
Software: purpose and types – system
and application software, generic and 1 1 4 10 26
specific purpose software.

Unit 2: Introduction to Python 25


Basics of Python programming, Python
interpreter - interactive and script mode,
the structure of a program, indentation,
1 2 24
identifiers, keywords, constants,
variables, types of operators, precedence
of operators.

data types, mutable and immutable data


types, statements, expressions, evaluation 1 1 4 2 27
and comments, input and output
statements, data type conversion,
debugging.

Control Statements: If-elif-else, while and 1 19


1 1 1 6 28
for loop, break,continue and pass. 7 19

Lists: list operations - creating,


initializing, traversing and manipulating 1 1 1 7 6 22 34
lists, list methods and functions.
1 1 6 12 31
Dictionary:concept of key-value pair,
creating, initializing, traversing, updating
and deleting 31
elements, dictionary methods and built-in
functions.
Unit 3: Database concepts and the 30
Structured Query Language
Database Concepts: Introduction to 3
database concepts and its need, Database 2 2
Management System. 14

Relational data model: Concept of 9


domain, tuple, relation, candidate key, 2 2
primary key, alternate key 15
MySQL Intro:Advantages of using
Structured Query Language, Data 11 30
Definition Language, Data Query
Language and Data Manipulation 2 1 5
Language, Introduction to MySQL,
16 30
creating a database using MySQL , Data
Types

DDL:CREATE TABLE 1 1 1 8 5 20 32
DQL: SELECT, FROM, WHERE. 1 1 6 13 23 33

DML: INSERT 1 1 1 7 8 23 33 35
Unit 4: Introduction to the Emerging 5
Trends
Artificial Intelligence, Machine Learning,
Natural Language Processing, Immersive 4 29
experience (AR, VR), Robotics, Big data
and its characteristics,.
2 1 5
Internet of Things (IoT), Sensors, Smart
cities, Cloud Computing and Cloud 18 29
Services (SaaS, IaaS, PaaS); Grid
Computing, Block chain technology.
NUMBER OF QUESTION 18 7 5 3 2 35

TOTAL MARKS 18 14 15 15 8 70
Unit 1: Introduction to Computer System
- Introduction to computer and computing: evolution of computing devices,
components of a computer system and their interconnections, Input/output
devices.
- Computer Memory: Units of memory, types of memory – primary and secondary,
data deletion, its recovery and related security concerns.
- Software: purpose and types – system and application software, generic and
specific purpose software.

1.1 Introduction to Computer System


The word originates from the Latin word “Computare” which means “to calculate”.
Earlier computers were used as calculating devices.
A computer is an electronic device that accepts data as input from users and gives the
output after processing them.

1.2 Evolution of computing devices


As mentioned at the beginning earlier computers were used to perform simple
calculations. Some of the early calculating devices also one of the important factors of
Introduction to Computer System, and they are as follows:

Abacus
It was the first calculating device with wooden frames along with beams sliding
on wires. It was used to perform basic arithmetic operations such as addition,
subtraction, multiplication, and division. It is also used to teach at early age
schools to count numbers.

Napier’s Bones
It was made by a Scottish mathematician named Sir John Napier in 1616. It had
numbers carved on bones or strips of wood. It was also used for simple
calculations. In addition to this it was used for calculating the root of the number.

Pascaline
It was invented by Blaise Pascal a French mathematician in 1641. It was the first
mechanical calculator. It has a rectangular box with movable wheels. It was also
used for simple calculations up to hundreds and thousands.

Difference Engine
It was invented by Charles Babbage in the Nineteenth Century. It was used to
prepare mathematical tables.

Analytical Engine
It was considered as the first-generation computer invented by Charles Babbage.
It had some basic elements such as input, output, and memory devices.

1.3 Generations of computers – Computer evolution started with technology evolution.


Each and every generation used different components in computers for storage of data,
performing the tasks. There are five generations of computers:

Note: There are variations in generation duration by different sources.


First Generation Computers
● First generations of computers were very large in size as well as less
memory storage.
● It was very expensive at that time.
● To input data, there were punch cards and paper tape.
● Vacuum Tubes were used to store data in this generation of computers.
● Ex.
○ Mark – I was developed by Howard H. Aiken, ENIAC (Electronic
Numerical Integrator and Computer) developed by John Presper
Eckert and John W. Mauchly.
○ EDSAC(Electronic Delay Storage Automatic Calculator)
developed by professor M. Wilkes of Cambridge University,
○ UNIVAC I(Universal Automatic Computer) developed by J.
Presper Eckert and John Mauchly.

Second Generation Computers


● They were small in size compared to the first generation’s computers.
● Transistors were used to store data on these computers.
● Punch cards were used for input.
● Ex. IBM 1401 and RCA 501

Third Generation Computers


● They were smaller in size, faster, cheaper, and efficient than earlier ones.
● They used Integrated Circuits (ICs) and
● Keyboard to input.
● They used monitors to display output.
● Ex. IBM 360 series and 370 Series

Fourth Generation Computers


● They are the modern computers we use today.
● They have microprocessors consisting of ICs (VLSI) on a single chip called
CPU.
● They have more storage power and computing power.
● Ex. IBM PC , Apple Macintosh, Dell, HP etc

Fifth Generation Computers


● They have high storage capacity, high speed, and are capable of
performing sophisticated tasks.
● They involve Artificial Intelligence for computing.
● Wearables
● IOT Devices

1.4 Computer system interconnection


Since a computer follows Input-Process-Output cycle, thus components of computer are
categorized in three parts:

1. Input Devices
2. Central Processing Unit
3. Output Devices
The basic component structure of computer is as shown below:

As shown in the diagram , various parts of the computer interact together to make the
computer work. You input data to the computer by using input devices and the CPU acts
upon this data and provides output which is made available to the user by using the
output device.

Input devices
Input device is responsible for taking input from the user and providing it to the
computer. Some most commonly used input devices are
● Keyboard
● Mouse
● Microphone
● Webcam
● Scanner
● Barcode reader
● Light pen
● Joystick

Output devices
Output device is responsible for providing and displaying output to the user.
Some most commonly used output devices are:
● Monitor- LED Monitor, LCD Monitor, CRT Monitor
● Printer- Impact Printer (Inkjet, Dot-Matrix), Non-Impact Printer
(Laser, Inkjet)
● Plotter
● Speaker

CPU (Central Processing Unit)


The CPU is the control centre of the computer. It understands the instructions
and carries out operations on the computer accordingly. It is the brain of a
computer and controls the activity performed by the computer.
The CPU has three components:
● ALU (Arithmetic and Logical Unit)
● MU (Memory Unit)
● CU (Control Unit)

ALU (Arithmetic and Logical Unit) ALU is a component which is responsible for
all the arithmetic or logical operations done on the data. Arithmetic operations are
the basic mathematical calculations. Logical operations are basically comparison
operations involving comparing data.
CU (Control Unit) The control unit is a component which controls the flow of
data and operations in a computer. It acts as a manager and instructs and
coordinates all the components of the CPU to perform their respective task.

1.5 MU (Memory Unit) Memory unit is a component which is responsible


for storing all data and information and instructions. Memory of a
computer is more like a predefined working space where it temporarily
keeps information and data to facilitate its performance. When the task is
performed, it clears its memory and memory space is then available for the
next task to be performed. This memory is often called the main memory.
There are two types of memory: Primary and secondary memory

Primary Memory: Primary memory also known as VOneertile memory that is


temporary as it loses its contents when the computer’s power is turned off. It is internal
memory that is accessed directly by the processor. Following are the Primary memory:

- RAM: Random Access Memory is the memory that the computer uses for storing
the programs and their data while working on them. We can either read data
from the RAM or write onto it. Hence it is called read/write memory.

- ROM: Read Only Memory is used to store the data about the hardware which
does not require frequent updates, for example startup programs that load
Operating System into RAM. ROM is non-vOneertile memory. We can only read
data from the ROM and hence called read only memory.

- Cache Memory: Catch memory is very high speed memory which is placed
between processor and RAM to speed up the operations of CPU. Generally it
stores the copies of data frequently accessed from RAM.

Secondary Memory: Secondary memory also known as non-vOneertile memory stores


data and instructions permanently for future use. It is slower than primary memory but
cannot be accessed by the processor directly.
Example of Secondary Memory are :
● Hard Disk
● CD/DVD
● USB Flash Drive
● Memory Card
● Memory Unit

bit(b) is the smallest unit of memory. A bit can either have 1 or 0.


Byte(B) is a unit of memory used to measure the amount of space consumed by data or
instructions in memory. 8 bits 1 Byte
Nibble: 4 bits1 nibble

Memory size conventions


1 Kilobyte - 1024 Bytes
1 Megabyte - 1024 KB
1 Gigabyte - 1024 MB
1 Terabyte - 1024GB
1 Petabyte - 1024 TB
1 Exabyte - 1024 PB
1.6 Data:
- Data Capturing: Data capturing refers to the process of collecting or inputting
data from different sources. To input data different input devices can be used
such as keyboard, scanner, camera, bar code reader etc. data capturing might be
a complex process due to nonuniformity in data.

- Data Storage: Data storage refers to the process of storing captured data for
future use. There are many different types of storage devices available which can
be used to store data. Nowadays due to the rise in computers, Internet and
Technology large volumes of data being produced and hence the storage device
should be of large capacity and updated regularly. to store large amounts of data,
Server can be deployed or Cloud computing can also be used.

- Data Retrieval: Data Retrieval refers to accessing or fetching data from storage
devices as per requirement. Due to the large volume of data nowadays, systems
must have good quality and effective programs in order to access data at
minimum time.

- Deleting data refers to erasing data from storage devices. There can be many
reasons for deleting data such as system crash, accidental deletion, and illegal
deletion by hackers/mischief mongers. When data is deleted from storage media,
only the status (address entry) of data is changed and that space is shown empty
to the user without deleting data actually.

- Data recovery is the process of accessing deleted, lost or corrupted data from
storage devices. Deleted data can only be recovered when memory space of
deleted data has not been overwritten with new data.

- Using Backup: A backup is a utility software to backup specific data before


deletion. Users have to take their data backup at regular intervals to avoid stress
caused by accidental deletion. To restore backup data users must use the restore
tool provided by windows. Users can only restore those data in which backup
has been taken.

The infernal devices: The computer system has the following internal devices:
● Motherboard: The motherboard is a circuit board of the computer system. All
the devices are connected with this board internally or externally. It provides
slots, connectors, and ports to connect devices.
● SMPS: It stands for switch mode power supply. It is attached with a power cable
from outside and connected with the motherboard through a connector.
● Hard Disk: A hard disk is the main storage device of the computer. It is
connected to the slot on the motherboard and to SMPS.
● CPU: The CPU is connected or attached to the CPU socket. On top of the CPU, a
fan is attached to provide cooling to the CPU.
● RAM: RAMs are attached to RAM slots on the motherboard.
● Ports: Ports allow one to attach external devices to the computer. These ports
are generally found at the backside of the cabinet. Ports have either halls or pins
to attach a device.

1.7 Software: Software is a set of programs that instruct hardware to what to and
how to do. It makes hardware functional to achieve a common objective. Some examples
of software are Windows 10, Macintosh, MySQL, MS Word, Excel, Games etc.
Types of software:
1. System software
2. Application software
1. System Software: System software manages computer systems. It is software
that controls and coordinates all internal activities of a computer system.

System software can be categorized as


A. Operating System
B. Utility Software
C. Device Driver

A. Operating System: Operating System acts as an interface between user


and machine. It is set of programs that –
● Manages hardware resources
● Manage memory
● Display result in monitor
● Control all hardware component attached to computer system
● Read data through input devices
● Example: Windows 10, Macintosh, Ubuntu, DOS etc.

B. Utility software: It is system software that helps you to configure and


optimise and maintain a computer. Examples of utility software are- Disk
Cleaner, File Backup Utility, Antivirus, Firewall, Disk Defragmenter etc.

C. Device Driver: Device driver is software which controls a particular type


of hardware attached with a computer. It acts as an interpreter between
particular hardware and computer systems.

2. Application Software: Application Software helps in providing a graphical


user interface to the user to operate the computer for different functionality. The
user may use the computer for browsing the internet, accessing to email service,
attending meetings, and playing games.
Different high-level languages are used to build application software. They
basically lie over system software. They are really utilized by end-user just as have
explicit usefulness or undertakings which they are intended to perform. This
application software is regularly evolved through custom software improvement,
in light of prerequisites of clients.

Types Of Application Software :


1. General Purpose Software
2. Custom Made Software

General Purpose Software :


The Software is developed to serve the requirements of a large number of
people on a daily basis. This software is eventually used on a regular basis
by every user. These are the reasons why this software is cheaper than any
other software. Some of the examples are: MS Word, Google Docs, Google
Drive, Gmail, Netflix

Custom Made Software :


Software which is developed to serve the requirement of the particular
user is defined as custom-made software. Most software companies work
on the basis of the requirement of the user to build custom software. Some
of the examples are:Desktop Software Application, Mobile Application Web
Application, Database Software.
Advantages of Application Software :
- Application Software packages are written by software architects
and the content is of great quality.
- They have large availability and are generally cheaper when
compared to the other packages.
- The application software meets the exact needs of the user, because
they are designed specifically for the single intention of the user, the
user knows that he has to use one specific software to accomplish
his task.

Disadvantages of Application Software :


- Some software that is designed specifically for a certain business,
may not be compatible with other general software because each
software serves a different purpose.
- The development of software is time-consuming because it needs
constant communication between the developer and the customer.
This delays the entire development process, which can lead to more
spending on utilities.
Unit 2: Introduction to Python
- 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, for loop
- Lists: list operations - creating, initialising, traversing and manipulating lists, list
methods and built-in functions.
- Dictionary: concept of key-value pair, creating, initialising, traversing, updating and
deleting elements, dictionary methods and built-in functions.

2.1 Python Fundamentals


1. What is Python:- Python is a general-purpose, high level programming language. It
was created by Guido van Rossum, and released in 1991.
·In order to communicate with a computer system, we need a computer programming
language. This language may be C, C++, Java, Python or any other computer language.
Here we will discuss Python.
·Python is inspired by two languages – (i) ABC language which was an optional language
of BASIC language. (ii)Modula-3
2. Why Python:-
· Platform Independent (Cross-Platform)
· Free and Open Source
· simple syntax similar to the English language.
· fewer lines than some other programming languages. interpreted Language.
· Python can be treated in a procedural way, an object-orientated way. (OOL and POL.)
3. What can Python do?:- It is possible to develop various Apps/ Software’s with Python
like–
· Web development
· Machine learning
· Data Analysis
· Scripting
· Game development.
· Embedded applications
· Desktop applications
4. How To Use Python?:-
4.1 Python can be downloaded from www.python.org. (Standard Installation)
4.2. It is available in two versions- • Python 2.x • Python 3.x (It is in Syllabus)
OR
Apart from above standard Python. We have various Python IDEs and Code Editors. Some
of them are as under:-
(i) Anaconda Distribution:- free and open-source distribution of the Python. having
various inbuilt libraries and tools like jupyter Notebook, Spyder etc
(ii) PyCharm (iii) Canopy
(iv) Thonny (v) Visual Studio Code
(vi) Eclipse + PyDev (vii) Sublime Text
(viii )Atom (ix) GNU Emacs
(x) Vim (xi) Spyder and many more...
5. Python Interpreter - Interactive And Script Mode :-
We can work in Python in Two Ways:-
(i) Interactive Mode
(ii) Script Mode
(i) Interactive Mode:- it works like a command interpreter as shell prompt works in DOS
Prompt or Linux. On each (>>>) symbol we can execute one by one command.
(ii) Script Mode:- it used to execute the multiple instruction (complete program) at once.

6. Python Character Set:-


Character Set is a group of letters or signs which are specific to a language. Character set
includes letter, sign, number and symbol.
· Letters: A-Z, a-z
· Digits: 0-9
· Special Symbols: _, +, -, *, /, (, #,@, {, } etc.
· White Spaces: blank space, tab, carriage return, newline, formfeed etc.
· Other characters: Python can process all characters of ASCII and UNICODE.

7. Python Tokens:-
Token is the smallest unit of any programming language. It is also known as Lexical Unit.
Types of token are
i. Keywords
ii. Identifiers (Names)
iii. Literals
iv. Operators
v. Punctuators

7.1 Keywords:- Keywords are reserved words. Each keyword has a specific meaning to
the Python interpreter. As Python is case sensitive, these cannot be used as identifiers,
variable name or any other purpose keywords must be written exactly as given below:-

7.2 Identifiers:- In programming languages, identifiers are names used to identify a


variable, function, or other entities in a program. The rules for naming an identifier in
Python are as follows:
· The name should begin with an uppercase or a lowercase alphabet or an underscore
sign (_).
· This may be followed by any combination of characters a-z, A-Z, 0-9 or underscore
(_). Thus, an identifier cannot start with a digit.
· It can be of any length. (However, it is preferred to keep it short and meaningful).
· It should not be a keyword or reserved word.
· We cannot use special symbols like !, @, #, $, %, etc. in identifiers.

Legal Identifier Names Example: myvar my_var _my_var myVar myvar2


Illegal Identifier Names Example:- 2myvar my-var my var=

7.3 Literals/ Values:- Literals are often called Constant Values. Python permits following
types of literals -
a. String literals - “Rishaan”
b. Numeric literals – 10, 13.5, 3+5i
c. Boolean literals – True or False
d. Special Literal None
e. Literal collections
7.4 Operators:- An operator is used to perform specific mathematical or logical
operations on values. The values that the operator works on are called operands. Python
supports following types of operators -
Unary Operator
•Unary plus (+)
•Unary Minus (-)
•Bitwise complement (~)
•Logical Negation (not)
Binary Operator
•Arithmetic operator (+, -, *, /, %, **, //)
•Relational Operator(<, >, <=, >=, ==,!)
•Logical Operator (and, or)
•Assignment Operator (=, /=, +=, -=, *=, %=, **=, //=)
•Bitwise Operator (& bitwise and, ^ bitwise xor,|bitwise or)
•Shift operator (<< shift left, >> shift right)
•Identity Operator (is, is not)
•Membership Operator (in, not in)
7.5 Punctuators:-
Punctuators are symbols that are used in programming languages to organize sentence
structure, and indicate the rhythm and emphasis of expressions, statements, and
program structure. Common punctuators are: „ “ # $ @ []{}=:;(),

8. Variable:-
· Variables are containers for storing data values.
· Unlike other programming languages, Python has no command for declaring a
variable.
· A variable is created the moment you first assign a value to it.
Example:-
x5
y "John"
print(x)
print(y)
· Variables do not need to be declared with any particular type and can even change
type after they have been set.
x 4 # x is of type int
x "Sally" # x is now of type str
print(x)
· String variables can be declared either by using single or double quotes:
x "John"
# is the same as
x 'John'

Variable Names
A variable can have a short name (like x and y) or a more descriptive name (age, carname,
total_volume).
Rules for Python variables:
· A variable name must start with a letter or the
· underscore character
· A variable name cannot start with a number
· A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )
· Variable names are case-sensitive (age, Age and AGE are three different variables)

Output Variable:-
The Python print statement is often used to output variables. To combine both text and a
variable, Python uses the , character:
x "awesome"
print("Python is " , x)
Display Multiple variable:-
x "awesome“
y=56
print(“Value of x and y is=" ,x,y)

9. Data Type:-
Every value belongs to a specific data type in Python. Data type identifies the type of data
which a variable can hold and the operations that can be performed on those data.

Data Types in Python:-


· Numbers :- int, float and complex.
· List :- [5, 3.4, "New Delhi", "20C", 45]
· Tuple :- (10, 20, "Apple", 3.4, 'a')
· Strings :- str 'Hello Friend'
· Set:- {2,6,9}
· Dictionary:- {'Fruit':'Apple', 'Climate':'Cold', 'Price(kg)':120}

Mutable and Immutable data type


Mutable:- The values stored can be changes, Size of object can be changed, e.g. List,
Dictionary
Immutable:- The value stored can not be changed, Size can not be changed, e.g. Tuple,
String

10. Expression in python:- An expression is a combination of values, i.e., constant ,


variable and operator.
e.g. Expression 6-3*2+7-1 evaluated as 6

11. Precedence and associativity of Arithmetic Operators:- Precedence and


associativity helps to evaluate an expression. Let’s take a look with following example:

Operator Description Associativity

() Parentheses left-to-right

** Exponent right-to-left

* / % Multiplication/division/modulus left-to-right

+ – Addition/subtraction left-to-right

<< >> Bitwise shift left, Bitwise shift right left-to-right

< <= Relational less than/less than or equal to


left-to-right
> >= Relational greater than/greater than or equal to
== != Relational is equal to/is not equal to left-to-right

is, is not Identity


left-to-right
in, not in Membership operators

& Bitwise AND left-to-right

^ Bitwise exclusive OR left-to-right

| Bitwise inclusive OR left-to-right

not Logical NOT right-to-left

and Logical AND left-to-right

or Logical OR left-to-right

= Assignment
+= -= Addition/subtraction assignment
*= /= Multiplication/division assignment
right-to-left
%= &= Modulus/bitwise AND assignment
^= |= Bitwise exclusive/inclusive OR assignment
<<= >>= Bitwise shift left/right assignment
12. Comments in python:- Comments are non-executable statements of python. It
increases the readability and understandability of code.
Types of comment –

i. Single line comment (#) – comments only on a single line.


e.g. a=7 # 7 is assigned to variable ‘a’
print(a) # displaying the value stored in ‘a’
ii. Multi-line comment (‘‘‘………..’’’) – Comments multiple line.
e.g. ‘‘‘Program -1
A program in python to store a value in
variable ‘a’ and display the value stored in it.’’’
a=7
print(a)

13. Input and output in python:-

input ( ) method - It is used to take input from the user.

print ( ) method – It is used to display messages or result in output.

Example:-
Name input (“Enter your name : ”)
Marks int(input (“Enter your marks ”))
print(“Your name is ”, Name)
print(“You got ”, Marks, “ marks”)

14. Debugging:- Debugging is a process of locating and removing errors from a program.
Types of errors:
a. Compile Time Error: (i) Syntax Error (ii) Semantics Error
b. Run Time Error
c. Logical Error

a. Compile Time Error: Compile time errors are those errors that occur at the time of
compilation of the program. There are two types of compile time errors:
i. Syntax Error: These errors occur due to violation of grammatical rules of a
programming language.
Example:
x=10
y=20
if(x<y):
Print(“a is greater than b”) # Syntax error, P is capital in Print statement

b. Semantics Error: Semantic errors occur when the statements written in the
program are not meaningful.
Example:
a=10
b=20
a+b = c # expression cannot come on the left side of the assignment operator

b. Run Time Error: Errors that occur during the execution or running the program are
known as run time errors. When a program “crashes” or “abnormally terminated” during
the execution, then these type errors are run time errors.
Example: When a loop executes infinite time.
a=1
while a<5: # value of a is always less than 5, infinite loop
print(a)
a=a-1

c. Logical Error: These types of errors occur due to wrong logic. When a program
successfully executes but giving wrong output, then it is known as logical error.
Example:
a=10
b=20
c=30
average=(a+b+c)/2 # wrong logic to find the average
print(average)
OUTPUT:
30.0

Steps to debug a program:


a. Carefully follow the syntax of a language
b. Spot the origin of error
c. Read the type of error and understand it well
d. Use intermediate print statements to know the value and type of a variable
e. Trace the code carefully
Note: There are debuggers available in almost all sophisticated python IDEs. They are
implemented with pdb. To know more, read the official documentation here:
https://docs.python.org/3/library/pdb.html

15. Supplementary Reading:


Exception handling in python: (To deal with run time errors/exceptions)
Exception: The unusual and unexpected condition other than syntax or logical errors,
encountered by a program at the time of execution, is called exception.

The purpose of the exception handling mechanism is to provide means to detect and
report an exceptional circumstance, so that appropriate action can be taken.
Exception handling in python can be done using try and except blocks.

Syntax:
try:
# Code that may generate an exception
except:
# Code for handling the exception

Example:
num1=int(input(“Enter first number :”))
num2=int(input(“Enter second number: “))
try:
r=num1/num2
print(“Result is :”, r)
except:
print(“Divided by zero”)

OUTPUT:
Enter first number : 30
Enter second number: 0
Divided by zero
2.2 Python Control Statements
In any programming language a program may execute sequentially, selectively or
iteratively. Every programming language provides constructs to support Sequence,
Selection and Iteration. In Python all these constructs can broadly be categorised in 2
categories.

Conditional Control Construct


( Selection, iteration)

Unconditional Control Construct


(pass, break,continue, exit(), quit())

Python have following types of control statements


1. Selection ( branching) Statement
2. Iteration ( looping) Statement
3. Jumping (break / continue)Statement

Python Selection Statements


Python have following types of selection statements
1. if statement
2. if else statement
3. Ladder if else statement (if-elif-else)
4. Nested if statement

If statements
This construct of a python program consists of one if condition with one block of
statements. When the condition becomes true then executes the block given below it.
Syntax:
if ( condition):
Statement(s)
Example:
age=int(input(“Enter Age: “))
if ( age>=18):
print(“You are eligible for vote”)
if(age<0):
print(“You entered Negative Number”)

if - else statements
This construct of a python program consists of one if condition with two blocks. When
the condition becomes true then executes the block given below it. If the condition
evaluates the result as false, it will execute the block given below else.
Syntax:
if ( condition):
Statement(s)
else:
Statement(s)
Example
age=int(input(“Enter Age: “))
if ( age>=18):
print(“You are eligible for vote”)
else:
print(“You are not eligible for vote”)

Ladder if else statements (if-elif-else)


This construct of a python program consists of more than one if condition. When the first
condition evaluates the result as true then executes the block given below it. If the
condition evaluates the result as false, it transfers the control at the else part to test
another condition. So, it is a multi-decision making construct.
Syntax:
if ( condition-1):
Statement(s)
elif (condition-2):
Statement(s)
elif (condition-3):
Statement(s)
else:
Statement(s)
Example:
num=int(input(“Enter Number: “))
If ( num>=0):
print(“You entered positive number”)
elif ( num<0):
print(“You entered Negative number”)
else:
print(“You entered Zero ”)

Nested if statements
It is the construct where one if condition takes part inside of another if condition. This
construct consists of more than one if condition. Block executes when the condition
becomes false and the next condition evaluates when the first condition becomes true.
So, it is also a multi-decision making construct.
Syntax:
if ( condition-1):
if (condition-2):
Statement(s)
else:
Statement(s)

Example:
num=int(input(“Enter Number: “))
if ( num<=0):
if ( num<0):
print(“You entered Negative number”)
else:
print(“You entered Zero ”)
else:
print(“You entered Positive number”)
Python Iteration Statements
The iteration (Looping) constructs mean to execute the block of statements again and
again depending upon the result of condition. This repetition of statements continues till
condition meets True result. As soon as the condition meets a false result, the iteration
stops.
Python supports following types of iteration statements
1. while
2. for
Four Essential parts of Looping:
i. Initialization of control variable
ii. Condition testing with control variable
iii. Body of loop Construct
iv. Increment / decrement in control variable

Python while loop


The while loop is a conditional construct that executes a block of statements again and
again till the given condition remains true. Whenever the condition meets result false
then loop will terminate.

Syntax:
Initialization of control variable
while (condition):
…………………..
Updation in control variable
..…………………

Example: Sum of 1 to 10 numbers.


num=1
sum=0
while(num<=10):
sum + num
num + 1
print(“The Sum of 1- 10 numbers: “,sum)

Python range( ) Function


The range() function returns a sequence of numbers, starting from 0 by default, and
increments by 1 (by default), and ends at a specified number.

Syntax:
range( start value, stop value, step value )
Where all 3 parameters are of integer type

● Start value is Lower Limit


● Stop value is Upper Limit
● Step value is Increment / Decrement

Note: The Lower Limit is included but Upper Limit is not included in result.
Example
range(5) => sequence of 0,1,2,3,4
range(2,5) => sequence of 2,3,4
range(1,10,2) => sequence of 1,3,5,7,9
range(5,0,-1) => sequence of 5,4,3,2,1
range(0,-5) => sequence of [ ] blank list
(default Step is +1)
range(0,-5,-1) => sequence of 0, -1, -2, -3, -4
range(-5,0,1) => sequence of -5, -4, -3, -2, -1
range(-5,1,1) => sequence of -5, -4, -3, -2, -1, 0

Python for loop


A for loop is used for iterating over a sequence (that is either a list, a tuple, a string etc.)
With for loop we can execute a set of statements, and for loop can also execute once for
each element in a list, tuple, set etc.
Example: print 1 to 10 numbers
for num in range(1,11,1):
print(num, end=” “)
Output: 1 2 3 4 5 6 7 8 9 10

Un- Conditional Control Construct


(pass, break, continue, exit(), quit())

pass Statement (Empty Statement)


The pass statement does nothing, but it is used to complete the syntax of programming
concepts. Pass is useful in the situation where the user does not require any action but
syntax requires a statement. The Python compiler encounters a pass statement then it
does nothing but transfer the control in flow of execution.

Example
a=int(input("Enter first Number: "))
b=int(input("Enter Second Number: "))
if(b==0):
pass
else:
print("a/b=",a/b)

Jumping Statements
● break
● continue

break Statement
The jump- break statement enables you to skip over a part of code that is used in a loop
even if the loop condition remains true. It terminates to that loop in which it lies. The
execution continues from the statement which finds the loop terminated by break.

Continue Statement
Continue statement is also a jump statement. With the help of a continue statement, some
of the statements in the loop skipped over and started the next iteration. It forcefully stop
the current iteration and transfers the flow of control at the loop controlling condition.
2.3 LIST
Definition : A List is a collection of comma separated values within a square bracket.
Items in a list need not to be the same.

Features of list
• A List is used to store a sequence of values / items.
• All Elements of a list are enclosed in [ ] square brackets.
• Items / values are separated by comma.
• Lists are mutable (changeable) in python.

Different type of lists


# List of text
Fruit=['Mango','Orange','Apple']
#List of Characters
Grade=['A','B','C']
# List of integers
Marks=[75,63,95]
# List of floats
Amount=[101.11,125.81,99.99]
# List with different data types
Record=[75,'Mango',101.11]
# List within a List
list1=[2,3,[2,3]]
# List with text splitted into chars
list2=list('IP&CS')
#Empty list
list3=list()

Creation of list from user input


eval()– this method can be used to accept tuples from users. Which can be converted to
list, using the list() method.
E.g.
T=eval(input(“Enter a set of numbers ”))
print(“Tuple is ”,T)
L=list(T)
print(“List is ”,L)

Output
Enter a set of numbers 4,7,5,6,9,2
Tuple is(4,7,5,6,9,2)
List is=[4,7,5,6,9,2]

List Indexing,
List1 [12, 3, 43, 23, 33, 65]
Accessing elements from a list

Traversing of list elements (Iteration/Looping over a list)


List1=[12,3,43,23,33,65]
Method-1
List1 [12,3,43,23,33,65] both result in same O/P
for i in range(0,len(List1)): 12
print(List[i]) 3
43
Method-2 23
List1 [12,3,43,23,33,65] 33
for x in List1: 65
print(x)

SLICING : Accessing a part of a list is known as slicing.


-9 -8 -7 -6 -5 -4 -3 -2 -1

A M I T J A I N
0 1 2 3 4 5 6 7 8

List1 ['A', 'M', 'I', 'T', ' ','J','A', 'I', 'N']


Statement Output Explaination
print(List1[:]) ['A', 'M', 'I', 'T', ' ', 'J', 'A', 'I', 'N'] list_object[Start:End:Step]

print(List1[2:]) ['I', 'T', ' ', 'J', 'A', 'I', 'N']


Select from Start index to end-1
index, with jump of step for the
print(List1[:6]) ['A', 'M', 'I', 'T', ' ', 'J']
next and subsequent element
selection.
print(List1[0:4]) ['A', 'M', 'I', 'T']

print(List1[3:6]) ['T', ' ', 'J']

print(List1[-2:-5]) []

print(List1[-5:-2]) [' ', 'J', 'A']

print(List1[1:7:2]) ['M', 'T', 'J']


ADDITION OF ELEMENTS IN LIST: Two ways to add an item in the list

1. Append command
append( ) is used to add only one element at
a time.
ListF [44, 55]
ListF # [44, 55]
ListF.append(77)
ListF # [44, 55, 77]
ListF.append(88,88) # Error
ListF.append([88, 99]) # [44, 55, 77, [88, 99]]

2. Extend command
extend( ) is used to add one or more
elements
ListF [44, 55]
List F # [44, 55]
ListF.extend(77) # Error

ListF.extend([77]) # [44, 55, 77]

ListF.extend([88, 99]) # [44, 55, 77, 88, 99]

MODIFICATION /UPDATION OF ITEM


ListD[36, 46, 56, 66, 76] Output

ListD[2] # 56
ListD[2] 1000 # 56
ListD[2] # 1000
ListD # [36, 46, 1000, 66, 76]
ListD[2:3]400,500 # [36, 46, 400, 500, 66, 76]

DELETION OF ELEMENTS FROM LIST

Using del command O/P


List1=[44,55,66,77,88]
del List1[2]
print(List1) [44,55,77,88]
del List1[1:3]
print(List1) [44,88]

Using pop(index) method O/P


L1=['K', 'V', '4']
print(L1.pop( )) 4
print(L1.pop(1)) V
print(L1) [‘K’, ‘4’]
print(L1.pop(-1)) 4
OPERATIONS ON THE LIST
E.g. L1=[23,12,43,22,5,34]
L2=[4,3,5]

Sl. No. Operator For List Output


L1 & L2

1 Concatenation‘+’ L1+L2 [23, 12, 43, 22, 5, 34, 4, 3, 5]


2 Replication/ Repetition ‘*’ L2*3 [4,3,5,4,3,5,4,3,5]

3 Membership ‘ in ‘ and ‘ not in’ 43 in L1 True


(Check presence of element) 3 not in L2 False

METHODS / FUNCTIONS
E.g. L1=[23,12,43,23,5,34]
L2=[‘K’, ‘V’, ‘S’]

Sl. Method / Function Example Output


No. For given list
L1 & L2

1 index(item) L1.index(43) 2
To display index of an
item
2 insert(index, item) L2.insert(1, ‘A’) ['K','A','V','S']
To add an item at given
index
3 reverse() L2.reverse() [‘S’,‘V’,‘A’,‘K’]
Reverse the order of
elements
4 len(List) len(L1) 6
Returns length of list

5 sort() Ascending order ['A','K','S','V']


Arrange the elements in L2.sort()
ascending or descending
Order Descending order ['V','S','K','A']
L2.sort(reverse =True)
6 count(item) L1.count(23) 2
Counts frequency of an
item
7 remove(item) L2.remove(‘A’) [‘K’,’V’,’S’]
Remove the item
8 max(list) max(L1) 43
Returns maximum value

9 min(list) min(L1) 5
Returns minimum value
2.4 DICTIONARY
Key points: -
- Python Dictionaries are a collection of some key:value pairs.
- Python Dictionaries are unordered collection
- Dictionaries are mutable means values in a dictionary can be changed using its key
- Keys are unique.
- Enclosed within brace { }

Working with dictionaries


Creating Python # empty dictionary
Dictionary my_dict {}

# dictionary with integer keys


my_dict {1: 'apple', 2: 'ball'}

# dictionary with mixed keys


my_dict {'name': 'John', 1: [2, 4, 3]}

dict( ) method # using dict()


my_dict dict({1:'apple', 2:'ball'})
Accessing Elements my_dict {'name': 'Jack', 'age': 26}
from Dictionary print(my_dict['name'])
print(my_dict.get('age'))

get( ) method # Trying to access keys which doesn't exist returns None
print(my_dict.get('address'))

# KeyError
print(my_dict['address'])
Output: -
Jack
26
None
Traceback (most recent call last):
File "<string>", line 15, in <module>
print(my_dict['address'])
KeyError: 'address'
Changing and Adding # Changing and adding Dictionary Elements
Dictionary elements my_dict {'name': 'Jack', 'age': 26}

# update value
my_dict['age'] 27
print(my_dict)

# add item
my_dict['address']= 'Downtown'
print(my_dict)

Output: -
{'name': 'Jack', 'age': 27}
{'name': 'Jack', 'age': 27, 'address': 'Downtown'}
Removing elements # Removing elements from a dictionary
from Dictionary squares {1: 1, 2: 4, 3: 9, 4: 16, 5: 25}
pop( ) method # remove a particular item, returns its value
print(squares.pop(4))
print(squares)

popitem method( ) # remove an arbitrary item, return (key,value)


print(squares.popitem())
print(squares)

clear( ) method # remove all items


squares.clear()
print(squares)

del function # delete the dictionary itself


del squares

Output: -
16
{1: 1, 2: 4, 3: 9, 5: 25}
(5, 25)
{1: 1, 2: 4, 3: 9}
{}
len() – Finding dict={'Name':'Aman','Age':3}
number of items in print("Length: - ", len(dict))
dictionary OUTPUT
Length:- 2
keys() - returns all the x=dict(name=“Aman",age=37,country=“India")
available keys print(x.keys())
OUTPUT
dict_keys(['country','age','name'])
values()- returns all x=dict(name=“Aman",age=37,country=“India")
the available values print(x.values())
OUTPUT
dict_values(['India',37,'Aman'])
items()- return the list x=dict(name="Aman",age=37,country="India")
with all dictionary print(x.items())
keys with values. OUTPUT-
dict_items([('country','India'),('age',37),('name','Aman')])
update()- used to x=dict(name="Aman",age=37,country="India")
change the values of a d1=dict(age=39)
key and add new keys x.update(d1,state="Rajasthan")
print(x)
OUTPUT-
{'country':'India','age':39,'name':'Aman','state':'Rajasthan'}
fromkeys()i- is used keys={'a','e','i','o','u'}
to create dictionary value="Vowel"
from keys vowels=dict.fromkeys(keys,value)
print(vowels)
OUTPUT-
{'i':'Vowel','u':'Vowel','e':'Vowel','a':'Vowel','o':'Vowel'}
copy()- returns a x=dict(name="Aman",age=37,country="India")
shallow copy of the y=x.copy()
dictionary. print(y)
OUTPUT->{'country':'India','age':37,'name':'Aman'}
Dictionary #Membership Test for Dictionary Keys
Membership Test squares {1: 1, 3: 9, 5: 25, 7: 49, 9: 81}

in print(1 in squares)
not in print(2 not in squares)
print(49 in squares)

Output -
True
True
False
Iterating Through a # Iterating through a Dictionary
Dictionary squares {1: 1, 3: 9, 5: 25, 7: 49, 9: 81}
for i in squares:
print(squares[i])

Output-
1
9
25
49
81
Unit 3: Database concepts and the Structured
Query Language
- 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 database using MySQL, Data Types
- Data Definition: CREATE TABLE
- Data Query: SELECT, FROM, WHERE.
- Data Manipulation: INSERT

3.1 Database Concepts: Introduction to database concepts and its need,


Database Management System.

Manual Record Keeping System : A System where records are maintained by


hand, without using a computer system.
Advantages of Manual Record Keeping System :
1. It is less expensive.
2. Less risk of data loss.
3. No software specialised person is required.
Disadvantages of Manual Record Keeping System :
1. No sharing of data.
2. More chances of inconsistent data.
3. Making correction is very time consuming.

Electronic Record Keeping System : A System in which records are


maintained in computer system instead of in paper.
Advantages of Electronic Record Keeping System :
1. Less paper wastage.
2. Searching of record is very simple.
3. Easy to backup the documents.
Disadvantages of Electronic Record Keeping System :
1. More expensive.
2. More risk to data loss.
3. A Software specialised person is required to manage this system.

Database Management System : A database management system (DBMS) is a software


that can be used to create and manage databases. Some examples of open source and
commercial DBMS include MySQL, Oracle, PostgreSQL, SQL Server, Microsoft Access,
MongoDB etc.

3.2 Relational data model: Concept of domain, tuple, relation, candidate


key, primary key, alternate key
RDBMS:
RDBMS stands for Relational Database Management System. RDBMS is the basis
for SQL, and for all modern database systems like MS SQL Server, IBM DB2, Oracle,
MySQL, and Microsoft Access. The data in RDBMS is stored in database objects
called tables. A table is a collection of related data entries and it consists of
columns and rows.

Common Terms used in DBMS :


Attributes : The columns of a relation are the attributes which are also referred
to as fields.
Tuple : Each row of data in a relation (table) is called a tuple. It is also known as a
record.
Domain : It is a set of values from which an attribute can take a value in each row.
Usually, a data type is used to specify a domain for an attribute.
Degree : The number of attributes in a relation is called the Degree of the relation.
Cardinality : The number of tuples in a relation is called the Cardinality of the
relation.

Key Concepts in DBMS :


Database Schema : It is the skeleton of the database that represents the structure
(table names and their fields/columns),the type of data each column can hold,
constraints on the data to be stored (if any), and the relationships among the
tables.
Data Constraint : Certain restrictions or limitations on the type of data that can
be inserted in one or more columns of a table during table creation is called data
constraint. Constraints are used to ensure accuracy and reliability of data in the
database.
Meta-data or Data Dictionary :The database schema along with various
constraints on the data is stored by DBMS in a database catalog or dictionary,
called meta-data. A meta-data is data about the data.
Database Instance : When we define database structure or schema, state of
database is empty i.e. no data entry is there. After loading data, the state or
snapshot of the database at any given time is the database instance.
Query : A query is a request to a database for obtaining information in a desired
way. Query can be made to get data from one table or from a combination of tables.
Data Manipulation : Modification of database consists of three operations viz.
Insertion, Deletion or Update. Insertion means adding a new record in a table.
Deletion means removing an existing record from a table. Updation means editing
an existing record in a table.
Database Engine : Database engine is the underlying component or set of
programs used by a DBMS to create a database and handle various queries for data
retrieval and manipulation.

Three Important Properties of a Relation :In relational data model, following three
properties are observed with respect to a relation which makes a relation different from
a data file or a simple table.

Property-1 : imposes following rules on an attribute of the relation.


1. Each attribute in a relation has a unique name.
2. Sequence of attributes in a relation is immaterial.

Property-2 : imposes following rules on tuples of the relation.


1. Each tuple in a relation is distinct.
2. Sequence of tuples in a relation is immaterial.

Property-3 : imposes following rules on the state of a relation.


1. All data values in an attribute must be from the same domain (same data
type).
2. Each data value associated with an attribute must be atomic.
3. No attribute can have many data values in one tuple.
4. A special value Null is used to represent values that are unknown.

Keys in Relational Database :


Candidate Key : Those fields which can act as a primary key in a table are called
candidate Key.
Primary Key : A field which uniquely identifies each and every record in the table
is called primary key.
Composite Primary Key : If no single attribute in a relation is able to uniquely
identify the tuples, then more than one attribute is taken together as primary key.
Such a primary key consisting of more than one attribute is called Composite
Primary key.
Foreign Key : A foreign key is used to represent the relationship between two
relations. A foreign key is an attribute whose value is derived from the primary
key of another relation.
Note: In some cases, foreign key can take a NULL value if it is not part of the primary key
of the foreign table. The relation in which the referenced primary key is defined is called
primary relation or master relation.

3.3 INTRODUCTION TO MYSQL


-Advantages of using Structured Query Language, Data Definition Language, Data Query
Language and Data Manipulation Language, Introduction to MySQL, creating a database
using MySQL, Data Types
-Data Definition: CREATE TABLE
-Data Query: SELECT, FROM, WHERE.
-Data Manipulation: INSERT

What is MySQL?:
MySQL is a open source Relational Database Management System. MySQL is very fast
reliable and flexible Database Management System. It provides a very high performance
and it is multi threaded and multi user Relational Database management system.

MySQL Features
1. MySQL are very fast and much reliable for any type of application.
2. MySQL is very Lightweight application.
3. MySQL command line tool is very powerful and can be used to run SQL queries
against database.
4. MySQL supports indexing and binary objects.
5. It is allow changes to structure of table while server is running.
6. MySQL has a wide user base.
7. It is a very fast thread-based memory allocation system.
8. MySQL Written in C and C++ language.
9. MySQL code is tested with different compilers.
10. MySQL is available as a separate program for use in a client/server network
environment.

Advantages of MySql:
● Reliability and Performance : MySQL is very reliable and high performance
relational database management system. It can used to store many GB's of data
into database.
● Open Source: MySQL source code is available that's why now you can recompile
the source code.
● Cross-Platform support: MySQL supports more then twenty different platform
including the major Linux distribution .Mac OS X, Unix and Microsoft windows.
Keep in Mind That...
● SQL is not case sensitive in windows but it is if you use linux based environment.
● Semicolon after SQL Statements

Classification of SQL statements


SQL provides many different types of commands used for different purposes. SQL can be
divided into following parts:
1. Data Manipulation Language (DML) commands
2. Data Definition Language (DDL) commands.
3. Transaction Control Language (TCL)- Not part of our syllabus

1. DML commands: A DML is a language that enables users to access manipulated data
as organized by the appropriate data model.
● SELECT - extracts data from a database (DQL)
● UPDATE - updates data in a database Not part of our syllabus
● DELETE - deletes data from a database Not part of our syllabus
● INSERT INTO - inserts new data into a database
2. DDL commands: The DDL commands, as the name suggests, allow you to perform
tasks related to data definition. The DDL part of SQL permits database tables to be created
or deleted. The most important DDL statements in SQL are:
● CREATE DATABASE - creates a new database
● ALTER DATABASE - modifies a database Not part of our syllabus
● CREATE TABLE - creates a new table
● ALTER TABLE - modifies a table Not part of our syllabus
● DROP TABLE - deletes a table Not part of our syllabus

MySQL Data Types


In MySQL there are three main data types: text, number, and Date/Time,
Text types:
Data type Description

CHAR(size) Holds a fixed length string (can contain letters, numbers, and special
characters). The fixed size is specified in parenthesis. Can store up to
255 characters

VARCHAR(size) Holds a variable length string. The maximum size: up to 255


characters. Note: If you put a greater value than 255 it will be converted
to a TEXT type

TEXT Holds a string with a maximum length of 65,535 characters

Number types:
Data type Description

INT(size) -2147483648 to 2147483647 normal. 0 to 4294967295


UNSIGNED*. The maximum number of digits may be specified in
parenthesis

FLOAT(size,d) A small number with a floating decimal point. The maximum


number of digits may be specified in the size parameter. The
maximum number of digits to the right of the decimal point is
specified in the d parameter

DECIMAL(size,d) A DOUBLE stored as a string , allowing for a fixed decimal point. The
maximum number of digits may be specified in the size parameter.
The maximum number of digits to the right of the decimal point is
specified in the d parameter
*The integer types have an extra option called UNSIGNED. Normally, the integer goes from an
negative to positive value. Adding the UNSIGNED attribute will move that range up so it starts at
zero instead of a negative number.
Date types:
Data type Description

DATE() A date. Format: YYYY-MM-DD


Note: The supported range is from '1000-01-01' to '9999-12-31'

DATETIME() *A date and time combination. Format: YYYY-MM-DD HH:MM:SS


Note: Range is from '1000-01-01 00:00:00' to '9999-12-31 23:59:59'

TIMESTAMP() *A timestamp. TIMESTAMP values are stored as the number of seconds


since the Unix epoch ('1970-01-01 00:00:00' UTC). Format: YYYY-MM-
DD HH:MM:SS Range is from '1970-01-01 00:00:01' UTC to '2038-01-09
03:14:07' UTC

TIME() A time. Format: HH:MM:SS


Note: The supported range is from '-838:59:59' to '838:59:59'

YEAR() A year in two-digit or four-digit format.


Note: Values allowed in four-digit format: 1901 to 2155. Values allowed
in two-digit format: 70 to 69, representing years from 1970 to 2069
*Even if DATETIME and TIMESTAMP return the same format, they work very differently. In an
INSERT or UPDATE query, the TIMESTAMP automatically set itself to the current date and time.
TIMESTAMP also accepts various formats, like YYYYMMDDHHMMSS, YYMMDDHHMMSS,
YYYYMMDD, or YYMMDD.

The CREATE TABLE Statement (DDL)


The CREATE TABLE statement is used to create a table in a database.
SQL CREATE TABLE Syntax
CREATE TABLE table_name
(
column_name1 data_type,
column_name2 data_type,
column_name3 data_type,
....
)

CREATE TABLE Example


Now we want to create a table called "Persons" that contains five columns: P_Id,
LastName, FirstName, Address, and City.
We use the following CREATE TABLE statement:
CREATE TABLE Persons
(
P_Id int,
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255)
)
The P_Id column is of type int and will hold a number. The LastName, FirstName, Address,
and City columns are of type varchar with a maximum length of 255 characters.
The empty "Persons" table will now look like this:
P_Id LastName FirstName Address City

The empty table can be filled with data with the INSERT INTO statement.

SQL Constraints (Not part of the syllabus)


Constraints are used to limit the type of data that can go into a table. Constraints can be
specified when a table is created (with the CREATE TABLE statement) or after the table
is created (with the ALTER TABLE statement). We will focus on the following constraints:
● NOT NULL
● UNIQUE
● PRIMARY KEY
● FOREIGN KEY
● CHECK
● DEFAULT
SQL PRIMARY KEY Constraint
- The PRIMARY KEY constraint uniquely identifies each record in a database table.
- Primary keys must contain unique values. A primary key column cannot contain NULL
values. - - Each table should have a primary key, and each table can have only one primary
key.
SQL PRIMARY KEY Constraint on CREATE TABLE
The following SQL creates a PRIMARY KEY on the "P_Id" column when the "Persons" table
is created:
Example:
CREATE TABLE Persons
(
P_Id int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
City varchar(255),
PRIMARY KEY (P_Id)
)

Note: We will use the following table for subsequent queries:


Persons
P_Id LastName FirstName Address City

1 Halwani Oneer Tapovan 10 Surat

2 Siddiqui Taimur 23 Banjara Hills Surat

3 Prasad Kishan Shonitpuram Srinagar

4 Nilsen Johan Bharat Nagar Srinagar

The INSERT INTO Statement (DML)


The INSERT INTO statement is used to insert a new row in a table.
SQL INSERT INTO Syntax
It is possible to write the INSERT INTO statement in two forms.
The first form doesn't specify the column names where the data will be inserted, only
their values:
INSERT INTO table_name
VALUES (value1, value2, value3,...)
The second form specifies both the column names and the values to be inserted:
INSERT INTO table_name (column1, column2, column3,...)
VALUES (value1, value2, value3,...)
SQL INSERT INTO Example
We have the following "Persons" table:

P_Id LastName FirstName Address City

1 Halwani Oneer Tapovan 10 Surat

2 Siddiqui Taimur 23 Banjara Hills Surat

3 Prasad Kishan Shonitpuram Srinagar

Now we want to insert a new row in the "Persons" table.


We use the following SQL statement:
INSERT INTO Persons
VALUES (4,'Nilsen', 'Johan', 'Bharat Nagar', 'Srinagar')
The "Persons" table will now look like this:
P_Id LastName FirstName Address City

1 Halwani Oneer Tapovan 10 Surat

2 Siddiqui Taimur 23 Banjara Hills Surat

3 Prasad Kishan Shonitpuram Srinagar

4 Nilsen Johan Bharat Nagar Srinagar

Insert Data Only in Specified Columns


It is also possible to only add data in specific columns.
The following SQL statement will add a new row, but only add data in the "P_Id",
"LastName" and the "FirstName" columns:
INSERT INTO Persons (P_Id, LastName, FirstName)
VALUES (5, 'Teja', 'Jaeb')
The "Persons" table will now look like this:
P_Id LastName FirstName Address City

1 Halwani Oneer Tapovan 10 Surat

2 Siddiqui Taimur 23 Banjara Hills Surat

3 Prasad Kishan Shonitpuram Srinagar

4 Nilsen Johan Bharat Nagar Srinagar


5 Teja Jaeb

SQL SELECT Statement (DQL)


The SELECT statement is used to select data from a database. The result is stored in a
result table, called the result-set.
Syntax:
SELECT column_name(s) FROM table_name;
and
SELECT * FROM table_name;

SQL SELECT Example


SELECT LastName, FirstName FROM Persons;
Output:
LastName FirstName

Halwani Oneer

Siddiqui Taimur

Prasad Kishan

SELECT * Example
Now we want to select all the columns from the "Persons" table. We use the following
SELECT statement:
SELECT * FROM Persons; // The asterisk (*) is a quick way of selecting all columns
Output:
P_Id LastName FirstName Address City

1 Halwani Oneer Tapovan 10 Surat

2 Siddiqui Taimur 23 Banjara Hills Surat

3 Prasad Kishan Shonitpuram Srinagar

The SQL SELECT DISTINCT Statement


In a table, some of the columns may contain duplicate values. This is not a problem,
however, sometimes you will want to list only the different (distinct) values in a table.
The DISTINCT keyword can be used to return only distinct (different) values.
SQL SELECT DISTINCT Syntax
SELECT DISTINCT
column_name(s)
FROM table_name

SELECT DISTINCT Example


Example:
SELECT DISTINCT City FROM Persons
Output:
City

Surat

Srinagar

The WHERE Clause


The WHERE clause is used to extract only those records that fulfill a specified criterion.
SQL WHERE Syntax
SELECT <column_name(s)>
FROM <table_name>
WHERE <column_name> operator <value>

WHERE Clause Example


The "Persons" table:
P_Id LastName FirstName Address City

1 Halwani Oneer Tapovan 10 Surat

2 Siddiqui Taimur 23 Banjara Hills Surat

3 Prasad Kishan Shonitpuram Srinagar

Now we want to select only the persons living in the city "Surat" from the table above.We
use the following SELECT statement:
SELECT * FROM Persons
WHERE City='Surat'
The result-set will look like this:
P_Id LastName FirstName Address City

1 Halwani Oneer Tapovan 10 Surat

2 Siddiqui Taimur 23 Banjara Hills Surat


Quotes Around Text Fields
SQL uses single quotes around text values (most database systems will also accept double
quotes). Although, numeric values should not be enclosed in quotes.

For text values:


This is correct:
SELECT * FROM Persons WHERE FirstName='Taimur'
This is wrong:
SELECT * FROM Persons WHERE FirstName=Taimur
For numeric values:
This is correct:
SELECT * FROM Persons WHERE Year=1965
This is wrong:
SELECT * FROM Persons WHERE Year='1965'

Operators Allowed in the WHERE Clause


With the WHERE clause, the following operators can be used:
Operator Description

= Equal

<> Not equal

> Greater than

< Less than

>= Greater than or equal

<= Less than or equal

BETWEEN Between an inclusive range

LIKE Search for a pattern

IN If you know the exact value you want to return for at least
one of the columns
Note: In some versions of SQL the <> operator may be written as !=

The AND & OR Operators


The AND & OR operators are used to filter records based on more than one condition. The
AND operator displays a record if both the first condition and the second condition is true.
And OR operator displays a record if either the first condition or the second condition is
true.
AND Operator Example

SELECT * FROM Persons


WHERE FirstName='Taimur'
AND LastName='Siddiqui'
The result-set will look like this:
P_Id LastName FirstName Address City

2 Siddiqui Taimur 23 Banjara Hills Surat

OR Operator Example
Now we want to select only the persons with the first name equal to "Taimur" OR the first
name equal to "Oneer":
We use the following SELECT statement:
SELECT * FROM Persons
WHERE FirstName='Taimur'
OR FirstName='Oneer'
The result-set will look like this:
P_Id LastName FirstName Address City

1 Halwani Oneer Tapovan 10 Surat

2 Siddiqui Taimur 23 Banjara Hills Surat

SQL LIKE Operator


The LIKE operator is used in a WHERE clause to search for a specified pattern in a column.
It is used to search for a specified pattern in a column.
SQL LIKE Syntax
SELECT column_name(s)
FROM table_name
WHERE column_name LIKE pattern
LIKE Operator Example
SELECT * FROM Persons
WHERE City LIKE 's%'

Pattern (SQL Wildcards)


SQL wildcards can substitute for one or more characters when searching for data in a
database.
SQL wildcards must be used with the SQL LIKE operator. With SQL, the following
wildcards can be used:
Wildcard Description
% A substitute for zero or more characters

_ A substitute for exactly one character

[charlist] Any single character in charlist

[^charlist] Any single character not in charlist


or
[!charlist]

SQL Wildcard Examples

Using the % Wildcard


Now we want to select the persons living in a city that starts with "sa" from the "Persons"
table. We use the following SELECT statement:
SELECT * FROM Persons
WHERE City LIKE 'su%'
The result-set will look like this:
P_Id LastName FirstName Address City

1 Halwani Oneer Tapovan 10 Surat

2 Siddiqui Taimur 23 Banjara Hills Surat

Next, we want to select the persons living in a city that contains the pattern "nes" from
the "Persons" table. We use the following SELECT statement:
SELECT * FROM Persons
WHERE City LIKE '%rat%'
The result-set will look like this:
P_Id LastName FirstName Address City

1 Halwani Oneer Tapovan 10 Surat

2 Siddiqui Taimur 23 Banjara Hills Surat

Using the _ Wildcard


Now we want to select the persons with a first name that starts with any character,
followed by "la" from the "Persons" table.
We use the following SELECT statement:
SELECT * FROM Persons
WHERE FirstName LIKE '_neer'
The result-set will look like this:
P_Id LastName FirstName Address City
1 Halwani Oneer Tapovan 10 Surat

Next, we want to select the persons with a last name that starts with "S", followed by any
character, followed by "end", followed by any character, followed by "on" from the
"Persons" table.
We use the following SELECT statement:
SELECT * FROM Persons
WHERE LastName LIKE 'S_dd_ui'
The result-set will look like this:
P_Id LastName FirstName Address City

2 Siddiqui Taimur 23 Banjara Hills Surat

Using the [charlist] Wildcard


We use the following SELECT statement:
SELECT * FROM Persons
WHERE LastName LIKE '[qr]%'
The result-set will look like this:
P_Id LastName FirstName Address City

2 Siddiqui Taimur 23 Banjara Hills Surat

3 Prasad Kishan Shonitpuram Srinagar

We use the following SELECT statement:


SELECT * FROM Persons
WHERE LastName LIKE '[!eqr]%'
The result-set will look like this:
P_Id LastName FirstName Address City

1 Halwani Oneer Tapovan 10 Surat

The IN Operator
The IN operator allows you to specify multiple values in a WHERE clause.
SQL IN Syntax
SELECT column_name(s)
FROM table_name
WHERE column_name IN (value1,value2,...)
IN Operator Example
We use the following SELECT statement:
SELECT * FROM Persons
WHERE LastName IN ('Halwani','Prasad')
The result-set will look like this:
P_Id LastName FirstName Address City

1 Halwani Oneer Tapovan 10 Surat

3 Prasad Kishan Shonitpuram Srinagar

The BETWEEN Operator


The BETWEEN operator selects a range of data between two values. The values can be
numbers, text, or dates.
SQL BETWEEN Syntax
SELECT column_name(s)
FROM table_name
WHERE column_name
BETWEEN value1 AND value2

BETWEEN Operator Example


The "Persons" table:
P_Id LastName FirstName Address City

1 Halwani Oneer Tapovan 10 Surat

2 Siddiqui Taimur 23 Banjara Hills Surat

3 Prasad Kishan Shonitpuram Srinagar

Now we want to select the persons with a last name alphabetically between "Halwani"
and "Prasad" from the table above.
We use the following SELECT statement:
SELECT * FROM Persons
WHERE LastName
BETWEEN 'Halwani' AND
'Prasad'
The result-set will look like this:
P_Id LastName FirstName Address City

1 Halwani Oneer Tapovan 10 Surat

Note: The BETWEEN operator is treated differently in different databases.


In some databases, persons with the LastName of "Halwani" or "Prasad" will not be listed,
because the BETWEEN operator only selects fields that are between and excluding the
test values).
In other databases, persons with the LastName of "Halwani" or "Prasad" will be listed,
because the BETWEEN operator selects fields that are between and including the test
values).
And in other databases, persons with the LastName of "Halwani" will be listed, but
"Prasad" will not be listed (like the example above), because the BETWEEN operator
selects fields between the test values, including the first test value and excluding the last
test value.
Therefore: Check how your database treats the BETWEEN operator.
Example 2
To display the persons outside the range in the previous example, use NOT BETWEEN:
SELECT * FROM Persons
WHERE LastName
NOT BETWEEN 'Halwani' AND 'Prasad'
The result-set will look like this:
P_Id LastName FirstName Address City

2 Siddiqui Taimur 23 Banjara Hills Surat

3 Prasad Kishan Shonitpuram Srinagar

SQL Alias (Not part of the syllabus)


You can give a table or a column another name by using an alias. This can be a good thing
to do if you have very long or complex table names or column names. An alias name could
be anything, but usually it is short.
SQL Alias Syntax for Columns
SELECT column_name AS alias_name
FROM table_name;
Unit 4: Introduction to the Emerging Trends
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

4.1 Artificial Intelligence (AI): Artificial intelligence, or I, 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.
Artificial intelligence aims to imitate human intelligence naturally in machines so
that they will act intelligently. An intelligent machine should be able to mimic some of the
cognitive processes that people use to learn, make decisions, and solve problems.
Machines are trained to build a knowledge base and base judgments off of it in
order to complete jobs with the least amount of human involvement. In order to make
new judgments, AI systems can also learn from their prior actions or results.

4.1.1 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.

4.1.2 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. NLP has made all of this
feasible. An NLP system can convert speech to text and text to speech.

4.2 Immersive Experiences: Now movies are three dimensional, video games are also
being developed to provide immersive experiences to the player. Immersive experiences
allow us to visualize, feel and react by stimulating our senses. It enhances our interaction
and involvement, making them more realistic and engaging. Immersive experiences have
been used in the field of training, such as driving simulators , flight simulators and so on.
● 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 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.

4.3 Robotics: A robot is essentially a machine that can complete one or more activities
accurately and precisely on its own. A robot is programmable by a computer, which
implies it can obey commands supplied by computer programmes, unlike other devices.
Mars Exploration Rover (MER) is a robotic space mission launched by NASA to
learn more about the planet Mars.Sophia is a humanoid robot that mimics human
movements and facial expressions and uses artificial intelligence, visual data processing,
and facial recognition.
An unmanned aircraft called a drone can be remotely piloted or can fly on its own
using software-controlled flight plans in embedded systems in conjunction with onboard
sensors and GPS.

4.4 Big Data: Every day, over 2.5 quintillion bytes of data are generated, and the rate is
rising due to the Internet of Things’ ongoing development (IoT). As a result, big data, data
sets with a large volume and high level of complexity are created.
Such data cannot be handled and analyzed using conventional data processing
methods because it is not only large but also unstructured, such as our posts,
conversations, and instant messages, as well as the pictures.
This data is highly valuable in the businesses, So, there is a strong focus on
developing tools and processes to process and analyze big data.

Characteristics of Big DataThere are five different types of characteristics of Big Data –
1. Volume – Size presents the biggest challenge for large data. It will be challenging
to process a certain dataset if it is large.
2. Velocity – Velocity is the term used to describe the speed with which information
must be processed after being input into a system. For example, Amazon record
every click of the mouse when the shoppers are browsing on its website.
3. Variety – All the organized and unstructured data that could be produced by
either people or machines is referred to as variety in big data.
4. Veracity – Big data can occasionally be inaccurate, distorted, noisy, or contain
errors. It can also have problems with the methods used to obtain the data.
Veracity relates to how reliable the data is.
5. Value – Big data is more than just a large collection of data; it also contains hidden
patterns and insightful information that may be highly valuable to businesses.

4.5 Data Analytics: The practice of analysing datasets to make judgments about the
information they contain is known as data analytics. You can take raw data and use data
analytical tools to find patterns and gain insightful conclusions from it.
“Data analytics is the process of examining data sets in order to draw conclusions
about the information they contain, with the aid of specialised systems and software.

4.6 ”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 an overall network of interconnected devices as well as the technology that
enables communication between them.

4.7 Web of Things (WoT) Internet of Things allows us to interact with different devices
through the Internet with the help of smartphones or computers, Web of Things (WoT)
allows use of web services to connect anything in the physical world, besides human
identities on the web. It will pave the way for creating smart homes, smart offices, smart
cities and so on.
4.8 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.
A smart sensor is a device that receives input from the physical world and uses
internal computer power to carry out predetermined tasks when a certain input is
detected. The data is then processed before being transmitted.Smart CitiesA smart city
use the information and communication technologies (ICT), for creating, implementing,
and promoting sustainable development methods to handle the issues of expanding
urbanisation.

4.9 Smart City: handle transportation systems, power plants, water supply networks,
waste management, law enforcement, information systems, schools, libraries, hospitals
and other community services work in unison to optimise the efficiency of city operations
and services through the information and communication technologies.

4.10 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.
Cloud computing is the distribution of computer services over the Internet (“the
cloud”), including servers, storage, databases, networking, software, analytics, and
intelligence.Cloud Services.
There are three standard models to categorise different computing services delivered
through the cloud.
1. Infrastructure as a Service (IaaS)
2. Platform as a Service (PaaS)
3. Software as a Service (SaaS)
1. Infrastructure as a Service (IaaS) – IaaS is a particular kind of cloud
computing service that provides necessary computation, storage, and networking
resources on demand for example different types of computer infrastructure, such
as servers, virtual machines (VM), storage and backup facilities, network
components, operating systems, or any other hardware or software, can be offered
by IaaS providers.

2. Platform as a Service (PaaS) – a cloud-based service that enables users to


install and run applications without worrying about their setup or underlying
infrastructure. In other words, PaaS offers a platform or setting for creating,
testing, and distributing software applications.

3. Software as a Service (SaaS) – SaaS offers on-demand access to application


software; often, this service requires user licencing or subscription. We utilise
SaaS from the cloud when using Google Doc, Microsoft Office 365, Drop Box, etc.
to modify a document online.

4.11 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.
Grid can be of two types:
1. Data grid: used to manage large and distributed data having required multi-user
access
2. CPU or Processor grid: where processing is moved from one PC to another as
needed or a large task is divided into subtasks and divided to various nodes for
parallel processing.

4.12 Blockchains: The blockchain technology is based on the idea of a shared,


decentralised database that is replicated on every computer. A block is a safeguarded
section of data or a legitimate transaction. Only the block’s owner has access to the block’s
private data, which is hidden behind the header of each block, which is visible to all other
nodes. These blocks come together to form the blockchain.

Image via NCERT


KENDRIYA VIDYALAYA SANGATHAN JAIPUR REGION
CLASS: XI SESSION: 2022-23 (SET-1)
INFORMATION PRACTICES (CODE 065)
TIME: 3 HRS M M: 70
General Instructions:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A has 18 questions carrying 01 marks each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
Internal choice is given in two questions (19 and 23).
5. Section C has 05 Short Answer type questions carrying 03 marks each.
Internal choice is given in two questions (29 and 30).
6. Section D has 03 Long Answer type questions carrying 05 marks each.
Internal choice is given in two questions (31 and 33).
7. Section E has 02 questions carrying 04 marks each.
One internal choice is given in Q 34 and 35 against part c only.
8. All programming questions are to be answered using Python Language only.

Mar
Q SECTION A
ks

What was the name of the first computer designed by Charlse Babbage?
A. Analytical Engine
1 B. Difference Engine 1
C. Colossus
D. ENIAC

Which statement is correct?


A. List is immutable && Tuple is mutable
2 B. List is mutable && Tuple is immutable 1
C. Both are Mutable.
D. Both are Immutable

What is a database?
A. Organized collection of information that cannot be accessed, updated, and
managed
3 B. Collection of data or information without organizing 1
C. Organized collection of data or information that can be accessed, updated, and
managed
D. Organized collection of data that cannot be updated

__________ is a subsystem of Artificial Intelligence, wherein computers have the


ability to learn from data using statistical techniques, without being
explicitly programmed by a human being.
4 A. Artificial Intelligence 1
B. Machine Learning
C. Data Science
D. None of the above

What is the full form of DDL out of the following?


5 1
A. Drive Dilution Language
B. Data Deletion Language
C. Data Definition Language
D. Data Defragmentation Language

Which statement does not show any error after execution? Given L=[1,2,3,4]
A. print(L+L)
6 B. print(L*L) 1
C. print(L-L)
D. All of the mentioned

Which of the followings is a type of Primary memory: -


A. Memory Card
7 B. Compact Disk 1
C. ROM
D. Pen Drive

SQL INSERT statement adds ............... records to any single table in a relational
database
A. One
8 B. One or More 1
C. only two
D. None of Above

Rows of a Relation are called?


A. Attributes
9 B.Tuples 1
C.Degree
D.Cardinality

_______________ is designed to solve a specific problem or to do a specific task.


A. Application Software
10 B. System Software 1
C. Utility Software
D. User

Which is the full form of SQL out of the following?


A. Standard Query language
11 B. Standard Quantum Language 1
C. Structured Query language
D. Structured Quantum language

Which line of code correctly adds an item to the fruits dictionary with a key of
'Blackberry' and a value of 20?
fruits = {'Apples':1, 'Bananas':4, 'Grapes':17, 'Oranges':14}
12 A. fruits['Blackberry'] = 20 1
B. add fruits['Blackberry'] = 20
C. insert 'Blackberry':20 in fruits
D. fruits[20] = 'Blackberry'

A * symbol in the SQL Select statement signifies


A. All rows to be selected from a given table.
13 1
B. All columns of the given table to be included in the query result.
C. Complete Table to be displayed.
D. None of the above

In MySQL, statements should be written in


A. upper case only
14 B. lower case only 1
C. title case
D. MySQL statements are not case sensitive

For each attribute of a relation, there is a set of permitted values, called the ________
of that attribute..
A. Relation
15 1
B. Domain
C. Tuple
D. Degree

MySQL is ………………………….. software


A. RDBMS
16 B. DBMS 1
C. Proprietary
D. Spreadsheet

Q17 and 18 are ASSERTION AND REASONING based questions.


Mark the correct choice as
i. Both A and R are true and R is the correct explanation for A
ii. Both A and R are true and R is not the correct explanation for A
iii. A is True but R is False
iv. A is false but R is True.

A: Loops are used to repeat a group of statements under a condition.


17 1
R: Two commonly used loops in python are for loop and while loop.

Internet of Things (IoT), Sensors, Smart cities, Cloud Computing and Cloud Services
(SaaS, IaaS, PaaS); Grid Computing, Block chain technology.
A: In Machine Learning, computers have the ability to learn from data using
18 1
statistical techniques.
R: After successive training, ML Models are used to make predictions about new
and unknown data.

SECTION B

Find out the error(s) in the following python code:


a,b=9,56
if(a<b)
print(‘a is smaller than b’)
OR
19 2
What will be the output of following program
x=1234
while x%10:
x=x//10
print(x)

20 Define DDL commands of SQL with examples. 2

21 Write down any four advantages of using computer 2

22 A list in python is Mutable or Immutable? Justify your answer with an 2


example?

What is the SELECT command? Write down its basic syntax.


OR
Ms. Namita is trying to add a new record in a table named PERSON. she wrote
23 2
following query but got an error: -
INSERT RECORD INTO PERSON VALUE [101,”Sandeep”, 9955882200]
Write a correct query to add the above record?

Classify the following operators as logical, relational or assignment operator


24 2
> , = , ==, and

25 1. What will be units in bytes for following: 1KB, 1MB, 1GB, 1 TB 2

SECTION C

Differentiate between software System and Application software ? Give an


26
example in each case. 3

27 Write a program to take user input and find number is odd or even 3

Write a python program to display the largest of 3 numbers using if..elif..else


28 3
statement(s).

Artificial Intelligence (AI) is a discipline that aims to create robots that are
intelligent enough to do jobs that are typically performed by humans only. Identify
aspects which are still beyond the capabilities of artificial intelligence
29 OR 3
A new initiative named PMSHREE is being implemented in various schools across
India. The scheme is to make the IOT enabled, smart and model schools. Please
suggest three iOT enabled solutions to make the school smart.

Write down name of commands for followings: -


i) Making a new database in MySql
ii) Obtaining a list of existing databases
30 iii) Opening a database 3
OR
What do you understand by the term database? Write any four advantages of using
a database over the traditional file system.

SECTION D

Write a python program to create a dictionary where the keys are numbers
(between 1 to 10) and the values are sum of the first keyth (1 to key) natural
numbers.
31 OR 5
a) Define a Dictionary with an example in respect of Python?
b) Write down any two characteristics of a python Dictionary?
c) What is the purpose of the dict() method?

Write a SQL statement to create a table jobhistory in job database with following
structure
+------------+--------------+------+-----+---------+-------+
32 5
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+-------+
| JOB_ID | varchar(10) | NO | | | |
| JOB_TITLE | varchar(35) | NO | | NULL | |
| MIN_SALARY | decimal(6,0) | YES | | NULL | |
| MAX_SALARY | decimal(6,0) | YES | | NULL | |
+------------+--------------+------+-----+---------+-------+
Write Sql statement for following
a. Create a database job
b. Before creation of table open the newly created database job
c. create a table jobhistory with above structure
d. Which field can be created as Primary key
e. What will be the degree of table/relation jobhistory

Answer the question (a) to (e) based on the table, PLAYER given below:
Player
PID PName Gender Game Rank

P01 Sunny Paji Male Cricket 5

P02 Marry Kaun Female Boxing 3

P03 Saniya Mircha Female Tennis 5

P04 Sachin Reelkar Male Cricket 1

P05 Vijender Maohawk Male Boxing Null


a) Display details of all Male players.
b) Display player name and game whose rank is 1 to 3
c) Show PID,PName and Rank whose game is either Boxing or Cricket.
d) Add a new record in the table (“P06”, ”Abhinav”,”Male”,”Shooting”,1)
e) What will be the output of the following Query:
SELECT Pname as Player_Name, Game
FROM Player
WHERE Game=’Tennis’;
33 5
OR
Consider the table -TICKET given below. Write the output for (i) to (iv) and answer
the question (v)
TKTNO PNAME SOURCE DESTINATIO FARE
N

1725 Amrit Jain Jaipur Kota 340

1425 Vimal Kumar Jaipur Mumbai 570

1121 Vickey Kaushal Kota Mumbai 660

1252 Vikek Shah Karauli Jaipur 190

1251 Urmila Pandey Banswada Udhampur 850


i. Select * from TICKET where TKTNO=1425;
ii. Select PNAME, SOURCE, DESTINATION from TICKET where price between
300 and 660);
iii. Select * from TICKET where SOURCE = ‘AJMER’;
iv. Select PNAME from TICKET where PNAME like ‘vi%’;
v. What is the degree of the above table?
SECTION E

Mr. Tushar Kapoor, is a games teacher. He needs to prepare a list of students who
are selected for regional level sports meets. later he needs to perform some actions
on the list so prepared. He is of the view that the task can be accomplished easily
using python lists data structure. Help him to perform the following task using lists
in Python programming language.
34 4
a. create a list named ‘Regional’ with the following values :- ‘Amrit’, ‘Kanika’,
‘Salman’, ‘Vivek’, ‘Anita’, ‘Vipin’
b. print the number of students in the ist.
c. remove the student at the third index.
d. Display last three elements in the list

Mr Vanaram has opened a coaching institute in his home city Yalahanka. He has a
bit of experience with database design but forgot a few things here and there. He
has called his best buddy Ramanatham for help. Let’s assume you are Ramnatham,
help out your friend to set up and test the database thus created.
Course
C_ID F_ID Cname Fees

C21 102 Grid Computing 40000

C22 106 System Design 16000

C23 104 Network Security 80000

C24 106 Human Biology 150000


35 4
C25 102 Computer Network 20000

a) Help Vanaram by filling out the missing bits in the table creation process:
CREATE ____(i)____ Course(
C_ID CHAR(3),
F_ID ___(ii)____,
Cname VARCHAR (20),
Fees INT);
b) Vanaram: Hey Rama, would you please write the INSERT query for the first
row? I’ll follow and write the subsequent one myself.
c) Vanaram: I want to see the data of the table but the query: SELECT ALL
FROM TABLE Course; is not working. Can you fix it?
KENDRIYA VIDYALAYA SANGATHAN JAIPUR REGION
QUESTION PAPER (SET - 02)
CLASS: XI SESSION: 2022-23
INFORMATION PRACTICES (CODE 065)
TIME: 3 HRS M M: 70
General Instructions:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A has 18 questions carrying 01 marks each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
Internal choice is given in two questions (19 and 23).
5. Section C has 05 Short Answer type questions carrying 03 marks each.
Internal choice is given in two questions (29 and 30).
6. Section D has 03 Long Answer type questions carrying 05 marks each.
Internal choice is given in two questions (31 and 33).
7. Section E has 02 questions carrying 04 marks each.
One internal choice is given in Q 34 and 35 against part c only.
8. All programming questions are to be answered using Python Language only.

Q. N. SECTION A Marks

Which of the following groups are only input devices?


A. Mouse, Keyboard, Monitor, Joystick
1 B. Mouse, Keyboard, Printer, Light-Pen 1
C. Mouse, Keyboard, Scanner, Joystick, Light-Pen
D. Mouse, Keyboard, Trackball, Speaker, Microphone

Which of the following characters is used to give single-line comments in Python?


A. //
2 B. # 1
C. !
D. /*

What is the full form of DBMS?


A. Data of Binary Management System
3 B. Database Management System 1
C. Database Management Service
D. Data Backup Management System

___________ deals with the interaction between humans and computers using human
spoken languages, such as Hindi, English, etc.
A. Data Science
4 1
B. Neuroscience
C. Natural Language Processing
D. All of the above

Which one is the command to add a new column in an already existing relation in SQL?
A. Add
5 1
B. Alter
C. Insert
D. Change

Which of the following commands will sort list1 in descending order?


A. list1.sort(reverse=0)
6 B. list1.sort() 1
C. list1.sort(reverse=‘True’)
D. list1.sort(reverse=1)

“………………….. is …………………….. memory.” Select the most appropriate to fill in the


blanks of the given statement.
A. RAM, Non-volatile
7 1
B. RAM, Volatile
C. RAM, Secondary
D. ROM, Volatile

Which one is correct syntax for Insert Statement?


A. Insert Columns(Col1, Col2,Col3);
8 B. Insert into (Col1, Col2,Col3) VALUES (Val1,Val2,Val3); 1
C. Insert Columns(Col1, Col2,Col3) VALUE (Val1, Val2,Val3) Into ;
D. None of the above.

Columns of a Relation are called?


A. Attributes
9 B. Tuples 1
C. Degree
D. Cardinality

OSS stands for __________.


A. Open System Service
10 B. Open Source Software 1
C. Open System Software
D. Open Synchronized Software

A column is declared with char (10) size, and assigned 4 characters only. How many
total characters will this column occupy?
A. 4
11 1
B. 5
C. 10
D. 11

Suppose my_dict = {"Name":"Aakash", "Age":35, "Gender":"Male"}. To delete the entry


for "Age", what command do we use?
A. my_dict.delete("Age":35)
12 1
B. my_dict.delete("Age")
C. del my_dict["Age"]
D. del my_dict["Age":35]

Which of the following clauses is used in the SQL select statement to filter rows to be
included in the query result.
A. Order By
13 1
B. Group by
C. Having
D. Where

Which of the following is not a feature of MySQL?


14 1
A. Cross Platform
B. User Friendly
C. Open source
D. License fee s to be paid for use

In the relational model, the number of attributes and number of tuples of a relation
are termed as _________ and _________ respectively.
A. cardinality, domain
15 1
B. domain, degree
C. degree, cardinality
D. cardinality, degree

Which is/are the sublanguage(s) of SQL: -


A. DML
16 B. DDL 1
C. DCL
D. All of the above

Q17 and 18 are ASSERTION AND REASONING based questions.


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.

A: if..elif.. else is a form of if statement used when we have a large number of


conditions connected to each other.
R: In an if.elif..else statement one condition is evaluated, if it is found incorrect,
17 1
another set of conditions is tested and the process continues. If none of the given
conditions is found to be true, the statements associated with the else part are
executed.

A: Virtual Reality (VR) is athree-dimensional, computer-generated situation that


simulates the real world.
18 R: It adds components of the digital world to the physical world, along with the 1
associated tactile and other sensory requirements, thereby making the reality
interactive and digitally manipulable.

SECTION B

Find out the error(s) in the following python code:


print(area of circle calculator)
r=7
area = pi * r ** 2
OR
What will be the output of following program
19 2
x=10
for i in range(x):
if x==5:
break
print("H")
print(x)

An organization named Gaurav wants to put all the data in the form of records. The
20 records are stored in a table and tables are stored in a database. Which DDL command 2
is used to create a database name Gaurav? Write down the SQL Statement to create
the database.

21 Write down the full form of following i/o devices: OCR, MICR, OMR, VR 2

Find output of the following code fragment


L = [10, 20, 30, 40, 50]
22 2
for idx in range(0, len(L), 2):
print(L[idx], end=”#”)

Consider the table Student {S_Id, S_Name, S_Age, S_Class, S_Fee}. Write the command
to display S_Id, S_Name and S_Class of the students who are studying in class 5, 9, 10
23 and 12. 2
OR
What is the purpose of the INSERT command? Explain briefly with an example?

Predict the output of the following


24 a. 100 + 34//11%3 2
b. True and True or False and not True

Arrange the following memory units in decreasing order:


25 2
Exabyte, Tera byte, Peta byte, Giga byte

SECTION C

Differentiate between generic and special purpose software. Give an example in each
26
case. 3

Write a program to check if the number is positive or negative or zero and display an
27 3
appropriate message. (input: num=3.4, 0 and -4.5)

28 Write a python program to check whether the given character is a vowel or not. 3

A news channel broadcasts information on a wide range of topics. The news channel
permits people to submit breaking news, which is subject to verification by the
channel’s reporters. It may be difficult to distinguish between real news and fake
news, which can lead to confusion among readers and threaten a news organization’s
reputation. Which domain is used to detect fake news so that the audience has a high
level of trust in the news channel? Write in brief about this domain.
OR
29 A company interested in cloud computing is looking for a provider who offers a set of 3
basic services such as virtual server provisioning and on-demand storage that can be
combined into a platform for deploying and running customized applications. What
type of cloud computing model fits these requirements?
a) Platform as a Service
b) Software as a Service
c) Infrastructure as a Service
Also, Explain your choice.

Mr. Khan wants to view the structure of an existing table - STUDENT in a database
SCHOOL.So he started Mysql, write down the sequence of the commands he should
use as he is not sure about the name of the table also.
30 3
OR
Mitali is confused with the terms Domain, Tuple and Attribute. Help her to understand
the terms with a suitable example of each.
SECTION D

Write a python program to count the frequency of each character using a dictionary
of a string (string should be entered by the user).
31 OR 5
Explain the use of get() and pop() methods in respect of Python Dictionary with
examples.

Write a SQL statement to create a table customer in shop database with following
structure
+---------+---------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+---------------+------+-----+---------+-------+
| ID | int(11) | NO | | | |
| NAME | varchar(20) | NO | | | |
| AGE | int(11) | NO | | | |
32 5
| ADDRESS | char(25) | YES | | NULL | |
+---------+---------------+------+-----+---------+-------+
Write SQL statements for following
a. Create a database shop
b. Before creation of table open the newly created database shop
c. Create a table customer with above structure
d. Which field can be created as Primary key
e. What will be the degree of table/relation customer

Answer the question (a) to (e) based on the table, Book given below:
Book
BNo Title Author Date_Purchased Price

B01 IP CLASS XI A ARORA 2020-01-05 350

B02 COMP SCI P ARORA 2020-10-15 250

B03 CS CLASS XII NCERT 2021-06-30 NULL

B04 IP With PYTHON NCERT 2021-12-01 400


a. Display details of the books whose price not mentioned
b. Display title and date of purchase of the books having “IP”in their title.
c. Display all the details of books by NCERT.
33 d. Add a new tuple (B05, Anaconda,Nickey M, 2022-01-01,550). 5
e. What will be the output of the following Query:
SELECT Author, Title
FROM Book
WHERE Price BETWEEN 100 AND 250;
OR
Consider the table -PLAYER given below. Write the output for (i) to (iv) and write sql
query for question (v)
PID PName Gender Game Rank

P01 Sunny Paji Male Cricket 5

P02 Marry Kaun Female Boxing 3

P03 Saniya Mircha Female Tennis 5


P04 Sachin Reelkar Male Cricket 1

P05 Vijender Maohawk Male Boxing Null


a. Select * from PLAYERwhere PID=’P05’;
b. Select PNAME, GENDER, GAME from PLAYER where rank between 1 and 4;
c. Select * from PLAYER where Rank= 6;
d. Select PNAME from PLAYER where PNAME like ‘Sa%’;
e. Insert one more row in the above table having the following data:
f. P10, Kanika Gautam, Female, Hockey, 5

SECTION E

Miss Anita Bhati is a mathematics teacher. She often needs to evaluate her students
and analyze her scores to plan her teaching pedagogies. She has decided to use
technology for the same. Help her to perform the following task (a) to (d) using lists
in Python programming language.
a. Create a list named ‘scores’ having following values: 10, 7, 9, 11, 12, 15, 19, 20, 18,
34 4
4
b. Add the following values in the list using a single command.
15, 20, 45
c. Print the name of the value at index number 3.
d. Display the minimum sore from the list.

Ashwarekha is an enthusiastic science student. She wants to know about the


professional life of her favorite scientists and mathematicians. She decided to create
a table named Professor in the digital database named MyHeros. She asked her friend
Varahi to come up with a few questions, which can be answered using SQL queries.
Professor
P_ID PName Department Salary

1729 Ramanujam MATHEMATICS 500

1803 Heigenberg PHYSICS 150000


35 4
1704 Eular MATHEMATICS 6000

1610 Neils B CHEMISTRY 4000

1935 Allen T MATHEMATICS 101010


a. Varahi: Can you tell me the name of Professors of Mathematics with a salary less
than 10000? (write down the SQL query)
b. Varahi: In your table the monthly salary is stored. Can you display the name and
Annual Salary of these professors? (Write the query and use the alias “Annual
Income” for the resultant column).
KENDRIYA VIDYALAYA SANGATHAN JAIPUR REGION
QUESTION PAPER (SET-3)
CLASS: XI SESSION: 2022-23
INFORMATION PRACTICES (CODE 065)
TIME: 3 HRS M M: 70
General Instructions:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A has 18 questions carrying 01 marks each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
Internal choice is given in two questions (19 and 23).
5. Section C has 05 Short Answer type questions carrying 03 marks each.
Internal choice is given in two questions (29 and 30).
6. Section D has 03 Long Answer type questions carrying 05 marks each.
Internal choice is given in two questions (31 and 33).
7. Section E has 02 questions carrying 04 marks each.
One internal choice is given in Q 34 and 35 against part c only.
8. All programming questions are to be answered using Python Language only.

Mark
Q SECTION A
s

Which of the following is the correct sequence?


A. Gigabyte > Terabyte > Megabyte > Kilobyte
1 B. Kilobyte > Megabyte > Byte > Terabyte 1
C. Megabyte > Kilobyte > Terabyte > Gigabyte
D. Terabyte > Gigabyte > Byte > Nibble

Which one of the following is False regarding data types in Python?


A. In python, explicit data type conversion is possible
2 B. Mutable data types are those that can be changed. 1
C. Immutable data types are those that cannot be changed.
D. None of the above

What is DBMS?
A. DBMS is a collection of queries
3 B. DBMS is a high-level language 1
C. DBMS is a programming language
D. DBMS stores, modifies and retrieves data

Virtual Reality has been used in the field of __________.


A. Military training
4 B. Psychology 1
C. Medical procedures
D. All of the above

What one of the following is not a DDL Command?


A. Delete
5 B. Alter 1
C. Drop
D. Create
Given a string: s=’String’, Which statement converts string ‘s’ into List ‘L’.
A. L=s
6 B. L=list(s) 1
C. L=s[::]
D. all of the mentioned

Process of accessing or fetching data from storage device as per requirement is known as
:-
A. Data Retrieval
7 1
B. Data Capturing
C. Data Recovery
D. Data Backup

How is Column wise insertion of data different from simply passing values to a table?
A. Column wise data leads in populating data on an optional basis i.e. whether the
user wanted to insert data in a column or not.
8 B. We can’t pass value to a table without mentioning column names in an insert 1
statement.
C. Passing values to a table without column names is always safe.
D. None of the above.

Total number of Columns of a Relation is called?


A. Attribute
9 B.Tuple 1
C.Degree
D.Cardinality

Which of the following is not an operating system?


a) Windows
10 b) Linux 1
c) Oracle
d) Mac OS

MySQl is-
A. Proprietary Software
11 B. Free and Open Source Software 1
C. Shareware
D. None

Suppose d_emp = {"Name":"Roshni", "Age":27, "Gender":"Female"}. To obtain the number


of entries in the dictionary, which command do we use?
A. d_emp.size()
12 1
B. len(d_emp)
C. size(d_emp)
D. d_emp.len()

Which of the following SQL statement is invalid :


A. Select * from emp where empid= 121;
13 B. Select * from emp; 1
C. Select * where empid=121 from emp;
D. Select ename, empid from emp;

Which of the following is not a DBMS ?


14 A. MySQL 1
B. Ms-Excel
C. Oracle
D. DB/2

An attribute in a relation is a foreign key if the ________ key from one relation is used as an
attribute in that relation.
A. Candidate
15 1
B. Alternate
C. Super
D. Primary

Choose odd one out: -


A. SELECT
16 B. UPDATE 1
C. DROP TABLE
D. DELETE

Q17 and 18 are ASSERTION AND REASONING based questions.


Mark the correct choice as
i. Both A and R are true and R is the correct explanation for A
ii. Both A and R are true and R is not the correct explanation for A
iii. A is True but R is False
iv. A is false but R is True.

A: for loop is a compact loop.


17 R: for loop is a compact loop as it is much faster than the while loop. 1

A: The data in Big Data is not only voluminous, but also unstructured like posts, instant
messages, chats, photographs, tweets, blog articles, news items, comments, audio/video
18 chats, etc. 1
R: Such data can be analyzed using traditional data analysis tools like DBMS, spreadsheets
etc.

SECTION B

Find out the error(s) in the following python code:


print(‘even odd checker’)
n=input(‘enter the number’)
if(n%2==0):
print(‘even’)
else:
print(‘odd’)
OR
19 What will be the output of following program 2
a = True
b = False
c = False

if a or b and c:
print ("PYTHON PROGRAMMING")
else:
print ("python programming")

20 Explain CREATE command also Write down the syntax to create a table. 2

21 Write down the use of following: Printer,Plotter,Projector,Monitor 2


Find output of the following code fragment
Lst=[10,20,30,40]
Lst[1]=50
22 2
Lst[-1]=100
print(L)
print(Lst[1:3])

Consider the table Student {S_Id, S_Name, S_Age, S_Class, S_Fee}. Write the command to
display S_Id, S_Name and S_Age of the students whose Age is in the range 10 to 16 (both
inclusive).
OR
23 2
A table EMP has attributes EmpID, First_Name, Last_Name, Salary. Write down command
to add following data in the EMP table
i) 1111, NAVNEET, SHARMA, 60000
ii) 2222, NARESH, 50000

Assume a=100, b = 20 , find the value of each of the following :-


24 a. a//3+b^2 2
b. a+b > a+20

A gigabyte is equal to
A. 1024 bytes
25 B.1024 megabytes 2
C. Million megabytes
D. Thousand kilobytes

SECTION C

Classify as special purpose and generic software


a. Google Chrome:
b. Windows 8
26 c. Word-Processing Software
3
d. Ms-Excel
e. Notes
f. Avast Antivirus

What will be the output of the following python statements?


a,b,c = 10,40,20
27 a,c,b = b+10, a+20, c-10 3
print(a,b,c)
print(a+b//c**2)

Write a python program to display the sum of first n natural numbers (Note: Value of n
28 3
should be entered by the user).

Aman, an industrialist, wants to start a plant where production of Cars is to be done.He


wants his plant to be in this manner that less man power is used and cars are produced
through automated system.What kind of emerging trend will be applicable here and how?
OR
29 3
An incubator cell present in a university, provides the students the opportunity to create
the prototype of products/services that they seek to implement. It provides them
necessary hardware and software resources as well as access to the investors through
various tech fares. A group of students in such an incubator cell are trying to create an
emergency alert system that processes the data locally in real time instead of keeping and
processing it in the cloud. What kind of technology should they use to make use of each
smart device as a node, for sharing the data and processing. List down its one advantage
and one disadvantage.

i) Write down the name of the SQL command by which one can modify the structure of a
table? A table PRODUCT has attributes PID, PNAME, PRICE, DESCRIPTION.
30 ii) Write a command to add a new attribute QUANTITY of Integer type in this table? 3
OR
What are the constraints? Explain any two constraints.

SECTION D

Write a python program to create a dictionary called fruits with below data:
"Banana":60,
"Apple":80,
"Orange":55,
"Pineapple":80
31 Using loop, print out all the key along with its price and in the following format: 5
Fruit = Apple and Price = 2
Also print the total amount one would need to purchase all of your fruits.
OR
What is the purpose of pop(), popitem(), clear() methods used with dictionaries in
python?

Perform following operation using SQL commands


1. Create a database employee
2. Open this database
32 5
3. create tables empmaster with schema<empcode,name,address,salary>
4. Suppose database administrator has inserted 12 records in empmaster then what will
be the cardinality and degree of empmaster

Write the queries (a) to (e) based on the table given below:
Investor:
ID Name Age Village Income

1 Rangsa Marak 32 Kala Bakra 85000

2 Modi Sarkar 25 Badami 150000

3 M.G. Cholera 27 Lotte Golla Halli 65000


33 5
4 Jamesbond Singh 33 Nagina 85000

a) Display Name of Investor from Village Badami and Nagia


b) Show Name and Age of Investor, whose Age is either 32 or 33.
c) Display unique Incomes of the Investors
d) Add a new record Like Ika of age 23 from Village Clutter Buck Ganj.
e) What will be the output of the following Query:
SELECT Name,Village
FROM Investor
WHERE Name LIKE=’%M%k’;
OR
Consider the table - CUSTOMER given below. Write the output for (i) to (iv) and write sql
query for question (v)
CID CNAME LIMIT DOA BALANCE

1501 Sunder Garg 80000 2021-12-12 63524

1502 Kapil Jain 75000 2022-01-17 45284

1503 Anita Bhati 75200 2021-10-17 42517

1509 Vipul Patel 83500 2019-15-22 12482

1624 Seema Pratap 95000 2019-07-12 0

i. Select * from CUSTOMER where CID=1502;


ii. Select CNAME, LIMIT, DOA from CUSTOMER where BALANCE > 45000;
iii. Select * from CUSTOMER where LIMIT>75000 and BALANCE<15000;
iv. Select CNAME from CUSTOMER where DOA like ‘2019%’;
v. Two more rows are added to the above table. What will be the new cardinality of
the table?

SECTION E

Ms. Preeti Sexena is a Class Teacher of VIII. She often needs to maintain the health records
of her students and analyze her scores to plan her pedagogies. She has decided to use
technology for the same. Help her to perform the following task (a) to (d) using lists in
Python programming language.
34 4
a. Create a List named - height with the following values : 4
b. sort the elements of the list in ascending order
c. Find how many times the value 4.4 appeared in the list.
d. Display the maximum value from the list.

Huma is a sports fan. She wants to make a career as a sports journalist. She was given a
job as a sports columnist for her college magazine. She decided to present a featurette
about the Arjuna Award and the award receivers in the year 2022. She consulted her
friend Semim for preparation of the database. Here’s the conversation between them.

Huma: Hello Semim, would you please help me out with this project?
Semim: Sure. I would love to be a part of it. What would I get in return?
Huma: Garma Garam Jalebis made by Amma.
Semim: Wow, you sure know how to treat your bestie. Cheppa (tell me), what are your
queries?
Huma: Hmmm.. first of all we need to collect the data from https://pib.gov.in/, an official
35 4
website of the Ministry of Youth Affairs and Sports. We will then create a database and
various tables to perform the analysis.
Semim: Okay, let’s do it.
(They successfully obtained the data from the website and created the database and
tables.)
Huma: Thanks a ton but wait can you tell me how do I access this data when I am all by
myself?

a) How do I use the database named Sports?


b) How to find the list of various tables in the database?
c) I want to know the details of Arjuna Awardee players for the year 2022. What query
should I use in the table Arjuna_Puraskar_22?
d) Can you tell me the syntax of Insert Query?
Write down the answers for the above queries/questions.
KENDRIYA VIDYALAYA SANGATHAN JAIPUR REGION
CLASS: XI SESSION: 2022-23 (SET-4)
INFORMATION PRACTICES (CODE 065)
TIME: 3 HRS M M: 70
General Instructions:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A has 18 questions carrying 01 marks each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
Internal choice is given in two questions (19 and 23).
5. Section C has 05 Short Answer type questions carrying 03 marks each.
Internal choice is given in two questions (29 and 30).
6. Section D has 03 Long Answer type questions carrying 05 marks each.
Internal choice is given in two questions (31 and 33).
7. Section E has 02 questions carrying 04 marks each.
One internal choice is given in Q 34 and 35 against part c only.
8. All programming questions are to be answered using Python Language only.

Q SECTION A

Which of the following processes is used to reinstall/restore data from a copy when
the original data has been lost?
A. Update
1 B. Backup 1
C. Recovery
D. None of these

What will be the value of the following Python expression?


4+3%5
A. 7
2 B. 2 1
C. 4
D. 1

Which of the following is not an example of DBMS?


A. MySQL
3 B. Microsoft Access 1
C. IBM DB2
D. Google

Network of interconnected items with integrated sensors that can gather and
transmit data in real time is known as the _______.
A. Internet of Things
4 1
B. Big Data
C. Model
D. None of the above

What is the DDL command out of the following to remove a table?


5 1
A. Remove
B. Delete
C. Drop
D. Pop

What will be the output of the following code segment?


l=[‘A’, ’a’, ’Aa’ ,’aA’]
print(max(l))
6 A. ‘A’ 1
B. ‘a’
C. ‘Aa’
D. ‘aA’

DVD stands for : -


A. Digital Versatile Drive
7 B. Digital Video Drive 1
C. Digital Volume Drive
D. Digital Versatile Disk

How can you insert a new row into the “STORE” table
A. INSERT ROW (1,‟ RAM SINGH‟) INTO STORE;
B. INSERT VALUES (1,‟ RAM SINGH‟) INTO STORE;
8 1
C. INSERT INTO (1,‟ RAM SINGH‟) STORE;
D. INSERT INTO STORE VALUES (1,‟ RAM SINGH‟)

Total number of Rows of a Relation is called?


A. Attribute
9 B.Tuple 1
C.Degree
D.Cardinality

The ___________ acts as an interface between the device and the operating system.
A. Device Conductor
10 B. Device Driver 1
C. Hardware Drive
D. Hardware Conductor

MySQl is Case Sensitive-


A. Yes
11 B. No 1
C. Keywords/Commands are Case Sensitive
D. All of Above

What will be the output of the following Python code snippet?


fruits = {'Apples':1, 'Bananas':4, 'Grapes':17, 'Oranges':14}
print(list(fruits.keys()))
12 A. (1, 4, 17, 14) 1
B. ('Apples', 'Bananas', 'Grapes', 'Oranges')
C. [1, 4, 17, 14]
D. ['Apples', 'Bananas', 'Grapes', 'Oranges']

Identify the odd one out


A. Select
13 B. Desc 1
C. From
D. Where
A ___________ is a collection of attributes alligned vertically in a table.
A. Column
14 B. Row 1
C. Cell
D. Data

______________ is a set of one or more attributes taken collectively to uniquely identify


a record.
A. Primary Key
15 1
B. Foreign key
C. Super key
D. Candidate key

Mr. Rajan wants to add a new attribute in an existing table in MySql, which
command he should use : -
A. DESCRIBE
16 1
B. ALTER TABLE
C. DELETE
D. INSERT ATTRIBUTE

Q17 and 18 are ASSERTION AND REASONING based questions.


Mark the correct choice as
i. Both A and R are true and R is the correct explanation for A
ii. Both A and R are true and R is not the correct explanation for A
iii. A is True but R is False
iv. A is false but R is True.

A: When we place a loop inside another loop it is called a nested loop.


R: Programming language supports the concept of nesting. for example if we place
17 1
an if statement inside another if statement statement, it is called a nested if
statement.

A: Web of Things (WoT) allows the user to browse the web using anything in the
physical world like a toaster, an oven or a fan.No need of a phone or a PC.
18 R: The ‘Internet of Things’ is a network of devices that have embedded hardware 1
and software to communicate (connect and exchange data) with other devices on
the same network.

SECTION B

Find out the error(s) in the following python code:


if(4>9):
print(‘4 is greater than 9’)
else if(9>4):
print(‘4 is smaller than 9’)
else(4==9):
print(‘4 is equal to 9’)
19 OR 2
What will be the output of following program
num = 5
sum = 0
while num> 0:
sum += num
num -= 2
print( sum)
Consider the following SQL statement.
S1: CREATE TABLE employee (eno CHAR(3), name VARCHAR(20));
20 2
S2: INSERT INTO employee VALUES (‘E01’,RAHUL DRAVID’);
From S1 and S2, which one is DDL and which one is DML?

21 Define computer,draw block diagram of computer. 2

Find output of the following code fragment


Lst=[10,20,30]
Lst.append(50)
Lst.pop(0)
22 2
print(Lst)
Lst.pop( )
Lst.append(60)
print(Lst)

Consider the table Employee {EId, EName, Age, Designation, Salary, Department}.
Write the command to display EId, EName, Designation and Department of the
employees whose name start with A and department is IT.

OR
23 2
State True or False in reference with INSERT INTO command of SQL?
i) INSERT is not a part of DDL?
ii) While adding tuples using the INSERT command, one must specify values for all
the attributes of the table.

24 Give two examples each of Logical and Relational Operators in Python. 2

Rearrange the following units in increasing order:


25 2
MB bit TB byte KB

SECTION C

Classify the following software as System software and Application software


a. Adobe PhotoShop
b. Windows 10
26 c. Disk Defragmenter
3
d. Ms-Word
e. Google Chrome
f. Avast Antivirus

Evaluate (to true or false)each of the following expression:


14<=14
27 14<14 3
-14 > -15
-15 >=15

Write a python program to print the factorial of a number (Note: number should be
28 3
entered by the user).

29 The Air LMN Airlines Group want to train pilot. The trainees can take the headset 3
home and train for as long as they need. This includes them familiarizing the
aircraft and 360-degree walkarounds.What kind of emerging trend is useful here

OR
CBSE has started to provide the digital copy of the marksheets online. Which
technology can be used to provide the decentralized data sharing architecture?
One in which safety and security of the transactions are ensured because all the
members in the network keep a copy of the file and so it is not possible for a single
member of the network to make changes or alter data. Can the same tech be applied
in other areas? (If yes, Write the names of two such areas)

A table PRODUCT has attributes PID, PNAME, PRICE, DESCRIPTION. Write


commands for followings: -
i) Make the PID attribute as the Primary key of this table.
ii) Change the data type of PRICE column to FLOAT(7,2)
30 3
iii) Remove the attribute DESCRIPTION
OR

Explain the concept of Primary Key, Candidate Key and Alternate Key.

SECTION D

Write a python program to create a dictionary of students to store the record of n


students with marks obtained in 5 subjects for each student. Print the name and
average marks in alphabetical order.
31 5
OR
Explain the use of following methods: -
a) keys()
b) values()

Perform following operation using SQL commands


1. Create a database company
2. Open this database
32 5
3. create tables product with schema<productid,name,price>
Suppose database administrator has inserted 33 records in product table then
removed 4 records from it.what will be the cardinality and degree of product.

Write the queries (a) to (e) based on the table given below:
Table: Professor
P_ID PName Department Tinkha

1729 Ramanujam MATHEMATICS 500

1803 Heigenberg PHYSICS 150000

33 1704 Eular MATHEMATICS 6000 5


1610 Neils B CHEMISTRY 4000

1935 Allen T MATHEMATICS 101010

a) Display details of all Professors From the Mathematics Department.


b) Display the names of different departments without repetition.
c) Show P_ID and Tinkha whose department is not chemistry.
d) Add a new Professor with Id: 1995,Name: H. C. Verma, Tinkha:19999
e) What will be the output of the following Query:
SELECT P_ID as Joining_Year, PName
FROM Professor
WHERE Tinkha<>6000 AND Department=’Physics’;
OR
Consider the table - TRANSACTION given below. Write the output for (i) to (iv) and
write sql query for question (v)
TNO ACNO TTYPE DOT AMOUNT

143 12513 Deposit 2021-12-12 15000

149 12545 Withdraw 2022-01-17 12514

145 12548 DD 2021-10-17 12514

153 14587 Withdraw 2019-15-22 12545

142 12546 Deposit 2019-07-12 25245

i. Select * from TRANSACTION where TNO=142’;


ii. Select ACNO, TTYPE, DOT from TRANSACTION where rTTYPE in
(‘DD’,’Withdraw’);
iii. Select * from TRANSACTION where AMOUNT <= 1500 and AMOUNT >=
5000;
iv. Select distinct TTYPE from TRANSACTION;
v. Two more rows are added to the above table. What will this change- degree
or cardinality of the table?

SECTION E

Ms. Anjana is a Super Store Manager. She often needs to maintain the records of
products in the store and analyze data to plan her sales targets. She has decided to
use technology for the same. Help her to perform the following task (a) to (d) using
lists in Python programming language.
34 a. Create a List named - ‘price’ with the following values 780, 390, 110,145, 4
224, 390, 165, 390, 444, 254, 77
b. remove the last added element in the list.
c. Delete the first occurance of 390 from the list.
d. Sort the elements of the list in descending order.

Hemachndra Rawat likes to play competitive video games and he also records his
gaming session on twitch. One day his cousin Shrea calls him to help her out with a
school project about esports. Here’s the snippet of their conversation.

Shrea: I would like to create a digital database about recent and popular game titles.
Can you help me out with that?
35 Hemachandra: Why not. Just let me know what the details are you looking for. 4
Shrea: I want to know the names of popular games, their production companies,
Genre, Download count, followers on social media etc.
Hemachandra: I think I can work with that. I’ll create a database and a few tables,
you can populate them with the data later on.
Shrea: Great. Can you tell me how to check the results?
Hemachandra: Of course. I’ll tell you how to create and manage your database.
We will use MySQL for this purpose.

They created the database and the tables and now Shrea is ready with some queries
to test the database. Answer her query on Hemchandra’s behalf:

a) How do I list various databases in MySQL?


b) Which command to use in order to see the table structure?
c) Can I insert the values in a table without following the sequence?
If yes, Can you tell me the syntax to insert (Overwatch, FPS, 3300000) in a table
having 3 columns: (Name, Followers, Genre).
If not, can you tell me the way/query to do so the right way?
KENDRIYA VIDYALAYA SANGATHAN JAIPUR REGION
QUESTION PAPER (SET-5)
CLASS: XI SESSION: 2022-23
INFORMATION PRACTICES (CODE 065)
TIME: 3 HRS M M: 70
General Instructions:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A has 18 questions carrying 01 marks each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
Internal choice is given in two questions (19 and 23).
5. Section C has 05 Short Answer type questions carrying 03 marks each.
Internal choice is given in two questions (29 and 30).
6. Section D has 03 Long Answer type questions carrying 05 marks each.
Internal choice is given in two questions (31 and 33).
7. Section E has 02 questions carrying 04 marks each.
One internal choice is given in Q 34 and 35 against part c only.
8. All programming questions are to be answered using Python Language only.

Q SECTION-A Marks

Software programs developed for performing particular tasks related to


managing computer resources is called
A. System software
1 1
B. Utility software
C. Application software
D. Helper software

Process of removing errors called


A. Error Free
2 B. Debug 1
C. Syntax Error
D. Exception

Which of the following is not a function of the database?


A. Managing stored data
3 B. Manipulating data 1
C. Security for stored data
D. Analysing code

What are the characteristics of big data?


A. Volume & Velocity
4 B. Variety & Veracity 1
C. Value
D. All of the above

What is the DDL command out of the following to rename a column?


A. Change Name
5 B. Rename 1
C. Modify Name
D. Alter Name
which command we use cane use To remove string “hello” from list1, Given,
list1=[“hello”]
A. list1.remove(“hello”)
6 1
B. list1.pop(list1.index(“hello”))
C. both a & b
D. none of these

Which one of the followings is true in the context of Memory: -


A. Secondary memory is faster than Primary memory
7 B. All Primary memories are volatile in nature 1
C. Secondary memory is portable
D. Cache memory decreases the performance of the computer

When using the SQL INSERT statement:


A. rows can be modified according to criteria only.
B. rows cannot be copied in mass from one table to another only.
8 C. rows can be inserted into a table only one at a time only. 1
D. rows can either be inserted into a table one at a time or in groups.

A relation is having 5 columns and 6 rows, find out the Degree and
Cardinality of this Relation-
A. 1 Degree and 1 Cardinality
9 1
B. 6 Degree and 5 Cardinality
C. 5 Degree and 6 Cardinality
D. 2 Degree and 2 Cardinality

Which of the following are examples of Proprietary Software?


A. MS Office
10 B. Talley 1
C. Both A and B
D. None

Which is not a valid Data Type of SQL?


A.int
11 B. Varchar 1
C. Date
D. Time

What will be the output of the following Python code snippet?


d1 = {"abc":234, "xyz":567}
d2 = {"abc":123, "xyz":567}
print(d1 > d2)
12 1
A. False
B. True
C. Error
D. None

SQL Statement used to extract data from one or more tables is


A. Select
13 B. From 1
C. Where
D. Describe / Desc

14 Which of the following is/are a need to use DBMS? 1


A. Store large volume of data
B. Effective way to retrieve meaningful data
C. Avoids redundancy of data.
D. All of the above.

Which of the following(s) can be a composite key?


A. Primary
15 B. Alternate 1
C. Candidate
D. All of these

Select correct pair of DML commands out of followings: -


A. CREATE TABLE, INSERT
16 B. DROP TABLE, SELECT 1
C. DELETE, DROP TABLE
D. INSERT, UPDATE

Q17 and 18 are ASSERTION AND REASONING based questions.


Mark the correct choice as
i. Both A and R are true and R is the correct explanation for A
ii. Both A and R are true and R is not the correct explanation for A
iii. A is True but R is False
iv. A is false but R is True.

A: Jump statements in python are used to alter the flow of a control statement like
17 you want to skip a part of a loop or a condition 1
R: break, continue and pause are three jump statements available in a python.

A: In cloud computing, computer-based services are delivered over the Internet


or the cloud, they are accessible from anywhere using any smart device.
18 1
R: The cloud services comprise software, hardware (servers), databases, storage,
etc. These services can be used as a pay per use basis, just like we use electricity.

SECTION B

Find out the error(s) in the following python code:


print(‘enter a number between 1 and 9’)
num=int(input()))
if(num>9):
print(‘the number is greater than 9’)
elif(num<0):
print(‘the number is less than ‘0’)
else:
print(‘good buoy/garl’)
19 2
OR
What will be the output of following program
n=0
while n < 5:
n+=1
if n==3:
continue
print (n,end=’ ’)
print("Loop Over")
Choose an appropriate answer with respect to the following code snippet.
CREATE TABLE Staff
( StaffID CHAR (5) PRIMARY KEY,
FirstName VARCHAR (20) NOT NULL,
LastName VARCHAR (15),
20 2
IsQualified CHAR(4) )
);
i) What will be the degree of this table?
ii) What does ‘IsQualified’ represent in the above code snippet?

21 Write down any four features of 5th generation computers 2

Differentiate append() and extend() methods used with lists? Illustrate with
22 2
an example of both?

Consider the table Employee {EId, EName, Age, Designation, Salary, Department}.
Write the command to display EId, EName, Age, Designation and Department of
the employees whose Age is greater than 18 or department is not HR.

23 OR 2
Name the command to add new tuples into a table? State the information one
needs before adding a new tuple into a table?

Differentiate between the interactive mode and script mode available with python
24 IDLE. 2

A nibble is composed of-


A. 8 bits
25 B. 2 bits 2
C. 4 bits
D. 6 bits

SECTION C

Give an example of software for each the following purpose:


a. Typing a Novel
b. Editing a Photograph
26 c. Protecting computer system from virus
3
d. Creating Graphs on available numeric data
e. Joining a data source with a fixed letter format to create multiple letters
f. Creating a poster

Write python code to convert the time given in minutes into hours and
27 3
minutes.

Write a python program to print the below shown pattern where no. of rows
should be entered by the user (Note: no. of rows should be less than equal to
20 else show error).
28 * 3
* *
* * *
* * * *
Mr. Anil Mohan is a computer teacher ,he want to explain about use of machine
learning through some example.Suggest any 3 suitable example or application
area where machine learning can be used.

OR

The new addition of the Apple watch has a feature called “Crash Detection”. Which
29 3
can send an SOS to the emergency contact and the emergency services. This can
be a life saving feature for many unfortunate people who otherwise lose their lives
due to the lack of immediate emergency support at the time of the need. The crash
detection algorithm needs data to process and identify the situation. How do you
think that data is provided to the algorithm? Can you list two such data/input
providers in a wearable?

Write down SQL commands for following tasks: -


i) Open a database
ii) Remove/Delete a database
iii) Remove/Delete a table from a database
30 3
OR

Explain the concept of DDL, DML and DQL commands.

SECTION D

Consider the below data, Write a python program to perform below tasks.
"Banana":60,
"Apple":80,
"Orange":55,
"Pineapple":80
(a) Print the list of values
(b) Remove 'Orange' from the dictionary
(c) Create the copy of the dictionary
(d) Update the price for Apple to 100
31 5
(e) Remove all the items from the dictionary

OR

Explain the use of following methods: -


a) items()
b) update()

Table SALE
PRODID QTY RATE AMOUNT
1 10 100 1000
2 5 50 250
32 5
a. Write sql commands create above table SALE with suitable datatype
b. Can we take the QTY column of SALE table as Primary Key? If no give reason
c. Which column is best suitable for applying Primary Key?
d. what is the cardinality of above table
e. what is the degree of above table

Write the queries (a) to (e) based on the table given below:
Course
C_ID F_ID Cname Fees

C21 102 Grid Computing 40000

C22 106 System Design 16000

C23 104 Network Security 80000

C24 106 Human Biology 150000

C25 102 Computer Network 20000

a) Display details of all courses having string ‘comp’.


b) Display C_ID and F_ID whose Fee is less than 50000.
c) Show CName and Fee taken by Faculty 106 and 102.
d) Add a new record in the table (‘C26’,NULL,’AI with Python’,60000)
e) What will be the output of the following Query:
SELECT DISTINCT F_ID FROM Course;

OR
33 Consider the table - RESTAURANT given below. Write the output for (i) to (iv) and 5
write sql query for question (v)
SNO NAME TYPE DOA COST

561 Chinese Bhel Fast Food 2021-12-12 150

761 Veg Manchurian Filler 2022-01-17 80

987 Veg Kofta Main Course 2021-10-17 260

345 Malai Paneer Main Course 2019-15-22 230

234 Rava Idli Fast Food 2019-07-12 120

i. Select * from RESTAURANT where SNO= 761;


ii. Select NAME, TYPE, DOA from RESTAURANT where cost in (230, 260, 300);
iii. Select * from RESTAURANT where NAME like = ‘%roti%’;
iv. Select NAME from RESTAURANT where DOA between ‘2022-01-01 and
‘2022-12-31’’;
v. Add one more row to the above table with the following data
SNO- 111; NAME: Tawa Roti, Cost : 20. Values for the other attributes not available

SECTION E

Ms. Vijeta is a climatologist. She often needs to maintain the records of


temperature of the area under study and analyze data to forecast weather. She has
34 decided to use technology for the same. Help her to perform the following task (a) 4
to (d) using lists in Python programming language.
a. Create a list named ‘temp’, with the following values :
27,29,33,34,28,26,27,28,30,31,32,28
b. Reverse the order of the elements in he list
c. Display the first three elements of the list.
d. Add 32 as a new element at the last of list

A shop called Rainbow Garments that sells school uniforms, maintains a database
SCHOOL_UNIFORM. It consisted of two relations — UNIFORM and PRICE. They
made UniformCode as the primary key for UNIFORM relations. Specify SQL
queries to rectify the following anomalies.
a) There’s a new product, a Handkerchief. The colors are Red and White. The
35 4
Price is Rs. 100. The PID is ‘hkcf2004’ and ‘hkcf2005’ respectively. Insert
the above data in the Relation Product(PID, Name, Color, SIze, Price).
b) Write down the query to check the table contents.
c) Write down the query to display all the products with size “S” and color
“Blue”.
KENDRIYA VIDYALAYA SANGATHAN JAIPUR REGION
Marking Scheme SET-1
CLASS: XI SESSION: 2022-23
INFORMATION PRACTICES (CODE 065)
TIME: 3 HRS M M: 70
General Instructions:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A has 18 questions carrying 01 marks each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
Internal choice is given in two questions (19 and 23).
5. Section C has 05 Short Answer type questions carrying 03 marks each.
Internal choice is given in two questions (29 and 30).
6. Section D has 03 Long Answer type questions carrying 05 marks each.
Internal choice is given in two questions (31 and 33).
7. Section E has 02 questions carrying 04 marks each.
One internal choice is given in Q 34 and 35 against part c only.
8. All programming questions are to be answered using Python Language only.

Mar
Q Part-A
ks

What was the name of the first computer designed by Charlse Babbage?
A. Analytical Engine
B. Difference Engine
1 1
C. Colossus
D. ENIAC
Ans. B. Difference Engine

Which statement is correct?


A. List is immutable && Tuple is mutable
B. List is mutable && Tuple is immutable
2 C. Both are Mutable. 1
D. Both are Immutable
Ans. B. List is mutable && Tuple is immutable

What is a database?
A. Organized collection of information that cannot be accessed, updated, and
managed
B. Collection of data or information without organizing
3 C. Organized collection of data or information that can be accessed, updated, 1
and managed
D. Organized collection of data that cannot be updated
Ans. C. Organized collection of data or information that can be accessed,
updated, and managed

__________ is a subsystem of Artificial Intelligence, wherein computers have the


ability to learn from data using statistical techniques, without being
4 explicitly programmed by a human being. 1
A. Artificial Intelligence
B. Machine Learning
C. Data Science
D. None of the above
Ans. B. Machine Learning

What is the full form of DDL out of the following?


A. Drive Dilution Language
B. Data Deletion Language
5 1
C. Data Definition Language
D. Data Defragmentation Language
Ans. C. Data Definition Language

Which statement does not show any error after execution? Given L=[1,2,3,4]
A. print(L+L)
B. print(L*L)
6 1
C. print(L-L)
D. All of the mentioned
Ans. A. print(L+L)

Which of the followings is a type of Primary memory: -


A. Memory Card
B. Compact Disk
7 1
C. ROM
D. Pen Drive
Ans. C. ROM

SQL INSERT statement adds ............... records to any single table in a relational
database
A. One
8 B. One or More 1
C. only two
D. None of Above
Ans. B. One or More

Rows of a Relation are called?


A. Attributes
B.Tuples
9 1
C.Degree
D.Cardinality
Ans. Tuple

_______________ is designed to solve a specific problem or to do a specific task.


A. Application Software
B. System Software
10 1
C. Utility Software
D. User
Ans. A. Application Software

Which is the full form of SQL out of the following?


A. Standard Query language
B. Standard Quantum Language
11 1
C. Structured Query language
D. Structured Quantum language
Ans. Structured Query language

12 Which line of code correctly adds an item to the fruits dictionary with a key 1
of 'Blackberry' and a value of 20?
fruits = {'Apples':1, 'Bananas':4, 'Grapes':17, 'Oranges':14}
A. fruits['Blackberry'] = 20
B. add fruits['Blackberry'] = 20
C. insert 'Blackberry':20 in fruits
D. fruits[20] = 'Blackberry'
Ans. A. fruits['Blackberry'] = 20

A * symbol in the SQL Select statement signifies


A. All rows to be selected from a given table.
B. All columns of the given table to be included in the query result.
13 1
C. Complete Table to be displayed.
D. None of the above
Ans. B. All columns of the given table to be included in the query result.

In MySQL, statements should be written in


A. upper case only
B. lower case only
14 1
C. title case
D. MySQL statements are not case sensitive
Ans. D. MySQL statements are not case sensitive

For each attribute of a relation, there is a set of permitted values, called the
________ of that attribute..
A. Relation
15 B. Domain 1
C. Tuple
D. Degree
Ans. B. Domain

MySQL is ………………………….. software


A. RDBMS
B. DBMS
16 1
C. Proprietary
D. Spreadsheet
Ans. A. RDBMS

Q17 and 18 are ASSERTION AND REASONING based questions.


Mark the correct choice as
i. Both A and R are true and R is the correct explanation for A
ii. Both A and R are true and R is not the correct explanation for A
iii. A is True but R is False
iv. A is false but R is True.

A: Loops are used to repeat a group of statements under a condition.


17 R: Two commonly used loops in python are for loop and while loop. 1
Ans. ii Both A and R are true and R is not the correct explanation for A

Internet of Things (IoT), Sensors, Smart cities, Cloud Computing and Cloud
Services (SaaS, IaaS, PaaS); Grid Computing, Block chain technology.
A: In Machine Learning, computers have the ability to learn from data using
18 statistical techniques. 1
R: After successive training, ML Models are used to make predictions about
new and unknown data.
Ans. (i) Both A and R are true and R is the correct explanation for A
Part-B

Find out the error(s) in the following python code:


a,b=9,56
if(a<b)
print(‘a is smaller than b’)

Ans.
errors in the code:
a,b=9,56
if(a<b) # : symbol is missing
print(‘a is smaller than b’) #indentation is missing

correct code:
a,b=9,56
19 2
if(a<b):
print(‘a is smaller than b’)
OR
What will be the output of following program
x=1234
while x%10:
x=x//10
print(x)
Ans.
123
12
1
0

Define DDL commands of SQL with examples.


Ans. DDL: - Data Definition Language (DDL) provides commands for defining
20 2
relation schemas, deleting relations, creating indexes, and modifying
relation schemas. For example: CREATE, ALTER, DROP etc.

Write down any four advantages of using computer


21 2
Ans. Speed,Accuracy,Multi tasking,Large storage etc.

A list in python is Mutable or Immutable? Justify your answer with an


example?
Ans.
List in python is Mutable
List is mutable because its individual elements can be modified.
Example
22 L=[10,20,30] 2
print(L)
L[0]=50
print(L)
output will be
[10,20,30]
[50,20,30]

What is the SELECT command? Write down its basic syntax.


Ans.
23 2
The SELECT command is used to retrieve the data from a database.
SELECT column1, column2, ...
FROM table_name;
OR
Ms. Namita is trying to add a new record in a table named PERSON. she wrote
following query but got an error: -
INSERT RECORD INTO PERSON VALUE [101,”Sandeep”, 9955882200]
Write a correct query to add the above record?

Ans.
INSERT INTO PERSON VALUES(101,”Sandeep”, 9955882200)

Classify the following operators as logical, relational or assignment operator


> , = , ==, and
Ans: > : Relational
24 = : assignment 2
==: Relational
and : Logical

1. What will be units in bytes for following: 1KB, 1MB, 1GB, 1 TB


Ans: 1KB=2 raise to power 10 byte , 1MB=2 raise to power 20 byte,
25 2
1GB=2 raise to power 30 byte, 1 TB=2 raise to power 40 byte

Part-C

Differentiate between software System and Application software ? Give an


example in each case.
Ans:The system software is used for operating computer hardware. On the
other hand, Application software are installed according to the user's
26
requirements. 3

1 Mark for each correct explanation of system and Application Software. ½


mark each for the correct example.

Write a program to take user input and find number is odd or even
Ans-
inp_num = input("Enter a number: ")
#Convert string to int
inp_num = int(inp_num)
27 if inp_num == 0: 3
print(inp_num, "is Even")
elif inp_num%2==0:
print(inp_num, "is Even")
else:
print(inp_num, "is Odd")

Write a python program to display the largest of 3 numbers using if..elif..else


statement(s).
Ans.
num_first = int(input("Enter first number: "))
28 num_second = int(input("Enter second number: ")) 3
num_third = int(input("Enter third number: "))
if (num_first > num_second) and (num_first > num_third):
print(num_first, "is largest")
elif (num_second > num_first) and (num_second > num_third):
print(num_second, "is largest")
else:
print(num_third, "is largest")

Artificial Intelligence (AI) is a discipline that aims to create robots that are
intelligent enough to do jobs that are typically performed by humans only.
Identify aspects which are still beyond the capabilities of artificial
intelligence
Ans: High processing power, emotional intelligence, it cannot learn to think
outside the box
OR
A new initiative named PMSHREE is being implemented in various schools
29 across India. The scheme is to make the IOT enabled, smart and model 3
schools. Please suggest three iOT enabled solutions to make the school smart.
Ans.
a) e-textbooks
b) Smart boards
c) Online tests using personal smart devices
d) Wifi sensors on classrooms doors
e) Sensors in buses to monitor their location
f) Wearables (watches or smart belts) for attendance monitoring

Write down name of commands for followings: -


i) Making a new database in MySql
ii) Obtaining a list of existing databases
iii) Opening a database

Ans
i) CREATE DATABASE
ii) Show Databases
iii) USE
30 3
OR
What do you understand by the term database? Write any four advantages of
using a database over the traditional file system.
Ans.
A database is an organized collection of structured information, or data,
typically stored electronically in a computer system.
Its advantages are data redundancy and inconsistency, data sharing, data
security and data integrity etc.

Part-D

Write a python program to create a dictionary where the keys are numbers
(between 1 to 10) and the values are sum of the first key th (1 to key) natural
numbers.
Ans.
my_dict = {}
31 5
sum = 0
for i in range(1, 11):
sum += i
my_dict[i] = sum
print(my_dict)
OR
a) Define a Dictionary with an example in respect of Python?
b) Write down any two characteristics of a python Dictionary?
c) What is the purpose of the dict() method?

Ans
a) Python Dictionaries are a collection of some key:value pairs enclosed
within {}.
Example - {‘Rollno’:101, ‘Name’: ’Jordan’, ’Age’:25}

b)
i) Dictionary is mutable but keys are immutable
ii)keys are unique

c)
dict() method is used to create a blank dictionary.
D1=dict()

Write a SQL statement to create a table jobhistory in job database with


following structure
+------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+-------+
| JOB_ID | varchar(10) | NO | | | |
| JOB_TITLE | varchar(35) | NO | | NULL | |
| MIN_SALARY | decimal(6,0) | YES | | NULL | |
| MAX_SALARY | decimal(6,0) | YES | | NULL | |
+------------+--------------+------+-----+---------+-------+
Write Sql statement for following
32 a. Create a database job 5
b. Before creation of table open the newly created database job
c. create a table jobhistory with above structure
d. Which field can be created as Primary key
e. What will be the degree of table/relation jobhistory
Ans.
a. create database job;
b. use job;
c. create table jobhistory(JOB_ID varchar(10), JOB_TITLE varchar(35)
NULL , MIN_SALARY decimal(6,0) NULL decimal(6,0) );
d. JOB_ID
e. 4

Answer the question (a) to (e) based on the table, PLAYER given below:
Player
PID PName Gender Game Rank

P01 Sunny Paji Male Cricket 5


33 5
P02 Marry Kaun Female Boxing 3

P03 Saniya Mircha Female Tennis 5

P04 Sachin Reelkar Male Cricket 1


P05 Vijender Maohawk Male Boxing Null
a) Display details of all Male players.
b) Display player name and game whose rank is 1 to 3
c) Show PID,PName and Rank whose game is either Boxing or Cricket.
d) Add a new record in the table (“P06”, ”Abhinav”,”Male”,”Shooting”,1)
e) What will be the output of the following Query:
SELECT Pname as Player_Name, Game
FROM Player
WHERE Game=’Tennis’;
Ans.
a) SELECT * FROM Player WHERE Gender=’Male’;
b) SELECT Pname,Game FROM Player WHERE Rank BETWEEN 1 AND 3;
c) SELECT PID,PName,Rank FROM Player
WHERE Game IN (’Boxing’,’Cricket’);
d) INSERT INTO Player VALUES (“P06”, ”Abhinav”,”Male”,”Shooting”,1);
e)
Player_Name Game

Saniya Tennis
Mircha

OR
Consider the table -TICKET given below. Write the output for (i) to (iv) and
answer the question (v)
TKTN PNAME SOURCE DESTINATIO FARE
O N

1725 Amrit Jain Jaipur Kota 340

1425 Vimal Kumar Jaipur Mumbai 570

1121 Vickey Kaushal Kota Mumbai 660

1252 Vikek Shah Karauli Jaipur 190

1251 Urmila Pandey Banswada Udhampur 850


i. Select * from TICKET where TKTNO=1425;
ii. Select PNAME, SOURCE, DESTINATION from TICKET where price
between 300 and 660);
iii. Select * from TICKET where SOURCE = ‘AJMER’;
iv. Select PNAME from TICKET where PNAME like ‘vi%’;
v. What is the degree of the above table?

ANS:
i.
TKTN PNAME SOURCE DESTINATION FARE
O

1425 Vimal Jaipur Mumbai 570


Kumar
ii.
PNAME SOURCE DESTINATION

Amrit Jain Jaipur Kota

Vimal Kumar Jaipur Mumbai

Vickey Kaushal Kota Mumbai


iii
Empty set

iv

PNAME

Vimal Kumar

Vickey Kaushal

Vikek Shah

v. 5
1 mark for correct output. ½ mark for partial correct output.

Part-E

Mr. Tushar Kapoor, is a games teacher. He needs to prepare a list of students


who are selected for regional level sports meets. later he needs to perform
some actions on the list so prepared. He is of the view that the task can be
accomplished easily using python lists data structure. Help him to perform
the following task using lists in Python programming language.
a. create a list named ‘Regional’ with the following values :- ‘Amrit’,
‘Kanika’, ‘Salman’, ‘Vivek’, ‘Anita’, ‘Vipin’
b. print the number of students in the ist.
34 c. remove the student at the third index. 4
d. Display last three elements in the list
Ans:
a. Regional = ['Amrit', 'Kanika', 'Salman', 'Vivek', 'Anita', 'Vipin']
b. len(Regional)
c. Regional.pop(3)
d. Regional[-1:-4:-1]
1 mark for each correct answer. ½ mark, for recognition of proper
command/ function.

Mr Vanaram has opened a coaching institute in his home city Yalahanka. He


has a bit of experience with database design but forgot a few things here and
there. He has called his best buddy Ramanatham for help. Let’s assume you
are Ramnatham, help out your friend to set up and test the database thus
created.
35 Course 4
C_ID F_ID Cname Fees

C21 102 Grid Computing 40000

C22 106 System Design 16000


C23 104 Network Security 80000

C24 106 Human Biology 150000

C25 102 Computer Network 20000

a) Help Vanaram by filling out the missing bits in the table creation
process:
CREATE ____(i)____ Course(
C_ID CHAR(3),
F_ID ___(ii)____,
Cname VARCHAR (20),
Fees INT);
b) Vanaram: Hey Rama, would you please write the INSERT query for the
first row? I’ll follow and write the subsequent one myself.
c) Vanaram: I want to see the data of the table but the query: SELECT ALL
FROM TABLE Course; is not working. Can you fix it?
Ans.
a) (i) TABLE (ii) INT
b) INSERT INTO Course VALUES(‘C21’,102,’Grid Computing’,40000);
c) SELECT * FROM Course;
2+1+1=4 Marks
KENDRIYA VIDYALAYA SANGATHAN JAIPUR REGION
MARKING SCHEME (SET - 02)
CLASS: XI SESSION: 2022-23
INFORMATION PRACTICES (CODE 065)
TIME: 3 HRS M M: 70
General Instructions:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A has 18 questions carrying 01 marks each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
Internal choice is given in two questions (19 and 23).
5. Section C has 05 Short Answer type questions carrying 03 marks each.
Internal choice is given in two questions (29 and 30).
6. Section D has 03 Long Answer type questions carrying 05 marks each.
Internal choice is given in two questions (31 and 33).
7. Section E has 02 questions carrying 04 marks each.
One internal choice is given in Q 34 and 35 against part c only.
8. All programming questions are to be answered using Python Language only.

Q. N. Part-A Marks

Which of the following groups are only input devices?


A. Mouse, Keyboard, Monitor, Joystick
B. Mouse, Keyboard, Printer, Light-Pen
1 1
C. Mouse, Keyboard, Scanner, Joystick, Light-Pen
D. Mouse, Keyboard, Trackball, Speaker, Microphone
Ans. C. Mouse, Keyboard, Scanner, Joystick, Light-Pen

Which of the following characters is used to give single-line comments in Python?


A. //
B. #
2 1
C. !
D. /*
Ans. B. #

What is the full form of DBMS?


A. Data of Binary Management System
B. Database Management System
3 1
C. Database Management Service
D. Data Backup Management System
Ans. B. Database Management System

___________ deals with the interaction between humans and computers using human
spoken languages, such as Hindi, English, etc.
A. Data Science
4 B. Neuroscience 1
C. Natural Language Processing
D. All of the above
Ans. C. Natural Language Processing
Which one is the command to add a new column in an already existing relation in SQL?
A. Add
B. Alter
5 1
C. Insert
D. Change
Ans. B. Alter

Which of the following commands will sort list1 in descending order?


A. list1.sort(reverse=0)
B. list1.sort()
6 1
C. list1.sort(reverse=‘True’)
D. list1.sort(reverse=1)
Ans. D. list1.sort(reverse=1)

“………………….. is …………………….. memory.” Select the most appropriate to fill in the


blanks of the given statement.
A. RAM, Non-volatile
7 B. RAM, Volatile 1
C. RAM, Secondary
D. ROM, Volatile
Ans. B. RAM, Volatile

Which one is correct syntax for Insert Statement?


A. Insert Columns(Col1, Col2,Col3);
B. Insert into (Col1, Col2,Col3) VALUES (Val1,Val2,Val3);
8 C. Insert Columns(Col1, Col2,Col3) VALUE (Val1, Val2,Val3) Into ; 1
D. None of the above.
Ans. D. None of the above.

Columns of a Relation are called?


A. Attributes
B. Tuples
9 1
C. Degree
D. Cardinality
Ans. A. Attribute

OSS stands for __________.


A. Open System Service
B. Open Source Software
10 1
C. Open System Software
D. Open Synchronized Software
Ans. B. Open Source Software

A column is declared with char (10) size, and assigned 4 characters only. How many
total characters will this column occupy?
A. 4
11 B. 5 1
C. 10
D. 11
Ans. C. 10

Suppose my_dict = {"Name":"Aakash", "Age":35, "Gender":"Male"}. To delete the entry


12 for "Age", what command do we use? 1
A. my_dict.delete("Age":35)
B. my_dict.delete("Age")
C. del my_dict["Age"]
D. del my_dict["Age":35]
Ans. C. del my_dict["Age"]

Which of the following clauses is used in the SQL select statement to filter rows to be
included in the query result.
A. Order By
13 B. Group by 1
C. Having
D. Where
Ans. D. Where

Which of the following is not a feature of MySQL?


A. Cross Platform
B. User Friendly
14 1
C. Open source
D. License fee s to be paid for use
Ans. D. License fee s to be paid for use

In the relational model, the number of attributes and number of tuples of a relation
are termed as _________ and _________ respectively.
A. cardinality, domain
15 B. domain, degree 1
C. degree, cardinality
D. cardinality, degree
Ans. C. degree, cardinality

Which is/are the sublanguage(s) of SQL: -


A. DML
B. DDL
16 1
C. DCL
D. All of the above
Ans. D. All of the above

Q17 and 18 are ASSERTION AND REASONING based questions.


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.

A: if..elif.. else is a form of if statement used when we have a large number of


conditions connected to each other.
R: In an if.elif..else statement one condition is evaluated, if it is found incorrect,
17 another set of conditions is tested and the process continues. If none of the given 1
conditions is found to be true, the statements associated with the else part are
executed.
Ans. A. Both A and R are true and R is the correct explanation for A

A: Virtual Reality (VR) is athree-dimensional, computer-generated situation that


simulates the real world.
18 R: It adds components of the digital world to the physical world, along with the 1
associated tactile and other sensory requirements, thereby making the reality
interactive and digitally manipulable
Ans. B. Both A and R are true and R is not the correct explanation for A

Part-B

Find out the error(s) in the following python code:


print(area of circle calculator)
r=7
area = pi * r ** 2
Ans.
Errors in the code:
print(area of circle calculator) # string parameter should be enclosed in ‘<str>’
r=7
area=pi*r**2 # pi variable is not defined

Correct code:
print(‘area of circle calculator’)
19 2
r=7
pi=3.14
area=pi*r**2
OR
What will be the output of following program
x=10
for i in range(x):
if x==5:
break
print("H")
print(x)
Ans. 10

An organization named Gaurav wants to put all the data in the form of records. The
records are stored in a table and tables are stored in a database. Which DDL command
is used to create a database name Gaurav? Write down the SQL Statement to create
20 the database. 2
Ans.
i. CREATE
ii. CREATE DATABASE Gaurav;

Write down the full form of following i/o devices: OCR, MICR, OMR, VR
Ans.
OCR- optical character reader
21 2
MICR- magnetic ink character recognition
OMR- Optical Mark Reader
VR- Virtual reality

Find output of the following code fragment


L = [10, 20, 30, 40, 50]
22 for idx in range(0, len(L), 2): 2
print(L[idx], end=”#”)
Ans. 10#30#50#

Consider the table Student {S_Id, S_Name, S_Age, S_Class, S_Fee}. Write the command
to display S_Id, S_Name and S_Class of the students who are studying in class 5, 9, 10
23 and 12. 2
Ans.
SELECT S_Id, S_Name, S_Class
FROM Student
WHERE S_Class IN (5, 9, 10, 12);
OR
What is the purpose of the INSERT command? Explain briefly with an example?
Ans.
INSERT is a DML command that is used to add a new record/tuple in a table
Syntax:
INSERT INTO <Tablename>[Attribtelist] VALUES(Value1,Value2,......, value n);
Example:
INSERT INTO PERSON(ID,NAME,Mobile)
VALUES(101,”Sandeep”, 9955882200);

Predict the output of the following


a. 100 + 34//11%3
b. True and True or False and not True
24 2
Ans.
a. 100
b. True

Arrange the following memory units in decreasing order:


25 Exa byte, Tera byte, Peta byte, Giga byte 2
Ans. Exa byte, Peta byte, Tera byte,Giga byte

Part-C

Differentiate between generic and special purpose software. Give an example in each
case.
Ans: General purpose application software is a kind of application that can be used
for a variety of tasks. It is not limited to one particular function. They provide large no
of features for its users.For example, a word processor could be classed as general
purpose software as it would allow a user to write a novel, create a restaurant menu
26
or even make a poster. 3
Special purpose application software is a type of software created to execute one
specific task. For example, a camera application on your phone will only allow you to
take and share pictures
Generic: Word Processing Application, Spreadsheet etc.
Specific: Adobe Photoshop, Corel Draw etc.

Write a program to check if the number is positive or negative or zero and display an
appropriate message. (input: num=3.4, 0 and -4.5)
Ans.
num = 3.4
# Try these two variations as well:
# num = 0
27 # num = -4.5 3
if num > 0:
print("Positive number")
elif num == 0:
print("Zero")
else:
print("Negative number")

Write a python program to check whether the given character is a vowel or not.
28 Ans. 3
my_ch = input("Enter a character: ")
if my_ch in ['a', 'A', 'e', 'E', 'i', 'I', 'o', 'O', 'u', 'U']:
print(my_ch, 'is a vowel')
else:
print(my_ch, 'is not a vowel')

A news channel broadcasts information on a wide range of topics. The news channel
permits people to submit breaking news, which is subject to verification by the
channel’s reporters. It may be difficult to distinguish between real news and fake
news, which can lead to confusion among readers and threaten a news organization’s
reputation. Which domain is used to detect fake news so that the audience has a high
level of trust in the news channel? Write in brief about this domain.
Ans. Natural Language Processing. It refers to the branch of computer science and
more specifically, the branch of artificial intelligence with giving computers the ability
to understand text and spoken words in much the same way human beings can.
OR
A company interested in cloud computing is looking for a provider who offers a set of
basic services such as virtual server provisioning and on-demand storage that can be
29 combined into a platform for deploying and running customized applications. What 3
type of cloud computing model fits these requirements?
a) Platform as a Service
b) Software as a Service
c) Infrastructure as a Service
Also, Explain your choice.
Ans.
c) Infrastructure as a Service because The IaaS providers can offer different kinds of
computing infrastructure, such as servers, virtual machines (VM), storage and backup
facility, network components, operating systems or any other hardware or software.
Using IaaS from the cloud, a user can use the hardware infrastructure located at a
remote location to configure, deploy and execute any software application on that
cloud infrastructure.

Mr. Khan wants to view the structure of an existing table - STUDENT in a database
SCHOOL.So he started Mysql, write down the sequence of the commands he should
use as he is not sure about the name of the table also.
Ans.
i) Use SCHOOL
ii) Show tables
iii) Describe STUDENT
OR
30 3
Mitali is confused with the terms Domain, Tuple and Attribute. Help her to understand
the terms with a suitable example of each.
Ans.
Domain: A domain is a set of allowable values for one or more attributes.
Tuple: A tuple is a row of a relation. Total no. of tuples (rows) is called the cardinality
of the relation.
Attribute: An attribute is a named column of the relation. Total no. of attributes
(columns) is called the degree of the relation.

Part-D

Write a python program to count the frequency of each character using a dictionary
of a string (string should be entered by the user).
31 5
Ans.
text = input("Enter the text: ")
my_dict = {}
for ch in text:
if ch in my_dict:
my_dict[ch] += 1
else:
my_dict[ch] = 1
print(my_dict)
OR
Explain the use of get() and pop() methods in respect of Python Dictionary with
examples.
Ans.
get() → to access an element from a dictionary by specifying a key.
my_dict {'name': 'Jack', 'age': 26}
print(my_dict.get('age'))
pop() → remove a particular item from dictionary and returns its value
squares {1: 1, 2: 4, 3: 9, 4: 16, 5: 25}
print(squares.pop(4))
print(squares)

Write a SQL statement to create a table customer in shop database with following
structure
+---------+---------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+---------------+------+-----+---------+-------+
| ID | int(11) | NO | | | |
| NAME | varchar(20) | NO | | | |
| AGE | int(11) | NO | | | |
| ADDRESS | char(25) | YES | | NULL | |
+---------+---------------+------+-----+---------+-------+
Write SQL statements for following
32 a. Create a database shop 5
b. Before creation of table open the newly created database shop
c. Create a table customer with above structure
d. Which field can be created as Primary key
e. What will be the degree of table/relation customer
Ans.
a. create database shop;
b. use shop;
c. create table customer(ID int(11), NAME varchar(20), AGE int(11), ADDRESS
char(25) DEFAULT NULL);
d. ID
e. 4

Answer the question (a) to (e) based on the table, Book given below:
Book
BNo Title Author Date_Purchased Price

B01 IP CLASS XI A ARORA 2020-01-05 350


33 5
B02 COMP SCI P ARORA 2020-10-15 250

B03 CS CLASS XII NCERT 2021-06-30 NULL

B04 IP With PYTHON NCERT 2021-12-01 400


a. Display details of the books whose price not mentioned
b. Display title and date of purchase of the books having “IP”in their title.
c. Display all the details of books by NCERT.
d. Add a new tuple (B05, Anaconda,Nickey M, 2022-01-01,550).
e. What will be the output of the following Query:
SELECT Author, Title
FROM Book
WHERE Price BETWEEN 100 AND 250;
Ans.
a. SELECT * FROM Book WHERE Price IS NULL;
b. SELECT Pname,Game FROM Player WHERE Rank BETWEEN 1 AND 3;
c. SELECT PID,PName,Rank FROM Player
WHERE Game IN (’Boxing’,’Cricket’);
d. INSERT INTO Player VALUES
(“B06”,”Anaconda”,”Nickey M”, “2022-01-01”,550);
e.
Author Title

NCERT CS CLASS XII


OR
Consider the table -PLAYER given below. Write the output for (i) to (iv) and write sql
query for question (v)
PID PName Gender Game Rank

P01 Sunny Paji Male Cricket 5

P02 Marry Kaun Female Boxing 3

P03 Saniya Mircha Female Tennis 5

P04 Sachin Reelkar Male Cricket 1

P05 Vijender Maohawk Male Boxing Null


a. Select * from PLAYERwhere PID=’P05’;
b. Select PNAME, GENDER, GAME from PLAYER where rank between 1 and 4;
c. Select * from PLAYER where Rank= 6;
d. Select PNAME from PLAYER where PNAME like ‘Sa%’;
e. Insert one more row in the above table having the following data:
f. P10, Kanika Gautam, Female, Hockey, 5
Ans:
a.
PID PName Gender Game Rank

P05 Vijender Maohawk Male Boxing Null


b.
PNAME GENDER GAME

Marry Kaun Female Boxing

Sachin Reelkar Male Cricket

c. Empty set
d.
PNAME

Saniya Mircha

Sachin Reelkar

e. insert into PLAYER values(‘P10’, ‘Kanika Gautam’, ‘Female’, ‘Hockey’, 5)

Part-E

Miss Anita Bhati is a mathematics teacher. She often needs to evaluate her students
and analyze her scores to plan her teaching pedagogies. She has decided to use
technology for the same. Help her to perform the following task (a) to (d) using lists
in Python programming language.
a. Create a list named ‘scores’ having following values: 10, 7, 9, 11, 12, 15, 19, 20, 18,
4
b. Add the following values in the list using a single command.
34 15, 20, 45 4
c. Print the name of the value at index number 3.
d. Display the minimum sore from the list.
Ans:
a. scores=[0,7,9,11,12,15,19,20,18, 4]
b. scores.extend([15, 20,45])
c. scores[3]
d. min(scores)

Ashwarekha is an enthusiastic science student. She wants to know about the


professional life of her favorite scientists and mathematicians. She decided to create
a table named Professor in the digital database named MyHeros. She asked her friend
Varahi to come up with a few questions, which can be answered using SQL queries.
Professor
P_ID PName Department Salary

1729 Ramanujam MATHEMATICS 500

1803 Heigenberg PHYSICS 150000

1704 Eular MATHEMATICS 6000


35 4
1610 Neils B CHEMISTRY 4000

1935 Allen T MATHEMATICS 101010


a. Varahi: Can you tell me the name of Professors of Mathematics with a salary less
than 10000? (write down the SQL query)
b. Varahi: In your table the monthly salary is stored. Can you display the name and
Annual Salary of these professors? (Write the query and use the alias “Annual
Income” for the resultant column).
Ans.
a. SELECT Pname FROM Professor
WHERE Department=’Mathematics’ AND Salary<10000;
b. SELECT Pname, Salary*12 AS ‘Annual Income’ FROM Professor;
KENDRIYA VIDYALAYA SANGATHAN JAIPUR REGION
Marking Scheme SET -3
CLASS: XI SESSION: 2022-23
INFORMATION PRACTICES (CODE 065)
TIME: 3 HRS M M: 70
General Instructions:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A has 18 questions carrying 01 marks each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
Internal choice is given in two questions (19 and 23).
5. Section C has 05 Short Answer type questions carrying 03 marks each.
Internal choice is given in two questions (29 and 30).
6. Section D has 03 Long Answer type questions carrying 05 marks each.
Internal choice is given in two questions (31 and 33).
7. Section E has 02 questions carrying 04 marks each.
One internal choice is given in Q 34 and 35 against part c only.
8. All programming questions are to be answered using Python Language only.

Mar
Q Part-A
ks

Which of the following is the correct sequence?


A. Gigabyte > Terabyte > Megabyte > Kilobyte
B. Kilobyte > Megabyte > Byte > Terabyte
1 1
C. Megabyte > Kilobyte > Terabyte > Gigabyte
D. Terabyte > Gigabyte > Byte > Nibble
Ans. D. Terabyte > Gigabyte > Byte > Nibble

Which one of the following is False regarding data types in Python?


A. In python, explicit data type conversion is possible
B. Mutable data types are those that can be changed.
2 1
C. Immutable data types are those that cannot be changed.
D. None of the above
Ans. D. None of the above

What is DBMS?
A. DBMS is a collection of queries
B. DBMS is a high-level language
3 1
C. DBMS is a programming language
D. DBMS stores, modifies and retrieves data
Ans. D. DBMS stores, modifies and retrieves data

Virtual Reality has been used in the field of __________.


A. Military training
B. Psychology
4 1
C. Medical procedures
D. All of the above
Ans. D. All of the above

5 What one of the following is not a DDL Command? 1


A. Delete
B. Alter
C. Drop
D. Create
Ans. A. Delete

Given a string: s=’String’, Which statement converts string ‘s’ into List ‘L’.
A. L=s
B. L=list(s)
6 1
C. L=s[::]
D. all of the mentioned
Ans. B. L=list(s)

Process of accessing or fetching data from storage device as per requirement is


known as : -
A. Data Retrieval
7 B. Data Capturing 1
C. Data Recovery
D. Data Backup
Ans. A. Data Retrieval

How is Column wise insertion of data different from simply passing values to a
table?
A. Column wise data leads in populating data on an optional basis i.e. whether the
user wanted to insert data in a column or not.
B. We can’t pass value to a table without mentioning column names in an insert
8 1
statement.
C. Passing values to a table without column names is always safe.
D. None of the above.
Ans. A. Column wise data leads in populating data on optional basis i.e.
whether the user wanted to insert data in a column or not.

Total number of Columns of a Relation is called?


A. Attribute
B.Tuple
9 1
C.Degree
D.Cardinality
Ans. Degree

Which of the following is not an operating system?


a) Windows
b) Linux
10 1
c) Oracle
d) Mac OS
Ans. C. Oracle

MySQl is-
A. Proprietary Software
B. Free and Open Source Software
11 1
C. Shareware
D. None
Ans. Free and Open Source Software

Suppose d_emp = {"Name":"Roshni", "Age":27, "Gender":"Female"}. To obtain the


12 1
number of entries in the dictionary, which command do we use?
A. d_emp.size()
B. len(d_emp)
C. size(d_emp)
D. d_emp.len()
Ans. B. len(d_emp)

Which of the following SQL statement is invalid :


A. Select * from emp where empid= 121;
B. Select * from emp;
13 C. Select * where empid=121 from emp; 1
D. Select ename, empid from emp;
Ans. C. Select * where empid=121 from emp;

Which of the following is not a DBMS ?


A. MySQL
B. Ms-Excel
14 1
C. Oracle
D. DB/2
Ans. B. Ms-Excel

An attribute in a relation is a foreign key if the ________ key from one relation is used
as an attribute in that relation.
A. Candidate
15 B. Alternate 1
C. Super
D. Primary
Ans. D. Primary

Choose odd one out: -


A. SELECT
B. UPDATE
16 1
C. DROP TABLE
D. DELETE
Ans. C. DROP TABLE

Q17 and 18 are ASSERTION AND REASONING based questions.


Mark the correct choice as
i. Both A and R are true and R is the correct explanation for A
ii. Both A and R are true and R is not the correct explanation for A
iii. A is True but R is False
iv. A is false but R is True.

A: for loop is a compact loop.


17 R: for loop is a compact loop as it is much faster than the while loop. 1
Ans: A is True but R is False

A: The data in Big Data is not only voluminous, but also unstructured like posts,
instant messages, chats, photographs, tweets, blog articles, news items, comments,
audio/video chats, etc.
18 1
R: Such data can be analyzed using traditional data analysis tools like DBMS,
spreadsheets etc.
Ans. (iii) A is True but R is False

Part-B
Find out the error(s) in the following python code:
print(‘even odd checker’)
n=input(‘enter the number’)
if(n%2==0):
print(‘even’)
else:
print(‘odd’)

Ans.
errors in the code:
print(‘even odd checker’)
n=input(‘enter the number’)
if(n%2==0): # here n is a string, as the input function returns a string by default
print(‘even’)
else: # else without if, it should be in the same level as if (indentation)
print(‘odd’)

correct code:
19 2
print(‘even odd checker’)
n=int(input(‘enter the number’))
if(n%2==0):
print(‘even’)
else:
print(‘odd’)
OR
What will be the output of following program
a = True
b = False
c = False

if a or b and c:
print ("PYTHON PROGRAMMING")
else:
print ("python programming")
Ans.
PYTHON PROGRAMMING

Explain CREATE command also Write down the syntax to create a table.
Ans. To define relations (create tables) in the database and specify attributes for
each relation along with data types for each attribute. This is done using the CREATE
TABLE statement.
Syntax:
CREATE TABLE tablename
20 2
(
attributename1 datatype constraint,
attributename2 datatype constraint,
:
attributenameN datatype constraint
);

Write down the use of following: Printer,Plotter,Projector,Monitor


Ans.
21 2
Printer- prints a hard copy of the electronic data that is stored in the computer
Plotter- printer that makes line drawings using automated pens
Projector- projects an image (or moving images) onto a surface
Monitor- displays information in pictorial or textual form

Find output of the following code fragment


Lst=[10,20,30,40]
Lst[1]=50
Lst[-1]=100
print(L)
22 2
print(Lst[1:3])

Ans.
[10,50,30,100]
[50,30]

Consider the table Student {S_Id, S_Name, S_Age, S_Class, S_Fee}. Write the command
to display S_Id, S_Name and S_Age of the students whose Age is in the range 10 to 16
(both inclusive).
Ans.
SELECT S_Id, S_Name, S_Age
FROM Student
WHERE S_Age BETWEEN 10 AND 16;
OR
23 A table EMP has attributes EmpID, First_Name, Last_Name, Salary. Write down 2
command to add following data in the EMP table
i) 1111, NAVNEET, SHARMA, 60000
ii) 2222, NARESH, 50000

Ans.
i) INSERT INTO EMP VALUES(1111, “NAVNEET”, “SHARMA”, 60000);
ii) INSERT INTO EMP(EmpID,First_Name,Salary)
VALUES(2222,”NARESH”,50000);

Assume a=100, b = 20 , find the value of each of the following :-


a. a//3+b^2
b. a+b > a+20
24 2
Ans.
a. 433
b. False

Arrange the following memory units in increasing order:


Exa byte, Tera byte, Peta byte, Giga byte
25 2
Ans: Giga byte, Tera byte, Peta byte, Exa byte

Part-C

Classify as special purpose and generic software


a. Google Chrome:
b. Windows 8
c. Word-Processing Software
26 d. Ms-Excel
3
e. Notes
f. Avast Antivirus
Ans:
a. Google Chrome : Generic
b. Windows 8 : Special
c. Word-Processing Software : Generic
d. Ms-Excel: Generic
e. Notes : Generic
f. Avast Antivirus : Special
½ mark for each correct answer

What will be the output of the following python statements?


a,b,c = 10,40,20
a,c,b = b+10, a+20, c-10
27 3
print(a,b,c)
print(a+b//c**2)
Ans: 50 10 30 50

Write a python program to display the sum of first n natural numbers (Note: Value
of n should be entered by the user).
Ans.
n = int(input("Enter the number of terms: "))
28 3
sum = 0
for i in range (1, n+1):
sum += i
print(sum)

Aman, an industrialist, wants to start a plant where production of Cars is to be


done.He wants his plant to be in this manner that less man power is used and cars
are produced through automated system.What kind of emerging trend will be
applicable here and how?
Ans. Robotics. In the process of assembling mechanical parts, there is a huge impact
of using robotics. In most automotive manufacturing plants, light robotic arms
assemble smaller parts such as motors and pumps at high speed. Other tasks, such
as screw driving, wheel mounting, and windshield installation, are all done by robot
arms

OR

An incubator cell present in a university, provides the students the opportunity to


create the prototype of products/services that they seek to implement. It provides
them necessary hardware and software resources as well as access to the investors
29 through various tech fares. A group of students in such an incubator cell are trying 3
to create an emergency alert system that processes the data locally in real time
instead of keeping and processing it in the cloud. What kind of technology should
they use to make use of each smart device as a node, for sharing the data and
processing. List down its one advantage and one disadvantage.
Ans.
Grid Computing: A grid is a computer network of geographically dispersed and
heterogeneous computational resources. Unlike cloud, whose primary focus is to
provide services, a grid is more application specific and creates a sense of a virtual
supercomputer with an enormous processing power and storage.

Advantage:
Nowadays, countless computational nodes ranging from hand-held mobile devices
to personal computers and workstations are connected to Local Area Network
(LAN) or Internet. Therefore, it is economically feasible to reuse or utilise their
resources like memory as well as processing power. The grid provides an
opportunity to solve computationally intense scientific and research problems
without actually procuring costly hardware.

Disadvantage:
To set up a grid, by connecting numerous nodes in terms of data as well as CPU, a
middleware is required to implement the distributed processor architecture. The
setup provides some challenges in the form of security, resource management, data
management, communication, fault detection, etc.

i) Write down the name of the SQL command by which one can modify the structure
of a table? A table PRODUCT has attributes PID, PNAME, PRICE, DESCRIPTION.
ii) Write a command to add a new attribute QUANTITY of Integer type in this table?

Ans
ALTER TABLE Command
ALTER TABLE PRODUCT ADD QUANTITY INT;
OR
What are the constraints? Explain any two constraints.
30 3
Ans.
Constraints are the rules enforced on the data columns of a table. These are used to
limit the type of data that can go into a table. This ensures the accuracy and
reliability of the data in the database.
NOT NULL: It prevents null values from being entered into one or more columns
within a table.
UNIQUE (also referred to as a unique key constraint): It forbids duplicate values in
one or more columns within a table.
NOTE: PRIMARY KEY the combination of both NOT NULL and UNIQUE constraints.

Part-D

Write a python program to create a dictionary called fruits with below data:
"Banana":60,
"Apple":80,
"Orange":55,
"Pineapple":80
Using loop, print out all the key along with its price and in the following format:
Fruit = Apple and Price = 2
Also print the total amount one would need to purchase all of your fruits.
Ans.
fruits = {"Banana":60, "Apple":80, "Orange":55, "Pineapple":80}
total_price = 0
for fruit in fruits:
31 5
print("Fruit =", fruit, "and Price =", fruits[fruit])
total_price += fruits[fruit]
print("Total price:", total_price)
OR
What is the purpose of pop(), popitem(), clear() methods used with dictionaries in
python?
Ans -
pop() → remove a particular item from dictionary and returns its value
squares {1: 1, 2: 4, 3: 9, 4: 16, 5: 25}
print(squares.pop(4))
print(squares)
popitem() → remove an arbitrary item, return (key,value)
squares {1: 1, 2: 4, 3: 9, 4: 16, 5: 25}
print(squares.popitem())
print(squares)

clear() → remove all items of the dictionary


squares {1: 1, 2: 4, 3: 9, 4: 16, 5: 25}
squares.clear()
print(squares)

Perform following operation using SQL commands


1. Create a database employee
2. Open this database
32 5
3. create tables empmaster with schema<empcode,name,address,salary>
Suppose database administrator has inserted 12 records in empmaster then what
will be the cardinality and degree of empmaster

Write the queries (a) to (e) based on the table given below:
Investor:
ID Name Age Village Income

1 Rangsa Marak 32 Kala Bakra 85000

2 Modi Sarkar 25 Badami 150000

3 M.G. Cholera 27 Lotte Golla 65000


Halli

4 Jamesbond Singh 33 Nagina 85000

a) Display Name of Investor from Village Badami and Nagia


b) Show Name and Age of Investor, whose Age is either 32 or 33.
c) Display unique Incomes of the Investors
d) Add a new record Like Ika of age 23 from Village Clutter Buck Ganj.
33 5
e) What will be the output of the following Query:
SELECT Name,Village
FROM Investor
WHERE Name LIKE=’%M%k’;
Ans.
a) SELECT Name FROM Investor WHERE Village IN(‘’Badami,’Nagina’);
b) SELECT Name,Age FROM Investor WHERE Age=32 OR Age=33;
c) SELECT Distinct Income FROM Investor;
d) INSERT INTO Investor(‘ID’,’Name’,’Age’,’Village’)
VALUES (5, ”Like Ika”,23,”Clutter Buck Gunj”);
e)
Name Village

Rangsa Marak Kala Bakra

OR
Consider the table - CUSTOMER given below. Write the output for (i) to (iv) and
write sql query for question (v)
CID CNAME LIMIT DOA BALANCE

1501 Sunder Garg 80000 2021-12-12 63524

1502 Kapil Jain 75000 2022-01-17 45284

1503 Anita Bhati 75200 2021-10-17 42517

1509 Vipul Patel 83500 2019-15-22 12482

1624 Seema Pratap 95000 2019-07-12 0

i. Select * from CUSTOMER where CID=1502;


ii. Select CNAME, LIMIT, DOA from CUSTOMER where BALANCE > 45000;
iii. Select * from CUSTOMER where LIMIT>75000 and BALANCE<15000;
iv. Select CNAME from CUSTOMER where DOA like ‘2019%’;
v. Two more rows are added to the above table. What will be the new cardinality
of the table?
ANS:
i.
CID CNAME Limit DOA Balance

1502 Kapil Jain 75000 2022-01-17 45284


ii.

CNAME LIMIT DOA

Sunder Garg 80000 2021-12-12

Kapil Jain 75000 2022-01-17


iii
Empty set

iv.
CNAME

Vipul Patel

Seema Pratap
v. 7
1 mark for correct output. ½ mark for partial correct output.

Part-E

Ms. Preeti Sexena is a Class Teacher of VIII. She often needs to maintain the health
records of her students and analyze her scores to plan her pedagogies. She has
decided to use technology for the same. Help her to perform the following task (a)
to (d) using lists in Python programming language.
34 a. Create a List named - height with the following values : 4 4
b. sort the elements of the list in ascending order
c. Find how many times the value 4.4 appeared in the list.
d. Display the maximum value from the list.
Ans:
a. height=[4.4, 5.1, 5.4, 4.4, 3.9, 5.10, 6.0]
b. height.sort()
c. height.count(4.4)
d. max(height)
1 mark for each correct answer. ½ mark, for recognition of proper command/
function.

Huma is a sports fan. She wants to make a career as a sports journalist. She was
given a job as a sports columnist for her college magazine. She decided to present a
featurette about the Arjuna Award and the award receivers in the year 2022. She
consulted her friend Semim for preparation of the database. Here’s the
conversation between them.

Huma: Hello Semim, would you please help me out with this project?
Semim: Sure. I would love to be a part of it. What would I get in return?
Huma: Garma Garam Jalebis made by Amma.
Semim: Wow, you sure know how to treat your bestie. Cheppa (tell me), what are
your queries?
Huma: Hmmm.. first of all we need to collect the data from https://pib.gov.in/, an
official website of the Ministry of Youth Affairs and Sports. We will then create a
database and various tables to perform the analysis.
Semim: Okay, let’s do it.
(They successfully obtained the data from the website and created the database and
35 tables.) 4
Huma: Thanks a ton but wait can you tell me how do I access this data when I am all
by myself?

a) How do I use the database named Sports?


b) How to find the list of various tables in the database?
c) I want to know the details of Arjuna Awardee players for the year 2022. What
query should I use in the table Arjuna_Puraskar_22?
d) Can you tell me the syntax of Insert Query?
Write down the answers for the above queries/questions.

Ans.
a) USE DATABASE Sports;
b) SHOW TABLES;
c) SELECT * FROM Arjuna_Puraskar_22;
d) INSERT INTO <table_name> VALUES(val1,val2,.....valN);
1+1+1+1=4 Marks
KENDRIYA VIDYALAYA SANGATHAN JAIPUR REGION
Marking Scheme SET-4
CLASS: XI SESSION: 2022-23
INFORMATION PRACTICES (CODE 065)
TIME: 3 HRS M M: 70
General Instructions:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A has 18 questions carrying 01 marks each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
Internal choice is given in two questions (19 and 23).
5. Section C has 05 Short Answer type questions carrying 03 marks each.
Internal choice is given in two questions (29 and 30).
6. Section D has 03 Long Answer type questions carrying 05 marks each.
Internal choice is given in two questions (31 and 33).
7. Section E has 02 questions carrying 04 marks each.
One internal choice is given in Q 34 and 35 against part c only.
8. All programming questions are to be answered using Python Language only.

Mar
Q Part-A
ks

Introduction to computer and computing


Which of the following processes is used to reinstall/restore data from a copy when
the original data has been lost?
A. Update
1 1
B. Backup
C. Recovery
D. None of these
Ans. C. Recovery

What will be the value of the following Python expression?


4+3%5
A. 7
2 B. 2 1
C. 4
D. 1
Ans. A. 7

Which of the following is not an example of DBMS?


A. MySQL
B. Microsoft Access
3 1
C. IBM DB2
D. Google
Ans. D. Google

Network of interconnected items with integrated sensors that can gather and
transmit data in real time is known as the _______.
4 A. Internet of Things 1
B. Big Data
C. Model
D. None of the above
Ans. A. Internet of Things

What is the DDL command out of the following to remove a table?


A. Remove
B. Delete
5 1
C. Drop
D. Pop
Ans. C. Drop

What will be the output of the following code segment?


l=[‘A’, ’a’, ’Aa’ ,’aA’]
print(max(l))
A. ‘A’
6 1
B. ‘a’
C. ‘Aa’
D. ‘aA’
Ans. D. ‘aA’

DVD stands for : -


A. Digital Versatile Drive
B. Digital Video Drive
7 1
C. Digital Volume Drive
D. Digital Versatile Disk
Ans. D. Digital Versatile Disk

How can you insert a new row into the “STORE” table
A. INSERT ROW (1,‟ RAM SINGH‟) INTO STORE;
B. INSERT VALUES (1,‟ RAM SINGH‟) INTO STORE;
8 C. INSERT INTO (1,‟ RAM SINGH‟) STORE; 1
D. INSERT INTO STORE VALUES (1,‟ RAM SINGH‟);
Ans. D. INSERT INTO STORE VALUES (1,‟ RAM SINGH‟);

Total number of Rows of a Relation is called?


A. Attribute
B.Tuple
9 1
C.Degree
D.Cardinality
Ans. Cardinality

The ___________ acts as an interface between the device and the operating
system.
A. Device Conductor
10 B. Device Driver 1
C. Hardware Drive
D. Hardware Conductor
Ans. B Device Driver

MySQl is Case Sensitive-


A. Yes
11 B. No 1
C. Keywords/Commands are Case Sensitive
D. All of Above
Ans. No

What will be the output of the following Python code snippet?


fruits = {'Apples':1, 'Bananas':4, 'Grapes':17, 'Oranges':14}
print(list(fruits.keys()))
A. (1, 4, 17, 14)
12 1
B. ('Apples', 'Bananas', 'Grapes', 'Oranges')
C. [1, 4, 17, 14]
D. ['Apples', 'Bananas', 'Grapes', 'Oranges']
Ans. D. ['Apples', 'Bananas', 'Grapes', 'Oranges']

Identify the odd one out


A. Select
B. Desc
13 1
C. From
D. Where
Ans. B. Desc

A ___________ is a collection of attributes alligned vertically in a table.


A. Column
B. Row
14 1
C. Cell
D. Data
Ans. A. Column

______________ is a set of one or more attributes taken collectively to uniquely


identify a record.
A. Primary Key
15 B. Foreign key 1
C. Super key
D. Candidate key
Ans. A. Primary Key

Mr. Rajan wants to add a new attribute in an existing table in MySql, which
command he should use : -
A. DESCRIBE
16 B. ALTER TABLE 1
C. DELETE
D. INSERT ATTRIBUTE
Ans. B. ALTER TABLE

Q17 and 18 are ASSERTION AND REASONING based questions.


Mark the correct choice as
i. Both A and R are true and R is the correct explanation for A
ii. Both A and R are true and R is not the correct explanation for A
iii. A is True but R is False
iv. A is false but R is True.

A: When we place a loop inside another loop it is called a nested loop.


R: Programming language supports the concept of nesting. for example if we place
17 an if statement inside another if statement statement, it is called a nested if 1
statement.
Ans. i. Both A and R are true and R is the correct explanation for A

18 A: Web of Things (WoT) allows the user to browse the web using anything in the 1
physical world like a toaster, an oven or a fan.No need of a phone or a PC.
R: The ‘Internet of Things’ is a network of devices that have embedded hardware
and software to communicate (connect and exchange data) with other devices on
the same network.
Ans. (iv) A is false but R is True

Part-B

Find out the error(s) in the following python code:


if(4>9):
print(‘4 is greater than 9’)
else if(9>4):
print(‘4 is smaller than 9’)
else(4==9):
print(‘4 is equal to 9’)

Ans.
errors in the code:
if(4>9):
print(‘4 is greater than 9’)
else if(9>4): # it should be elif instead of else if
print(‘4 is smaller than 9’)
else(4==9): # else doesn’t accept any argument
print(‘4 is equal to 9’)

correct code:
19 if(4>9): 2
print(‘4 is greater than 9’)
elif(9>4):
print(‘4 is smaller than 9’)
else:
print(‘4 is equal to 9’)

OR

What will be the output of following program


num = 5
sum = 0
while num> 0:
sum += num
num -= 2
print( sum)
Ans.
9

Consider the following SQL statement.


S1: CREATE TABLE employee (eno CHAR(3), name VARCHAR(20));
S2: INSERT INTO employee VALUES (‘E01’,RAHUL DRAVID’);
20 2
From S1 and S2, which one is DDL and which one is DML?

Ans.
S1: DDL
S2: DML

Define computer,draw block diagram of computer


21 Ans. a machine or device that performs processes, calculations and operations 2
based on instructions provided

Find output of the following code fragment


Lst=[10,20,30]
Lst.append(50)
Lst.pop(0)
print(Lst)
22 Lst.pop( ) 2
Lst.append(60)
print(Lst)
Ans.
[20,30,50]
[20,30,60]

Consider the table Employee {EId, EName, Age, Designation, Salary,


Department}. Write the command to display EId, EName, Designation and
Department of the employees whose name start with A and department is IT.
Ans.
SELECT EId, EName, Designation, Department
FROM Employee
WHERE EName LIKE "A%" AND Departement = "IT";

OR 2
23
State True or False in reference with INSERT INTO command of SQL?
i) INSERT is not a part of DDL?
ii) While adding tuples using the INSERT command, one must specify values
for all the attributes of the table.

Ans
i) True
ii) False

Give two example each of Logical and Relational Operators in Python:

Ans. Logical Operators : and , or , not


24 2
Relational Operator >, <, <=, >=, ==
½ mark for each correct operator

Rearrange the following units in increasing order


MB bit TB byte KB
2
25
Ans: bit, byte, KB, MB TB

Part-C

Classify the following software as System software and Application software


26
a. Adobe PhotoShop 3
b. Windows 10
c. Disk Defragmenter
d. Ms-Word
e. Google Chrome
f. Avast Antivirus

Ans:
a. Adobe PhotoShop : Application software
b. Windows 10 : System Software
c. Disk Defragmenter : System Software
d. Ms-Word: Application software
e. Google Chrome: Application software
f. Avast Antivirus: System Software
½ mark for each correct answer

Evaluate (to true or false)each of the following expression:


14<=14
14<14
27 3
-14 > -15
-15 >=15
Ans: True, False, True, True

Write a python program to print the factorial of a number (Note: number


should be entered by the user).
Ans.
n = int(input("Enter a positive integer: "))
28 3
fact = 1
for i in range(2, n + 1):
fact *= i
print(fact)

The Air LMN Airlines Group want to train pilot. The trainees can take the headset
home and train for as long as they need. This includes them familiarizing the
aircraft and 360-degree walkarounds.What kind of emerging trend is useful here
Ans.VR. A traditional VR home simulator generally consists of the same flight
control setup

OR
CBSE has started to provide the digital copy of the marksheets online. Which
technology can be used to provide the decentralized data sharing architecture?
29 One in which safety and security of the transactions are ensured because all the 3
members in the network keep a copy of the file and so it is not possible for a single
member of the network to make changes or alter data. Can the same tech be applied
in other areas? (If yes, Write the names of two such areas)

Ans.
Blockchain: The blockchain technology works on the concept of decentralized and
shared database where each computer has a copy of the database.
Yes, The blockchain technology can be used in diverse sectors, such as banking,
media, telecom, travel and hospitality and other areas.

A table PRODUCT has attributes PID, PNAME, PRICE, DESCRIPTION. Write


commands for followings: - 3
30
i) Make the PID attribute as the Primary key of this table.
ii) Change the data type of PRICE column to FLOAT(7,2)
iii) Remove the attribute DESCRIPTION

Ans
i)ALTER TABLE PRODUCT ADD PRIMARY KEY(PID)
ii) ALTER TABLE PRODUCT MODIFY PRICE FLOAT(7,2)
iii) ALTER TABLE PRODUCT DROP DESCRIPTION

OR

Explain the concept of Primary Key, Candidate Key and Alternate Key.
Ans.
Candidate Key – A candidate key is an attribute or set of attributes that can
uniquely identify a tuple.
Primary Key: It is one of the keys selected from candidate keys that uniquely
identify every row in that table.
Alternate Key – One key is chosen as the Primary Key from candidate keys,
and the remaining candidate keys, if exists, are called as the alternate keys.

Part-D

Write a python program to create a dictionary of students to store the record of n


students with marks obtained in 5 subjects for each student. Print the name and
average marks in alphabetical order.
Ans.
dict_stu = dict()
n = int(input("Enter number of students: "))
for i in range(n):
sname = input("Enter names of the student: ")
marks = []
for j in range(5):
marks.append(float(input("Enter marks: ")))
dict_stu[sname] = marks
print("Dictionary of student:", dict_stu)
sname_sorted = sorted(dict_stu.keys())
for sname in sname_sorted:
print(sname, ":", sum(dict_stu[sname])/len(dict_stu[sname]))
31 5
OR
Explain the use of following methods: -
a) keys()
b) values()

Ans -
a)keys() - returns all the available keys
x=dict(name=“Aman",age=37,country=“India")
print(x.keys())
OUTPUT
dict_keys(['country','age','name'])

b)values()- returns all the available values


x=dict(name=“Aman",age=37,country=“India")
print(x.values())
OUTPUT
dict_values(['India',37,'Aman'])

Perform following operation using SQL commands


1. Create a database company
2. Open this database
5
32 3. create tables product with schema<productid,name,price>
Suppose database administrator has inserted 33 records in product table then
removed 4 records from it.what will be the cardinality and degree of product.

4.
Write the queries (a) to (e) based on the table given below:
Table: Professor
P_ID PName Department Tinkha

1729 Ramanujam MATHEMATICS 500

1803 Heigenberg PHYSICS 150000

1704 Eular MATHEMATICS 6000

1610 Neils B CHEMISTRY 4000

1935 Allen T MATHEMATICS 101010

a) Display details of all Professors From the Mathematics Department.


b) Display the names of different departments without repetition.
c) Show P_ID and Tinkha whose department is not chemistry.
d) Add a new Professor with Id: 1995,Name: H. C. Verma, Tinkha:19999
e) What will be the output of the following Query:
SELECT P_ID as Joining_Year, PName
FROM Professor
33 WHERE Tinkha<>6000 AND Department=’Physics’; 5
Ans.
a) SELECT * FROM Professor WHERE Department=’Mathematics’;
b) SELECT DISTINCT Department FROM Professor;
c) SELECT P_ID,Tinkha FROM Professor
WHERE Department <> ‘Chemistry’;
d) INSERT INTO Professor (P_ID,PName,Tinkha)
VALUES (1995, ”H. C. Verma”,19999);
e)
Joining_Year PName

1803 Heigenberg

OR
Consider the table - TRANSACTION given below. Write the output for (i) to (iv) and
write sql query for question (v)
TNO ACNO TTYPE DOT AMOUNT

143 12513 Deposit 2021-12-12 15000

149 12545 Withdraw 2022-01-17 12514


145 12548 DD 2021-10-17 12514

153 14587 Withdraw 2019-15-22 12545

142 12546 Deposit 2019-07-12 25245

i. Select * from TRANSACTION where TNO=142’;


ii. Select ACNO, TTYPE, DOT from TRANSACTION where rTTYPE in
(‘DD’,’Withdraw’);
iii. Select * from TRANSACTION where AMOUNT <= 1500 and AMOUNT >=
5000;
iv. Select distinct TTYPE from TRANSACTION;
v. Two more rows are added to the above table. What will this change- degree
or cardinality of the table?
Ans:
i.
TNO ACNO TTYPE DOT AMOUNT

142 12546 Deposit 2019-07-12 25245


ii.
ACNO TTYPE DOT

12545 Withdraw 2022-01-17

12548 DD 2021-10-17

14587 Withdraw 2019-15-22


iii
Empty set
iv
TTYPE

Deposit

Withdraw

DD
v.
Cardinality
1 mark for correct output. ½ mark for partial correct output.

Part-E

Ms. Anjana is a Super Store Manager. She often needs to maintain the records of
products in the store and analyze data to plan her sales targets. She has decided to
use technology for the same. Help her to perform the following task (a) to (d) using
lists in Python programming language.
a. Create a List named - ‘price’ with the following values 780, 390, 110,145,
34 4
224, 390, 165, 390, 444, 254, 77
b. remove the last added element in the list.
c. Delete the first occurance of 390 from the list.
d. Sort the elements of the list in descending order.
Ans:
a. price=[780, 390, 110,145, 224, 390, 165, 390, 444, 254, 77]
b. price.pop()
c. price.remove(390)
d. price.sort(reverse=True)
1 mark for each correct answer. ½ mark, for recognition of proper command/
function.

Hemachndra Rawat likes to play competitive video games and he also records his
gaming session on twitch. One day his cousin Shrea calls him to help her out with a
school project about esports. Here’s the snippet of their conversation.

Shrea: I would like to create a digital database about recent and popular game titles.
Can you help me out with that?
Hemachandra: Why not. Just let me know what the details are you looking for.
Shrea: I want to know the names of popular games, their production companies,
Genre, Download count, followers on social media etc.
Hemachandra: I think I can work with that. I’ll create a database and a few tables,
you can populate them with the data later on.
Shrea: Great. Can you tell me how to check the results?
Hemachandra: Of course. I’ll tell you how to create and manage your database.
We will use MySQL for this purpose.

They created the database and the tables and now Shrea is ready with some queries
4
35 to test the database. Answer her query on Hemchandra’s behalf:

a) How do I list various databases in MySQL?


b) Which command to use in order to see the table structure?
c) Can I insert the values in a table without following the sequence?
If yes, Can you tell me the syntax to insert (Overwatch, FPS, 3300000) in a table
having 3 columns: (Name, Followers, Genre).
If not, can you tell me the way/query to do so the right way?
Ans.
a) SHOW DATABASES;
b) DESCRIBE <Name of the table>
c) Yes
INSERT INTO (col1,col3,col2) VALUES(val1,val3,val2);1
1+1+2=4 Marks
KENDRIYA VIDYALAYA SANGATHAN JAIPUR REGION
Marking Scheme SET-5
CLASS: XI SESSION: 2022-23
INFORMATION PRACTICES (CODE 065)
TIME: 3 HRS M M: 70
General Instructions:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A has 18 questions carrying 01 marks each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
Internal choice is given in two questions (19 and 23).
5. Section C has 05 Short Answer type questions carrying 03 marks each.
Internal choice is given in two questions (29 and 30).
6. Section D has 03 Long Answer type questions carrying 05 marks each.
Internal choice is given in two questions (31 and 33).
7. Section E has 02 questions carrying 04 marks each.
One internal choice is given in Q 34 and 35 against part c only.
8. All programming questions are to be answered using Python Language only.

Q Part-A Marks

Software programs developed for performing particular tasks related to managing


computer resources is called
A. System software
1 B. Utility software 1
C. Application software
D. Helper software
Ans. C. Application software

Process of removing errors called


A. Error Free
B. Debug
2 1
C. Syntax Error
D. Exception
Ans. B. Debug

Which of the following is not a function of the database?


A. Managing stored data
B. Manipulating data
3 1
C. Security for stored data
D. Analysing code
Ans. D. Analysing code

What are the characteristics of big data?


A. Volume & Velocity
B. Variety & Veracity
4 1
C. Value
D. All of the above
Ans. D. All of the Above

What is the DDL command out of the following to rename a column?


5 1
A. Change Name
B. Rename
C. Modify Name
D. Alter Name
Ans. B. Rename

which command we use cane use To remove string “hello” from list1, Given,
list1=[“hello”]
A. list1.remove(“hello”)
6 B. list1.pop(list1.index(“hello”)) 1
C. both a & b
D. none of these
Ans. C. both a & b

Which one of the followings is true in the context of Memory: -


A. Secondary memory is faster than Primary memory
B. All Primary memories are volatile in nature
7 1
C. Secondary memory is portable
D. Cache memory decreases the performance of the computer
Ans. C. Secondary memory is portable

When using the SQL INSERT statement:


A. rows can be modified according to criteria only.
B. rows cannot be copied in mass from one table to another only.
8 C. rows can be inserted into a table only one at a time only. 1
D. rows can either be inserted into a table one at a time or in groups.
Ans. D. rows can either be inserted into a table one at a time or in groups.

A relation is having 5 columns and 6 rows, find out the Degree and Cardinality
of this Relation-
A. 1 Degree and 1 Cardinality
9 B. 6 Degree and 5 Cardinality 1
C. 5 Degree and 6 Cardinality
D. 2 Degree and 2 Cardinality
Ans. 5 Degree and 6 Cardinality

Which of the following are examples of Proprietary Software?


A. MS Office
B. Talley
10 1
C. Both A and B
D. None
Ans. C. Both A and B

Which is not a valid Data Type of SQL?


A.int
B. Varchar
11 1
C. Date
D. Time
Ans. Time

What will be the output of the following Python code snippet?


d1 = {"abc":234, "xyz":567}
12 1
d2 = {"abc":123, "xyz":567}
print(d1 > d2)
A. False
B. True
C. Error
D. None
Ans. C. Error

SQL Statement used to extract data from one or more tables is


A. Select
B. From
13 1
C. Where
D. Describe / Desc
Ans. A. Select

Which of the following is/are a need to use DBMS?


A. Store large volume of data
B. Effective way to retrieve meaningful data
14 1
C. Avoids redundancy of data.
D. All of the above.
Ans. D. All of the above.

Which of the following(s) can be a composite key?


A. Primary
B. Alternate
15 1
C. Candidate
D. All of these
Ans. D. All of these

Select correct pair of DML commands out of followings: -


A. CREATE TABLE, INSERT
B. DROP TABLE, SELECT
16 1
C. DELETE, DROP TABLE
D. INSERT, UPDATE
Ans. D. INSERT, UPDATE

Q17 and 18 are ASSERTION AND REASONING based questions.


Mark the correct choice as
i. Both A and R are true and R is the correct explanation for A
ii. Both A and R are true and R is not the correct explanation for A
iii. A is True but R is False
iv. A is false but R is True.

A: Jump statements in python are used to alter the flow of a control statement like
you want to skip a part of a loop or a condition
17 1
R: break, continue and pause are three jump statements available in a python.
Ans: iii. A is True but R is False

A: In cloud computing, computer-based services are delivered over the Internet or


the cloud, they are accessible from anywhere using any smart device.
18 R: The cloud services comprise software, hardware (servers), databases, storage, 1
etc. These services can be used as a pay per use basis, just like we use electricity.
Ans. (i) Both A and R are true and R is the correct explanation for A

Part-B

Find out the error(s) in the following python code:


19 2
print(‘enter a number between 1 and 9’)
num=int(input()))
if(num>9):
print(‘the number is greater than 9’)
elif(num<0):
print(‘the number is less than ‘0’)
else:
print(‘good buoy/garl’)

Ans.
errors in the code:
print(‘enter a number between 1 and 9’)
num=int(input())) # remove extra closing bracket )
if(num>9):
print(‘the number is greater than 9’)
elif(num<0):
print(‘the number is less than ‘0’) # start and end quote utilization issue
else:
print(‘good buoy/garl’)

correct code:
print(‘enter a number between 1 and 9’)
num=int(input())
if(num>9):
print(‘the number is greater than 9’)
elif(num<0):
print(‘the number is less than \‘0\’’)
else:
print(‘good buoy/garl’)
OR
What will be the output of following program
n=0
while n < 5:
n+=1
if n==3:
continue
print (n,end=’ ’)
print("Loop Over")
Ans. 1 2 4 5 Loop Over

Choose an appropriate answer with respect to the following code snippet.


CREATE TABLE Staff
( StaffID CHAR (5) PRIMARY KEY,
FirstName VARCHAR (20) NOT NULL,
LastName VARCHAR (15),
IsQualified CHAR(4) )
20 2
);
i) What will be the degree of this table?
ii) What does ‘IsQualified’ represent in the above code snippet?
Ans.
i) Degree:4
ii) ‘IsQualified’ is the name of an attribute/column in tha table Staff.

Write down any four features of 5th generation computers


21 2
Ans.
ULSI technology
Development of true artificial intelligence.
Development of Natural language processing.
Advancement in Parallel Processing.
Advancement in Superconductor technology.

Differentiate append() and extend() methods used with lists? Illustrate with
an example of both?
Ans. append() → it used to add a single element at the end of a list.
example
Lst=[10,20,30]
Lst.append(50)
print(Lst)
22 2
extend() → used to add multiple elements at the end of a list or add a list at the end
of an existing list
example
Lst=[10,20,30]
lst1=[40,50]
Lst.extend(lst1)
print(Lst)

Consider the table Employee {EId, EName, Age, Designation, Salary, Department}.
Write the command to display EId, EName, Age, Designation and Department of the
employees whose Age is greater than 18 or department is not HR.
Ans.
SELECT EId, EName, Age, Designation, Department
FROM Employee
WHERE Age > 18 AND Department <> "HR";

OR
23 Name the command to add new tuples into a table? State the information one 2
needs before adding a new tuple into a table?

Ans.

INSERT Command is used to add a new tuple.

One must know the correct attribute name, their data types and constraints to add
new tuples.

Differentiate between the interactive mode and script mode available with python
IDLE.
Ans: Interactive mode is where you type commands and they are immediately
24 executed. Script mode is where you put a bunch of commands into a file (a script), 2
and then tell Python to run the file.
1 mark each for for correct explanation of Interactive mode and Script mode

Rearrange the following units in decreasing order


MB bit TB byte KB
25 2
Ans: TB MB KB byte bit
Part-C

Give an example of software for each the following purpose:


a. Typing a Novel
b. Editing a Photograph
c. Protecting computer system from virus
d. Creating Graphs on available numeric data
e. Joining a data source with a fixed letter format to create multiple letters
f. Creating a poster
Ans:
26 a. Typing a Novel : Ms-Word, Page-Maker, Write etc (any one)
3
b. Editing a Photograph: Photoshop
c. Protecting computer systems from viruses : Avast, McAfee etc. (any one)
d. Creating Graphs on available numeric data : Ms-Excel, Calc etc. (any one)
e. Joining a data source with a fixed letter format to create multiple letters :
Ms-word
f. Creating a poster : Corel-Draw, Drawit , Ms-word etc. (any one)

½ Mark for each correct answer

Write python code to convert the time given in minutes into hours and
minutes.
Ans:
min=int(input(“Enter time in minutes &”))
27 3
h=min//60
m=min%60
print(“Hours=”, h)
print(“Minutes=”, m)

Write a python program to print the below shown pattern where no. of rows
should be entered by the user (Note: no. of rows should be less than equal to
20 else show error).
*
* *
* * *
* * * *
Ans.
28 3
n = int(input("Enter no. of rows (less than equal to 20): "))
if n < 0 or n > 20:
print("Error! invalid range")
exit(-1)
for i in range(n):
for j in range(i + 1):
print("*", end=' ')
print("")

Mr. Anil Mohan is a computer teacher ,he want to explain about use of machine
learning through some example.Suggest any 3 suitable example or application area
where machine learning can be used.
Ans. Traffic prediction, Product recommendation, Self driving cars, Stock market
29 3
trading etc.

OR
The new addition of the Apple watch has a feature called “Crash Detection”. Which
can send an SOS to the emergency contact and the emergency services. This can be
a life saving feature for many unfortunate people who otherwise lose their lives
due to the lack of immediate emergency support at the time of the need. The crash
detection algorithm needs data to process and identify the situation. How do you
think that data is provided to the algorithm? Can you list two such data/input
providers in a wearable?
Ans.
A smart sensor is a device that takes input from the physical environment and
uses built-in computing resources to perform predefined functions upon detection
of specific input and then process data before passing it on.
a) Gyroscope
b) Heart Rate Monitoring
c) SPO2
d) Accelerometer

Write down SQL commands for following tasks: -


i) Open a database
ii) Remove/Delete a database
iii) Remove/Delete a table from a database

Ans
i) USE
ii) DROP DATABASE
iii) DROP TABLE

OR
30 3
Explain the concept of DDL, DML and DQL commands.
Ans.
A database is an organized collection of structured information, or data,
typically stored electronically in a computer system.
DDL: Data Definition Language consists of the SQL commands that can be
used to define the database schema such as create, drop, alter and truncate
etc.
DML: Data Manipulation Language consists of the SQL commands that deal
with the manipulation of data present in the database such as insert, update,
delete etc.
DQL: Data Query Language consists of a single SQL command i.e. select which
is used for performing queries on the data within schema objects.

Part-D

Consider the below data, Write a python program to perform below tasks.
"Banana":60,
"Apple":80,
"Orange":55,
"Pineapple":80
31 5
(a) Print the list of values
(b) Remove 'Orange' from the dictionary
(c) Create the copy of the dictionary
(d) Update the price for Apple to 100
(e) Remove all the items from the dictionary
Ans.
fruits = {"Banana":60, "Apple":80, "Orange":55, "Pineapple":80}

# Ans (a)
print(list(fruits.values()))

# Ans (b)
fruits.pop("Orange")
print("After Pop:", fruits)

# Ans (c)
temp_dict = fruits.copy()
print("Copy:", temp_dict)

# Ans (d)
fruits["Apple"] = 100
print("After price update:", fruits)

# Ans (e)
fruits.clear()
print("Empty dictionary:", fruits)

OR

Explain the use of following methods: -


a) items()
b) update()

Ans -
a)items()- return the list with all dictionary keys with values.
x=dict(name="Aman",age=37,country="India")
print(x.items())
OUTPUT-
dict_items([('country','India'),('age',37),('name','Aman')])
b)update()- used to change the values of a key and add new keys
x=dict(name="Aman",age=37,country="India")
d1=dict(age=39)
x.update(d1,state="Rajasthan")
print(x)
OUTPUT-{'country':'India','age':39,'name':'Aman','state':'Rajasthan'}

Table SALE
PRODID QTY RATE AMOUNT
1 10 100 1000
2 5 50 250
32 5
a. Write sql commands create above table SALE with suitable datatype
b. Can we take the QTY column of SALE table as Primary Key? If no give reason
c. Which column is best suitable for applying Primary Key?
d. what is the cardinality of above table
e. what is the degree of above table

Write the queries (a) to (e) based on the table given below:
33 5
Course
C_ID F_ID Cname Fees

C21 102 Grid Computing 40000

C22 106 System Design 16000

C23 104 Network Security 80000

C24 106 Human Biology 150000

C25 102 Computer Network 20000

a) Display details of all courses having string ‘comp’.


b) Display C_ID and F_ID whose Fee is less than 50000.
c) Show CName and Fee taken by Faculty 106 and 102.
d) Add a new record in the table (‘C26’,NULL,’AI with Python’,60000)
e) What will be the output of the following Query:
SELECT DISTINCT F_ID FROM Course;
Ans.
a) SELECT * FROM Player WHERE Gender=’Male’;
b) SELECT Pname,Game FROM Player WHERE Rank BETWEEN 1 AND 3;
c) SELECT PID,PName,Rank FROM Player
WHERE Game IN (’Boxing’,’Cricket’);
d) INSERT INTO Player VALUES (“P06”, ”Abhinav”,”Male”,”Shooting”,1);
e)
F_ID

102

104

106

OR
Consider the table - RESTAURANT given below. Write the output for (i) to (iv) and
write sql query for question (v)
SNO NAME TYPE DOA COST

561 Chinese Bhel Fast Food 2021-12-12 150

761 Veg Manchurian Filler 2022-01-17 80

987 Veg Kofta Main Course 2021-10-17 260

345 Malai Paneer Main Course 2019-15-22 230

234 Rava Idli Fast Food 2019-07-12 120

i. Select * from RESTAURANT where SNO= 761;


ii. Select NAME, TYPE, DOA from RESTAURANT where cost in (230, 260, 300);
iii. Select * from RESTAURANT where NAME like = ‘%roti%’;
iv. Select NAME from RESTAURANT where DOA between ‘2022-01-01 and
‘2022-12-31’’;
v. Add one more row to the above table with the following data
SNO- 111; NAME: Tawa Roti, Cost : 20. Values for the other attributes not available

i.
SNO NAME TYPE DOA COST

761 Veg Manchurian Filler 2022-01-17 80


ii.

NAME TYPE DOA

Veg Kofta Main Course 2021-10-17

Malai Paneer Main Course 2019-15-22


iii
Empty set
iv

NAME

Veg Manchurian
v.
insert into RESTAURANT values (111, ‘Tawa Roti’, Null, Null, 20);
(or any other equivalent form of input)
1 mark for correct output. ½ mark for partial correct output.

Part-E

Ms. Vijeta is a climatologist. She often needs to maintain the records of temperature
of the area under study and analyze data to forecast weather. She has decided to
use technology for the same. Help her to perform the following task (a) to (d) using
lists in Python programming language.
a. Create a list named ‘temp’, with the following values :
27,29,33,34,28,26,27,28,30,31,32,28
b. Reverse the order of the elements in he list
c. Display the first three elements of the list.
34 4
d. Add 32 as a new element at the last of list
Ans:
a. temp=[27,29,33,34,28,26,27,28,30,31,32,28]
b. temp.reverse()
c. temp[4]
d. temp.append(34)
1 mark for each correct answer. ½ mark, for recognition of proper command/
function.

A shop called Rainbow Garments that sells school uniforms, maintains a database
SCHOOL_UNIFORM. It consisted of two relations — UNIFORM and PRICE. They
made UniformCode as the primary key for UNIFORM relations. Specify SQL queries
to rectify the following anomalies.
35 4
a) There’s a new product, a Handkerchief. The colors are Red and White. The
Price is Rs. 100. The PID is ‘hkcf2004’ and ‘hkcf2005’ respectively. Insert the
above data in the Relation Product(PID, Name, Color, SIze, Price).
b) Write down the query to check the table contents.
c) Write down the query to display all the products with size “S” and color
“Blue”.
Ans.
a) INSERT INTO Product (PID, Name, Color, Price)
VALUES(‘hkcf2004’,’Handkerchief’, ‘Red’,100);
INSERT INTO Product (PID, Name, Color, Price)
VALUES(‘hkcf2005’,’Handkerchief’, White,100);
b) SELECT * FROM Product;
c) SELECT * FROM Product WHERE Size=’S’ AND color=’Blue’;
2+1=1 Marks

You might also like