Download as pdf or txt
Download as pdf or txt
You are on page 1of 208

KENDRIYA VIDYALAYA SANGATHAN, CHENNAI REGION

Session 2022-23
Class XI
Informatics Practices
Based on Latest CBSE Exam Pattern
KENDRIYA VIDYALAYA SANGATHAN
CHENNAI REGION

OUR PATRONS

Smt. T RUKMANI
Offg. DEPUTY COMMISIONER
KVS RO CHENNAI

Sh. P.I.T. RAJA


ASSISTANT COMMISSIONER
KVS RO CHENNAI
MEMBERS AND DETAILS OF TOPICS ALLOTTED

Name of the co-ordinator – Smt. Kiran, KV CLRI

S.No. Name of the Name of the Chapter


Name of the KV
Teacher allotted
Smt. Beena J KV Virudhunagar Introduction to computer
1 Stuvert system

Smt. Shikha KV no 1 Introduction to Python - Till


2 Basniwal Pondicherry, Shift-1 Control Statements
KV AFS Avadi Introduction to Python- For
3 Sh. Som Gupta loop, List and Dictionary
KV No.1 Madurai Database concepts and the
4 Sh. Tom Josina Structured Query Language
KV Minambakkam Introduction to the Emerging
5 Smt. Asha D Raju Trends

With support of other contractual PGT CS of different KVs of Chennai


Region
COURSE DIRECTOR
Sh. N. RAKHESH
PRINCIPAL
KV VIJAYANARAYANAM, CHENNAI
INDEX
Sl.No Contents
1 Curriculum 2022-23
2 Introduction to Computer System
3 Introduction to Python
4 Control Statements in Python
5 for loop, List and Dictionary
6 Database concepts
7 Structured Query Language
8 Emerging Trends
9 Worksheets
10 Flash Cards
11 Sample Question Paper - I
12 Sample Question Paper - II
13 Sample Question Paper - III
14 Sample Question Paper - IV
Informatics Practices (2022-23)
CLASS XI Code No. 065
1. Prerequisite. None

2. Learning Outcomes

At the end of this course, students will be able to:


Identify the components of computer system.
Create Python programs using different data types, lists and
dictionaries.
Understand database concepts and Relational Database
Management Systems.
Retrieve and manipulate data in RDBMS using Structured
Query Language
Identify the Emerging trends in the fields of Information
Technology.

3. Distribution of Marks and Periods

Unit Unit Name Marks Periods Periods Total


No Theory Practical Period
1 Introduction to computer system 10 10 - 10

2 Introduction to Python 25 35 28 63

3 Database concepts and the 30 23 17 40


Structured Query Language
4 Introduction to Emerging 5 7 - 7
Trends
Practical 30 - - -

Total 100 75 45 120

4. Unit Wise syllabus

Unit 1: Introduction to Computer System

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


computer system and their interconnections, Input/output devices.
Computer Memory: Units of memory, types of memory primary and secondary, data deletion,
its recovery and related security concerns.
Software: purpose and types system and application software, generic and specific purpose
software.
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.
Practical Marks Distribution

S.No. Unit Name Marks

1 Problem solving using Python programming language 11

3 Creating database using MySQL and performing Queries 7

4 Practical file (minimum of 14 python programs, and 14 SQL 7


queries)

5 Viva-Voce 5

Total 30

5. Suggested Practical List


5.1 Programming in Python
1. To find average and grade for given marks.
2. To find sale price of an item with given cost and discount (%).
3. To calculate perimeter/circumference and area of shapes such as triangle, rectangle,
square and circle.
4. To calculate Simple and Compound interest.
5. To calculate profit-loss for given Cost and Sell Price.
6. To calculate EMI for Amount, Period and Interest.
7. To calculate tax - GST / Income Tax.
8. To find the largest and smallest numbers in a list.
9. To find the third largest/smallest number in a list.
10. To find the sum of squares of the first 100 natural numbers.
11.
12. To count the number of vowels in user entered string.
13. To print the words starting with a alphabet in a user entered string.
14. To print number of occurrences of a given alphabet in each string.
15. Create a dictionary to store names of states and their capitals.
16. Create a dictionary of students to store names and marks obtained in 5 subjects.
17. To print the highest and lowest values in the dictionary.
5.3 Data Management: SQL Commands
18. To create a database
19. To create student table with the student id, class, section, gender, name, dob, and
marks as attributes where the student id is the primary key.
20. To insert the details of at least 10 students in the above table.
21. To display the entire content of table.
22. To display Rno, Name and Marks of those students who are scoring marks more than
50.
23. To find the average of marks from the student table.
24.
25. To dis
ANAND, ANGAD,..)
26. - 01-
-12-
27. To display Rno, Name, DOB, Marks, Email of those male students in ascending order of
their names.
28. To display Rno, Gender, Name, DOB, Marks, Email in descending order of their marks.
29. To display the unique section available in the table.

Suggested material
NCERT Informatics Practices - Text book for class - XI (ISBN- 978-93-5292-148-5 )
Excluded topics
Nested loop(Chapter -3, Section - 3.13)
Loading and saving NumPy array in text files (Chapter-6, Sections- 6.10 and
6.11)
Unit 1: Introduction to Computer System

Computer System
• A computer is an electronic device that operates according to the instructions
stored in its memory.

• A computer along with additional hardware and


software together is called a computer system.
• Computers are used in various fields in our daily
life.
• Computers have taken industries and businesses to
a whole new level.
• Some of the application areas of the computer
include education, entertainment, and science and
engineering
Evolution of computing
Computing Description year
device
Abacus • Mechanical device capable of doing simple 500
arithmetic calculations only BC
Pascaline • It performs addition and subtraction of two numbers 1642
directly and multiplication and division through
repeated addition or subtraction
Analytical • A mechanical computing device for inputting, 1834
Engine processing, storing and displaying the output, which
is considered to form the basis of modern
computers.
Tabulating • It is a tabulating machine for summarising the data 1890
Machine stored on the punched card.
• It is considered to be the first step towards
programming
• General purpose programmable machine that was
Turing Machine 1937
capable to solve any problem by executing the
program stored on the punched cards
EDVAC/ENIAC • The concept of stored program computer which was 1945
capable of storing data as well as program in the
memory.
• The EDVAC and then the ENIAC computers were
developed based on this concept.
Transistor • Vaccum tubes were replaced by transistors 1947
developed at Bell Labs, using semiconductor
materials
Integrated • Integrated Circuit (IC) is a silicon chip which 1970
Circuit contains entire electronic circuit on a very small
area.
• The size of computer has drastically reduced
because of ICs

Generations of Computer

• The development of electronic computers can be divided into five generations


depending upon the technologies used.
• These are the first generation, second generation, third generation, fourth
generation, and fifth generation.
First  invented in 1946 - 1959
Generation  huge, slow, and expensive
 Technology used-vacuum
tubes

Second  Period-1959– 1965


generation  Technology used-
transistors

Third  Period-1965– 1971


Generation  Technology used-
integrated circuit

fourth  Period-1971– 1980


Generation  Technology used-
microprocessors

fifth  Period-1980 - present


Generation  Technology used-
Artificial Intelligence
Components of a Computer System

INPUT  The devices through which control Eg:


DEVICE signals are sent to a computer are  Keyboard
termed as input devices.  Mouse
 Input devices convert the input data
into a digital form that is acceptable by
the computer system
Central • The CPU’s known as the brain of a
processing computer.
unit (CPU) • The term CPU is normally used to
refer to a processor that consists of the
arithmetical logical unit (ALU) and
control unit (CU).
• CPU = ALU + CU
• It performs all the basic logical and
arithmetic operations activities and
transmits the commands and programs
of the computer.

Output unit  The device that receives data from a Eg:


computer system for display, physical  Monitors
 Printers
production, etc., is called output  Speakers
device.
Output unit converts the output in
binary form to human readable
form
Memory unit  A computer system needs memory to  Primary memory-
store the data and instructions for RAM, ROM
processing.  Secondary
 It is a collection of cells with unique memory-hard
address. disk, pendrive, cd
etc

Input Devices
• Any hardware device that
sends data to the computer,
allowing you to interact with
and control it.
• The most commonly used
or primary input devices on
a computer are the keyboard
and mouse.

Key board

• A keyboard is a peripheral device that


enables a user to input text into a computer or any
other electronic machinery.
• A keyboard is an input device and is the most
basic way for the user to communicate with a
computer.
• The keys include punctuation, alphanumeric and special keys like the
Windows key and various multimedia keys, which have specific functions
assigned to them.
Mouse
• A mouse is a small hardware input device used by
hand. It controls the movement of the cursor on the
computer screen and allows users to move and select
folders, text, files, and icons on a computer.
• When the users move the mouse, the cursor moves
in the same direction on the display screen.
Joystick
• A joystick is an input device that can be used
for controlling the movement of the cursor or a
pointer in a computer device.
• The input device is mostly used for gaming
applications and sometimes in graphics applications.

Scanner
A scanner is a device that captures image from
photographic prints, posters, magazine pages and
similar sources for computer editing and display.

Output Devices
• A piece of equipment / hardware
which gives out the result of the entered
input, once it is processed
• The most commonly used or primary
output devices on a computer are Monitor
, speaker, printer, etc .
Monitor
•A monitor is an output device and an electronic
visual computer display that includes a screen,
circuitry and the case in which that circuitry is
enclosed.
•Nowadays, flat-screen LCD monitors are used in
devices like laptops.

Speaker
• Speakers are one of the most common output
device used with computer systems.
• Some speakers are designed to work
specifically with computers, while others can be
hooked up to any type of sound system.

Projector
• A projector is an output device that projects
an image onto a large surface, such as a white screen
or wall.
• It may be used an alternative to a monitor or
television when showing video or images to a large
group of people.
Computer Memory
A computer system needs memory to store the data and instructions for processing.
Units of Memory
➢ A computer system uses binary numbers to store and process data.
➢ The binary digits 0 and 1, which are the basic units of memory, are called bits.
➢ Group of four bits is called nibble.(eg: 1001,1010)
➢ Group of 8 bits is called byte.(eg:10101100)
➢ Bytes are grouped together to make bigger chunks or units of memory

Types of Memory
Computers have two types of memory: Primary memory, Secondary memory
A. Primary Memory
➢ It is an essential component of a computer system.
➢ Program and data are loaded into the primary memory before processing.
➢ The CPU interacts directly with the primary memory to perform read/ write
operation
➢ Two types:
o Random access memory (RAM)
o Read only memory (ROM)
➢ RAM is usually referred to as main memory and it is faster than the secondary
memory or storage devices.
RAM ROM
Random access memory Read only memory
Volatile memory- As the power supply Non-Volatile memory- its contents are
is turned off, all the contents of RAM not lost even when the power is turned
are wiped out. off.

It is used to store data temporarily while Startup program (boot loader) is stored
the computer is working in a ROM

Temporary storage Permanent storage

B. Memory
➢ It is high speed memory placed between CPU and RAM, in order to speed up
the operations of the CPU.
o Reason is RAM is not as fast as a computer processor. This makes the
CPU to slow down the processing. To make the processing fast, a high-
speed memory is used. That memory is cache memory
➢ It stores the frequently accessed data. Thus, it reduces the average time
required to access data from primary memory.
C. Secondary Memory
➢ Primary memory has limited storage capacity and that is not enough to store
the data. Thus, a computer system needs another memory to store data
permanently and with large capacity. For that purpose, secondary memory is
used.
➢ The secondary memory stores the data permanently and has larger storage
capacity than primary memory.
➢ It is slower and cheaper than the main memory.
➢ CPU cannot directly access the secondary memory.
➢ Eg: Pendrive, Hard disk, Floppy, CD, DVD

Data Capturing, Storage, and Retrieval

Data Capturing-
➢ It involves the process of gathering data from different sources in digital
form.
➢ Data is captured using keyboard, web cam, sensors, barcode reader etc.
Data storage-
➢ It is the process of storing the captured data for processing later.
➢ Huge amount of data is generating every time, so the storage devices also
require to be upgraded periodically
➢ Data servers are used in large organizations for storing the data.
Data Retrieval
➢ It involves fetching data from the storage devices, for its processing as per the
requirement.
➢ Minimizing the data access time is crucial factor for retrieval of data.
Data deletion and recovery
Two security concerns associated with data:
➢ Deletion by some unauthorised person or software
o This can be avoided by using passwords or encrypting the files
➢ Unwanted recovery of data by unauthorised user/software
o While discarding old, broken or malfunctioning storage devices, make
sure that the data is deleted.

SOFTWARE

➢ Software is set of programs that governs the operation of a computer system and
makes the hardware run.
➢ The sole purpose of a software is to make computer hardware useful and
operational.
➢ software acts as an interface between human users and the hardware.

System software:
➢ Software that controls the internal computer operations are called system
software.
➢ system software includes operating systems, system utilities, device drivers,

Operating ➢ It is a program which acts as an Eg:


system interface between a user and the ➢ Windows
hardware, ➢ Linux
➢ Goal of OS: ➢ Solaris
o It makes the computer system
convenient to use
o To use computer hardware in
an efficient manner.

Language ➢ It is a special type of software that Eg:


Processors can translate the source code into an ➢ Compiler
object code or machine code. ➢ Interpreter
➢ Source code- The program code ➢ Assembler
written by a programmer in a high
level language(HLL) such as
python, Java,c++ etc.
➢ Object code-The code usually in
machine language or binary code.

Utility software ➢ Software used for maintenance and Eg:


configuration of the computer ➢ Text editor
system is called system utility ➢ Antivirus
software
➢ Compression
software
➢ Disk
fragmenter
➢ Backup
software
Device Drivers ➢ The device driver acts as an interface Eg: computer
between the device and the accessories like
operating system. printers, scanners,
➢ The purpose of a device driver is to web camera etc
ensure proper functioning of a come with their
particular device. own driver
software
Application software
➢ It is the set of programs necessary to carry out operations for a specified
application.
➢ It includes General Purpose Software and customized software
General Purpose ➢ These are ready to use software for Eg:
application daily use purpose. ➢ word
software ➢ It is developed for generic processor
applications, to cater to a bigger ➢ spread sheet
audience in general ➢ DBMS
Specific Purpose ➢ These are custom or tailor-made Eg:
application application software, that are ➢ Banking
software developed to meet the requirements software
(customized of a specific organisation or an ➢ railway
software) individual. reservation
➢ Hospital
Management

Proprietary or Free and Open Source Software


Free and Open Developers of some software Eg:
Source allow public to freely use their ➢ Ubuntu
Software(FOSS) software along with source ➢ Python
code with an aim to improve ➢ Libreoffice
further with each other’s help. ➢ Openoffice

Freeware software is freely available for Eg:


use but source code may not be ➢ Skype
available ➢ Adobe Reader
proprietary software When software to be used has Eg:
to be purchased from the ➢ Microsoft
vendor who has the copyright Windows
of the software is called ➢ Tally
proprietary software ➢ Quickheal
Unit 2: Introduction to Python
MODES OF WORKING

Interactive Mode
Interactive mode is running blocks or a single line of Python code. The code executes
via the Python shell. Interactive mode is handy when you just want to execute basic
Python commands or you are new to Python programming.

Script Mode
If you need to write a long piece of Python code or your Python script spans multiple
files, interactive mode is not recommended. Script mode is the way to go in such
cases. In script mode, You write your code in a text file then save it with a .py
extension which stands for "Python". This file can be executed by Python Interpreter
later on.

Python Keywords
Python keywords are special reserved words that have specific meanings and
purposes and can’t be used for anything but those specific purposes. An example of
something you can’t do with Python keywords is assign something to them.
Examples of keywords are : False, else, import, pass, in, is, True, and continue etc.

Python Identifiers

Identifiers are names given to different entities such as constants, variables,


structures, functions, etc. Example: int, amount; True, totalbalance; In the above
example, amount and totalbalance are identifiers and int, and double are keywords.

Rules for Identifiers


• Identifiers can be a combination of letters in lowercase (a to z) or uppercase
(A to Z) or digits (0 to 9) or an underscore _ .
• An identifier cannot start with a digit.
• Keywords cannot be used as identifiers.
• We cannot use special symbols like !, @, #, $, % etc.
• An identifier can be of any length.

BUILT-IN DATA TYPES


In programming, data type is an important concept. Variables can store data of
different types, and different types can do different things. Python has the following
data types built-in by default, in these categories:

Text : Str
Numeric: int, float, complex
Sequence : list, tuple, dict
Set :set
Boolean : bool (Only True and False Value)
None

PYTHON OPERATORS

Operators are used to perform operations on variables and values. In the example
below, we use the + operator to add together two values: Python divides the
operators in the following groups:

• Arithmetic operators
• Assignment operators
• Comparison operators
• Logical operators
• Identity operators
• Membership operators
• Bitwise operators
PYTHON ARITHMETIC OPERATORS
Arithmetic operators are used with numeric values to perform common
mathematical operations:

Operator Name Example


+ Addition x+y
- Subtraction x-y
* Multiplication x*y
/ Division x/y
% Modulus x%y
** Exponentiation x ** y
// Floor division x // y

PYTHON ASSIGNMENT OPERATORS


Assignment operators are used to assign values to variables:

Operator Example Same As


= x=5 x=5
+= x += 3 x=x+3
-= x -= 3 x=x-3
*= x *= 3 x=x*3
/= x /= 3 x=x/3
%= x %= 3 x=x%3
//= x //= 3 x = x // 3
**= x **= 3 x = x ** 3
&= x &= 3 x=x&3
|= x |= 3 x=x|3
^= x ^= 3 x=x^3
>>= x >>= 3 x = x >> 3
<<= x <<= 3 x = x << 3

PYTHON LOGICAL OPERATORS


Logical operators are used to combine conditional statements:

Operator Description Example


and Returns True if both statements are true x < 5 and x < 10

or Returns True if one of the statements is true x < 5 or x < 4

not Reverse the result, returns False if the result is true not(x < 5 and x < 10)

PYTHON IDENTITY OPERATORS


Identity operators are used to compare the objects, not if they are equal, but if they
are actually the same object, with the same memory location:

Operator Description Example


is Returns True if both variables are the same object x is y
is not Returns True if both variables are not the same object x is not y

PYTHON MEMBERSHIP OPERATORS


Membership operators are used to test if a sequence is presented in an object:

Operator Description Example


in Returns True if a sequence with the specified value x in y
is present in the object

not in Returns True if a sequence with the specified value x not in y


is not present in the object

PYTHON BITWISE OPERATORS

Bitwise operators are used to compare (binary) numbers:

Operator Name Description


& AND Sets each bit to 1 if both bits are 1
| OR Sets each bit to 1 if one of two bits is 1
^ XOR Sets each bit to 1 if only one of two bits is 1
~ NOT Inverts all the bits
<< Zero fill left Shift left by pushing zeros in from the right and let the
shift leftmost bits fall off
>> Signed right Shift right by pushing copies of the leftmost bit in from the
shift left, and

What are mutable and immutable data types in python?

Python Mutable data types are those whose values can be changed in place whereas
Immutable data types are those that can never change their value in place.

Here are Mutable data types :


1. Lists
2. Dictionaries
3. Sets

And Immutable data types in Python:


1. Integers
2. Floating-Point numbers
3. Booleans
4. Strings
5. Tuples

INPUT AND OUTPUT


In Python, we have the input() function for taking values entered by
input device such as a keyboard. The input() function prompts user to enter
data. It accepts all user input (whether alphabets, numbers or special
character) as string. The syntax for
input() is:
variable = input([Prompt])
Prompt is the string we may like to display on the screen prior to taking
the input, but it is optional. The input()takes exactly what is typed from
the keyboard, converts it into a string and assigns it to the variable on left
hand side of the assignment operator (=).
Example
>>> fname = input("Enter your first name: ")
Enter your first name: Arnab
>>> age = input("Enter your age: ")
Enter your age: 19
The variable fname gets the string ‘Arnab’ as input. Similarly, the variable
age gets '19' as string. We can change the datatype of the string data
accepted from user to an appropriate numeric value. For example, the int()
function will convert the accepted string to an integer. If the entered string
is non-numeric, an error will be generated.

Example
#function int() to convert string to integer
>>> age = int(input("Enter your age: "))Enter your age: 19
>>> type(age)
<class 'int'>

Python uses the print() function to output data to standard output device
— the screen. The function print() evaluates the expression before displaying
it on the screen. The syntax for print()is:
print(value)
Example
print("Hello") Output: Hello
CONTROL STATEMENTS IN PYTHON
A program’s control flow is the order in which the program’s code executes. Thecontrol
flow of a Python program is regulated by conditional statements, loops,and function
calls.
Python has three types of control structures:
• Sequential - default mode

• Selection - used for decisions and branching

• Repetition - used for looping, i.e., repeating a piece of code

multipletimes.

1. SEQUENTIAL
Sequential statements are a set of statements whose execution process happens in a
sequence. The problem with sequential statements is that if the logic has broken in any
one of the lines, then the complete source code execution will break.

2. SELECTION/DECISION CONTROL STATEMENTS


In Python, the selection statements are also known as Decision control statements or
branching statements. The selection statement allows a program to test several
conditions and execute instructions based on which condition is true.

Some Decision Control Statements are:


• Simple if
• if-else
• nested if
• if-elif-else
Simple if:
If statements are control flow statements that help us to run a particular code, but only
when a certain condition is met or satisfied. A simple if only has one condition to check.

# If the number is positive, we print an appropriate message


num = 3
if num > 0:
print(num, "is a positive number.")print("This is always printed.")

num = -1
if num > 0:
print(num, "is a positive number.")print("This is also always printed.")

if-else
The if-else statement evaluates the condition and will execute the body of ‘if’, if the
test condition is True, but if ‘ i f ’ the condition is False, then the body of else is
executed.
#Take user input and find whether number is odd or even
inp_num = input("Enter a number: ") #Convert string to int
inp_num = int(inp_num)

if inp_num == 0:
print(inp_num, "is Even")
elif inp_num%2==0:
print(inp_num, "is Even")
else:
print(inp_num, "is Odd")
if-elif-else:
The if-elif-else statement is used to conditionally execute astatement or a
block of statements.

# '''In this program, we check if the number is positive or negative or zero and
display an appropriate message'''

num = 3.4
# Try these two variations as well:
# num = 0
# num = -4.5

if num > 0:
print("Positive number")elif num == 0:
print("Zero")
else:
print("Negative number")

Nested if:
Nested if statements are an if statement inside another if statement.
#'''In this program, we input a number check if the number is positiveor negative
or zero and display an appropriate message This time we use nested if statement'''

num = float(input("Enter a number: "))if num >= 0:


if num == 0:
print("Zero")
else:
print("Positive number")
else:
print("Negative number")
FOR LOOP, LIST & DICTIONARY
for
The “for” statement is used to iterate over a range of values or a sequence.
The loop is executed for each item in the range. The values can be numeric, string,
list, or tuple.
Syntax of the for loop

for <control-variable> in <sequence/ items in range>:


<statements>

Note: Body of the loop is indented with respect to the for statement.
• Syntax 1:

for <var> in range(start, stop, step):


Statements to be repeated

Note: Default value for start=0 and step=1


range(1,3) : will produce 1, 2, 3
range(1,5,2) : will produce 1, 3
range(4) : will produce 0, 1, 2, 3
range (10, 0, -4) : will produce 10, 6, 2
range(2, 3) : will produce 2

• Syntax 2:

for <var> in <Sequence>:


Statements to be repeated
Example 1: Example 2:
for value in range (3, 9): for value in “python” :
print(value) print(value)
will print will print
3 p
4 y
5 t
6 h
7 o
8 n

for loop implementation


• Program to find the sum of first 5 natural numbers

Sum = 0
for num in range(1, 6, 1):
Sum += num
print(Sum)
LIST
A list is a standard data type of python that can store a sequence of values
belonging to any type. List are mutable. You can change elements of a list in place.
Following are some lists in python:
[] empty list
[1, 2, 3] list of integers
[‘a’, 1,’b’,2] list of mixed values
[1, 2, [10, 20], 5, 6] Nested list
List Functions– Python also offers many built-in functions and methods for list
manipulation. These can be applied to list as per following syntax :
<listobject> . <method name> ( )
• append() – It adds a single item to the end of the list .
Syntax: list. append(<item>)
>>>l1 =[1,2,3]
>>>l1. append(4)
>>>print(l1)
[1, 2, 3, 4]
>>> l1. append([5,6])
>>>print(l1)
[1, 2, 3, 4, [5, 6] ]
• index() - It returns the index of first matched item from the list.
Syntax: list. index(<item>)
>>>l1 =[1,2,3]
>>> l1. index(3)
2
• extend() –It is used for adding multiple elements to a list.
Syntax: list. extend(<list>)
>>>l1 =[1,2,3]
>>>l1. extend([5, 6])
>>>print(l1)
[1, 2, 3, 5, 6]
• insert() – It is used to insert an item at a given position.
Syntax : list. insert( <pos> , <item> )
>>>l1 =[1,2,3]
>>>l1.insert(0, -9)
>>>print(l1)
[-9, 1, 2, 3]
• pop() - It is used to remove am item of the given index from the list. By
default, item with index -1, that is last element will be removed
Syntax : list. pop(<index>)
>>>l1 =[1,2,3]
>>>l1. pop()
3
>>>l1. pop(0)
1
• remove()-It is used to remove the first occurrence of given item from the
list.
Syntax : list. remove(<value>)
>>>l1 =[1,2,3]
>>>l1. remove(2)
>>>print(l1)
[1, 3]
>>>l1. remove(5)
ValueError

• clear()-It is used to remove all the items from the list and the list becomes
empty.
Syntax : list. clear()
>>>l1 =[1,2,3]
>>>l1.clear()
>>>print(l1)
[]
• count()-This function returns the count of the item passed as a parameter.
Syntax : list. count(<item>)
>>>l1 =[1,2,1,3,5]
>>>l1.count(1)
2
>>>l1.count(4)
0
• reverse()–It will reverse the items of the list.
Syntax: list. reverse()
>>>l1 =[1,2,3]
>>>l1.reverse()
>>>print(l1)
[3,2,1]
• sort()-It will sort the items of the list in increasing order by default.
Syntax : list. sort()
>>>l1 =[1,2,4,3,-2]
>>>l1.sort()
>>>print(l1)
[-2, 1, 2, 3, 4]
>>>l2=[90,34,26,180]
>>>l2.sort(reverse=True)
>>>print(l2)
[180, 90, 34, 26]
>>>l3=[‘a’, ‘s’, ‘c’, ‘i’]
>>>l3.sort()
>>>print(l3)
[‘a’, ‘c’, ‘i’, ‘s’]
LIST MANIPULATION:
1. Updating elements from the list – By assigning new value to the element of
the list through its index will change an element. Ex:
>>>l1 =[1,2,3]
>>>l1[2] = 4
>>>l1
[1,2,4]
2. Deleting elements from the list – the del statement is used to remove an
individual item, or to remove all items identified by a slice.
>>>l1=[10,12,13,14]
>>>del l1[2]
l1
[10,12,14]
3. Slicing the list – Like string a subpart of the list will be displayed.
>>>l1=[10,12,14,20,22,24,30,32,34]
>>>s=l1[3 :-3]
s
[20, 22, 24]
4. Joining lists-The concatenation operator + when used with two lists, joins two
lists together
>>>l1=[1,2,3]
>>>l2=[4,5,6]
>>>l1+l2
>>>[1,2,3,4,5,6]
5. Replicating Lists-The * operator replicate a list specified number of times.
>>>l1=[1,2]
>>>l1*2
>>>[1,2,1,2]
List manipulation programs
• Program for printing only the odd numbers of the given list
m = [2, 7, 8, 3, 5, 9, 0]
for val in m:
if val%2!=0:
print(val)

• Program for finding the sum of all even numbers in a given list
k = [9, 4, 8, 2, 14, 2]
Sum_even=0
for val in k:
if val%2==0:
Sum_even+=val
print(“Sum of all the even numbers in the given list is”, Sum_even)

DICTIONARY
Dictionaries are a collection of some key-value pairs. Dictionaries are
mutable, unordered collections with elements in the form of a key: value pairs that
associates keys to values. The syntax to create a dictionary is :
<dictionary-name> = {<key> : <value> , <key> :<value>...............}
Ex: emp = {‘salary’ : 10000 , ‘age’ :24 , ‘name’ : ‘john’ }
>>>emp.keys()
[‘salary’, ’age’, ’name’]
>>>emp.values()
[10000,24,’john’]

Dictionary Functions and Methods :


1. len() method – This method returns length of the dictionary (the count of
elements) Ex:
>>> emp = {‘salary’ : 10000 , ‘age’ :24 , ‘name’ : ‘john’ }
>>>len(emp)
3
2. clear() method – This method removes all items from the dictionary and the
dictionary becomes empty.
>>> emp = {‘salary’ : 10000 , ‘age’ :24 , ‘name’ : ‘john’ }
>>>emp. clear()
{}
3. get() method – With this method we can get the item with the given key.
>>> emp = {‘salary’ : 10000 , ‘age’ :24 , ‘name’ : ‘john’ }
>>>emp. get(‘age’)
24
4. items() method – This method returns all of the items in the dictionary as a
sequence of(key,value) tuples .
emp = {‘salary’ : 10000 , ‘age’ :24 , ‘name’ : ‘john’ }
mylist=emp. items()
for x in mylist :
print(x)
The output will be like this:
(‘salary’ ,10000)
(‘age’ ,24)
(‘name’, ‘john’)
5. keys() method – This method returns all of the keys in the dictionary as a
sequence of keys.
>>> emp = {‘salary’ : 10000 , ‘age’ :24 , ‘name’ : ‘john’ }
>>>emp. keys()
>>>[‘salary’ ,’age’ ,’name’]
6. values() method - This method returns all of the values in the dictionary as a
sequence (a list).
>>>emp. values()
>>>[10000, 24, ‘john’]
7. update() method – This method merges key: value pairs from the new
dictionary into the original dictionary, adding or replacing as needed . The
items in the new dictionary are added to the old one and override any items
already there with the same keys.
This method returns all of the keys in the dictionary as a sequence of keys.
>>> emp1 = {‘salary’: 10000 , ‘age’ :24 , ‘name’ : ‘john’ }
>>> emp2 = {‘salary’: 20000 , ‘age’ :25 , ‘name’ : ‘riya’ }
>>>emp1. update(emp2)
>>>emp1
{‘salary’: 20000 , ‘age’ :25 , ‘name’ : ‘riya’ }
Dictionary Operations:
1. Traversing a Dictionary: Traversal of a collection means accessing and
processing each element of it.
>>> emp1 = {‘salary’: 10000 , ‘age’ :24 , ‘name’ : ‘john’ }
>>>for key in emp1:
print(key, ‘:’, emp1[key])
salary: 10000
age: 24
name: john
2. Adding elements to a dictionary: A new element can be added in the
dictionary but it must not exist in dictionary and must be unique, if the key
already exists then this statement will change the value of existing key and no
new entry will be added.
>>> emp1 = {‘salary’ : 10000 , ‘age’ :24 , ‘name’ : ‘john’ }
>>>emp1[‘dept’] = ‘sales’
>>>emp1
{‘salary’ : 10000 , ‘age’ :24 , ‘name’ : ‘john’ , ‘dept’ : ‘sales’}
3. Deleting elements from a dictionary:
There are two methods for deleting elements from a dictionary.
(a) To delete a dictionary element or a dictionary entry, i.e., a key: value pair
>>>emp1 ={‘salary’ : 10000 , ‘age’ :24 , ‘name’ : ‘john’ }
>>>del emp1[‘age’]
>>>emp1
{‘salary’ : 10000 , ‘name’ : ‘john’ }
(b) To delete elements using pop() method
>>>emp1 = {‘salary’: 10000 , ‘age’ :24 , ‘name’ : ‘john’ }
>>>emp1. pop (‘age’)
>>>24
{‘salary’: 10000 , ‘name’: ‘john’ }
4. Checking for the existence of a key: The membership operator in and not in
work with dictionary to check the existence of an element.
>>>emp1= {‘salary’: 10000 , ‘name’: ‘john’ }
>>>’age’ in emp1
True
>>> ‘riya’ not in emp1
True
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

DATABASE CONCEPTS

➢ Database
A database is a place where bulk amount of interrelated data is stored in an organized
way, so that it can be easily accessed and managed.

➢ Need and advantages of database over traditional files


• Database facilitates centralized storing
• Reduces Data inconsistency
• Reduces data redundancy
• Sharing of data is possible
• It gives protection to the data
• It enforces standards
➢ DBMS – Database management system
A software manages database. It is a software that is responsible for storing,
manipulating, maintaining and utilizing database.
Eg: MySQL, PostgreSQL, Microsoft Access, SQL Server, FileMaker

➢ Relational Database - A database where data are organized in the form of tables
(rows and columns)

➢ Relational Data model - It represents the database as a collection of relations. A


relation is nothing but a table of values. Every row in the table represents a collection
of related data values. These rows in the table denote a real-world entity or
relationship.

➢ RDBMS – Relational Database Management System . A software that manages


relational database
Eg: Microsoft SQL Server, Oracle , MySQL and IBM DB2
Table: Employee
Empid Ename Age Dept Designation Date_of_Join Salary

101 Manish 35 Sales Salesman 22-05-2010 35000

102 Rekha 30 HR Accountant 01-07-2015 40000

103 Swati 40 HR Manager 05-09-2011 55000

104 Rahul 26 Marketing Manager 08-01-2018 30000

Terminologies in RDBMS

➢ Relation - Tables in Relational Database


Eg:Employee

➢ Attributes - Columns in a Relation


Eg: Empid, Ename, Age, Dept, Designation, Date_of_Join, Salary
➢ Tuples - Records/Rows in a relation
Eg: 101, Manish, 35, Sales, Salesman, 22-05-2010 , 35000

➢ Degree – No. of attributes in a relation


Degree of Employee:7

➢ Cardinality – No. of Tuples/records in a relation


Eg: Cardinality of Employee:4

➢ Domain - Set of values taken for an attribute


Eg: Domain of (Ename)={ Manish, Rekha, Swati, Rahul}

➢ Primary key - Key attribute that uniquely identifies a tuple


• Only one primary key in a relation
• No null values in primary key column
• No values can be repeated in a primary key column
Eg: Empid in Employee table

➢ Candidate keys - Set of attributes which are eligible to become primary key
Eg:candidate(employee)={Empid, Ename}

➢ Alternate keys - All the candidate keys except primary key


Eg:alternate key(employee)={Ename}

Candidate key=primary key + alternate key


Alternate key=candidate key-primary key
STRUCTURED QUERY LANGUAGE (SQL)
Structured Query Language (SQL) is a standard language for accessing and
manipulating databases.
SQL commands are mainly categorized into four categories as:
1. DDL – Data Definition Language
2. DQL – Data Query Language
3. DML – Data Manipulation Language
4. DCL – Data Control Language
DDL (Data Definition Language):
DDL or Data Definition Language consists of the SQL commands that can be used
to define the database schema. It simply deals with descriptions of the database
schema and is used to create and modify the structure of database objects in the
database. DDL is a set of SQL commands used to create, modify, and delete database
structures but not data. These commands are normally not used by a general user,
who should be accessing the database via an application.
List of DDL commands:

✓ CREATE: This command is used to create the database or its objects (like table,
index, function, views, store procedure, and triggers).

✓ DROP: This command is used to delete objects from the database.

✓ ALTER: This is used to alter the structure of the database.


DQL (Data Query Language):
DQL statements are used for performing queries on the data within schema objects.
The purpose of the DQL Command is to get some schema relation based on the
query passed to it. We can define DQL as follows it is a component of SQL statement
that allows getting data from the database and imposing order upon it. It includes the
SELECT statement. This command allows getting the data out of the database to
perform operations with it.
List of DQL Commands:

✓ SELECT: It is used to retrieve data from the database.

DML(Data Manipulation Language):


The SQL commands that deals with the manipulation of data present in the database
belong to DML or Data Manipulation Language and this includes most of the SQL
statements. It is the component of the SQL statement that controls access to data and
to the database.
Basically, DCL statements are grouped with DML statements.
List of DML commands:

✓ INSERT : It is used to insert data into a table.

✓ UPDATE: It is used to update existing data within a table.

✓ DELETE : It is used to delete records from a database table.


INTRODUCTION TO MySQL
MySQL an open source and freely available RDBMS that uses SQL. It provides
features for creating, storing, maintaining and accessing data stored in databases in
the form of tables.
Features of MySQL
• Speed - MySQL runs very fast.
• Ease of Use - Can be managed from command line or GUI
• Cost – It is available free of cost. It is Open Source
• Query language Support- Supports SQL
• Portability - Can be run on any platform and supported by various compilers
• Data Types - Supports various data types like Numbers, Char etc.
• Security- Offers privileges and password systems that is very flexible and
secure.
• Scalability and Limits - Can handle large databases. Some of real life
MySQL databases contains millions of records.
• Connectivity - Clients can connect to MySQL using drivers
CREATING AND OPENING DATABASE:
CREATE DATABASE :
Example: mysql> create database School;
Now the database with the given name will be created.
TO OPEN DATABASE :
mysql> use School;
Data types: Data types are means to identify the type of data and associated
operations for
handling it. MySQL uses many different data types divided into three categories −
● Numeric
● Date and Time
● String Types.
Numeric Data Types
MySQL uses all the standard ANSI SQL numeric data types
The following list shows the common numeric data types and their descriptions –
● INT − A normal-sized integer that can be signed or unsigned. If signed, the
allowable range is from -2147483648 to 2147483647. If unsigned, the allowable
range is from 0 to 4294967295. You can specify a width of up to 11 digits.
● FLOAT(M,D) − A floating-point number that cannot be unsigned. You can define
the display length (M) and the number of decimals (D). This is not required and will
default to 10,2, where 2 is the number of decimals and 10 is the total number of
digits (including decimals). Decimal precision can go to 24 places for a FLOAT
● DECIMAL(M,D) − An unpacked floating-point number that cannot be unsigned.
In the unpacked decimals, each decimal corresponds to one byte. Defining the
display length (M) and the number of decimals (D) is required
● DOUBLE(M,D) − A double precision floating-point number that cannot be
unsigned. You can define the display length (M) and the number of decimals (D).
This is not required and will default to 16,4, where 4 is the number of decimals.
Decimal precision can go to 53 places for a DOUBLE.
Date and Time data type
● DATE − A date in YYYY-MM-DD format. For example, December 30th, 1973
would be stored as 1973-12-30.
● DATETIME − A date and time combination in YYYY-MM-DD HH:MM:SS
format. For example, 3:30 in the afternoon on September 30th, 2005 would be stored
as 2005-09-30 15:30:00.
● TIME − Stores the time in a HH:MM:SS format.
● YEAR(M) − Stores a year in a 2-digit or a 4-digit format. If the length is specified
as 2 (for example YEAR(2)), YEAR can be between 1970 to 2069 (70 to 69). If the
length is specified as 4, then YEAR can be 1901 to 2155. The default length is 4.
String Types
Most data you'll store will be in a string format. Common string datatypes in
MySQL.
● CHAR(M) − A fixed-length string between 1 and 255 characters in length (for
example CHAR(5)), right-padded with spaces to the specified length when stored.
Defining a length is not required, but the default is 1.
● VARCHAR(M) − A variable-length string between 1 and 255 characters in length.
For example, VARCHAR(25). You must define a length when creating a
VARCHAR field.
Difference between Char & Varchar
Char Varchar
It is an abbreviation for characters. It is an abbreviation for variable
characters.

Char datatype is used to store character Varchar datatype is used to store character
strings of fixed length. strings of variable length.

It uses static memory location. It uses dynamic memory location


We can use char datatype when we know We can use it when we are not sure of the
the length of the string length of the string.

Char datatype can be used when we expect Varchar datatype can be used when we
the data values in a column to be of same expect the data values in a column to be of
length. variable length.

It takes more memory It takes less memory


CREATE TABLE
This command builds a new table and has a predefined syntax. The CREATE
statement syntax is:
CREATE TABLE [table name] ([column definitions]) [table parameters];
For example:
CREATE TABLE Employee (Employee Id INTEGER PRIMARY KEY, First
name CHAR(50) NULL, Last name CHAR (75) NOT NULL);

The mandatory semi-colon at the end of the statement is used to process every
command before it. In this example, the string CHAR is used to specify the data
type. Other data types can be DATE, NUMBER, or INTEGER.

Creating tables with Constraints:


A Constraint is a condition or check applicable to a column or table which ensures
the integrity or validity of data. Constraints are also called Integrity constraints. The
following constraints are commonly used in MySQL.
PRIMARY KEY - Used to create a primary key

UNIQUE - to create a unique key

NOT NULL - to define that column will not accept null values.

CHECK - to define the custom rule or condition.

A table may have multiple UNIQUE constraints but only one PRIMARY KEY is
allowed.
Example:
CREATE TABLE Student
(Code char(3) NOT NULL PRIMARY KEY,
name char(20) NOT NULL,
AdmNo char(5) UNIQUE,
Gender char(1) DEFAULT ‘M’,
Age integer CHECK (Age>=10),
Stream char(1) CHECK Stream IN (‘S’, ‘C’, ‘H’) );
SHOWING TABLES USING MySQL
To see the names of all the tables in the database, At any point of time, we can view
names of all the tables contained in the current database by using SHOW TABLES
statement as shown below:
mysql> SHOW TABLES;
INSERT command:
This command is used to insert new rows into an existing table.
SYNTAX:
INSERT INTO tablename VALUES(value 1, value 2,....);
Here, value 1, value 2 etc. correspond to values of attributes.
Examples:
mysql>INSERT INTO student values(15,‘Harsh’,1234,’M’,15,’S’);
We can insert record with specific column only
mysql>INSERT INTO student( Code, name, gender) values(15,’Harsh’,’M’);

SELECT Command:
With the SELECT command we can retrieve previously inserted rows.
A general form of SELECT is:
SELECT columnnames FROM table_name;
Example: SELECT * FROM Student;
SELECT name, stream FROM Student;
WHERE Clause:
The WHERE clause is used to retrieve data that satisfy the specified conditions.
With WHERE clause the following operators can be used:
• Comparison operators are: < <= = != <> >= >
• Logical operators are: AND OR NOT
• Comparison operator for special value - NULL IS NULL
Examples:- SELECT * FROM Student WHERE Age < 18 ;
SELECT name FROM Student WHERE stream = ”S” AND gender=’M’;
SELECT name, age, stream FROM Student WHERE Stream=’C’ OR Age>12;
Unit 4: EMERGING TRENDS

Artificial Intelligence
Artificial Intelligence (AI) basically refers to the ability of a machine or a computer
program to think and learn. In simple words, field of AI revolves around bringing
out technologies that help build machines that can think, act, and learn like humans.
An Al based program and technology should capable of:

• It should be able to mimic human thought process and behaviour e.g., learning
from
mistakes, catching up with new ideas, learning new things from new exposure,
past experiences (this ability is called heuristics.) etc.
• It should act in a human-like way - intelligent, rational, ethical, i.e. it should
take right decisions in ethical ways.
Applications of AI
• Handwriting Recognition
• Gaming
• Intelligent Robots
• Natural Language Processing etc.
Common examples of Al today are:
• Humanoid Robot - Sophia
• Siri or Alexa - the personal assistant
• Google’s NEST - is a line of smart home products including smart speakers,
smart displays, streaming devices, thermostats, smoke detectors etc.
• Self-Driving cars like Tesla.
• Online games like Alien: Isolation
Machine Learning
• Machine Learning 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.
• It comprises algorithms that use data to learn on their own and make
predictions.
• These algorithms, called models, are first trained and tested using a training
data and testing data, respectively.
• After successive trainings, once these models are able to give results to an
acceptable level of accuracy, they are used to make predictions about new and
unknown data.

Natural Language Processing (NLP)

• NLP is an artificial intelligence technique that lets machines process and


understand language like humans do using computational linguistics
combined with machine learning, deep learning and statistical modelling.
• The predictive typing(Autocomplete) feature of search engine that helps us by
suggesting the next word in the sentence while typing keywords and the spell
checking features are examples of Natural Language Processing (NLP).
• It deals with the interaction between human and computers using human
spoken languages, such as Hindi, English, etc.
Immersive Experiences
• Immersive experiences allow us to visualise, feel and react by stimulating our
senses. It enhances our interaction and involvement, making them more
realistic and engaging.
• Used in driving simulators, flight simulator, video games and so on.
• Immersive experience can be achieved using virtual reality and augmented
reality.

Fig: Driving Simulator


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.
• It is achieved with the help of VR Headsets.
• In order to make the experience of VR more realistic, it promotes other
sensory information like sound, smell, motion, temperature, etc.
• Used in gaming, military training, medical procedures, entertainment etc.

Fig: VR Headset
Augmented reality
• The superimposition of computer generated perceptual information over the
existing physical surroundings is called as Augmented Reality (AR).
• It adds components of the digital world to the physical world, along with the
associated tactile and other sensory requirements, thereby making the
environment interactive and digitally manipulatable.

Virtual component + Reality = Augmented Reality

Robotics
• A robot is basically a machine capable of carrying out one or more tasks
automatically with accuracy and precision.
• A robot is programmable.
• Used for doing repetitive industrial tasks that are boring or stressful for
humans or were labour-intensive.
• Sensors are one of the prime components of a robot.
• Robot can be of many types, such as wheeled robots, legged robots,
manipulators and humanoids.
• Robots that resemble humans are known as humanoids.
• Robots are being used in industries, medical science, bionics, scientific
research, military, etc.
• Some examples are:
o NASA’s Mars Exploration Rover (MER) mission is a robotic space
mission to study about the planet Mars.
o Sophia is a humanoid that uses artificial intelligence, visual data
processing, facial recognition and also imitates human gestures and
facial expressions.
Big data and its characteristics
• Data sets of enormous volume and complexity are called Big Data.
• Such data cannot be processed and analysed using traditional data processing
tools as the data is not only voluminous, but also unstructured like our posts,
instant messages and chats, photographs that we share through various sites,
our tweets, blog articles, news items, opinion polls and their comments,
audio/video chats, etc.
• It also involves various challenges like integration, storage, analysis,
searching, processing, transfer, querying and visualisation of such data.

• Characteristics of Big Data:


o Volume : Enormous size.
o Velocity : Rate at which the data under consideration is being generated
and stored.
o Variety : Data set has varied data, such as structured, semi-structured
and unstructured data. Some examples are text, images, videos, web
pages and so on.
o Veracity : Veracity refers to the trustworthiness of the data. Big data
can be sometimes inconsistent, biased, noisy.
o Value : Big data possess to have hidden patterns and useful knowledge.

Internet of Things (IoT)


• The ‘Internet of Things’ is a network of devices that have an embedded
hardware and software to communicate (connect and exchange data) with
other devices on the same network.
• The term computer network that we commonly use is the network of
computers.
• Such a network consists of a laptop, desktop, server, or a portable device like
tablet, smartphone, smartwatch, etc., connected through wire or wireless.
• We can communicate between these devices using Internet or LAN.
• IoT tends to bring together these devices to work in collaboration and assist
each other in creating an intelligent network of things.
• For example, if a microwave oven, an air conditioner, door lock, CCTV
camera or other such devices are enabled to connect to the Internet, we can
access and remotely control them on-the-go using our smartphone.
Sensors

• 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.
• Sensors are very commonly used for monitoring and observing elements in
real world applications.
• Example: What happens when you hold your mobile vertically or
horizontally?
The display also changes to vertical or horizontal with respect to the way we
hold our mobile. This is possible with the help of two sensors, namely
accelerometer and gyroscope (gyro). The accelerometer sensor in the mobile
phones detects the orientation of the phone. The gyroscope sensors tracks
rotation or twist of your hand and add to the information supplied by the
accelerometer.
Smart Cities

• The challenges like management of resources like land water, waste,


airpollution, health and sanitation, traffic congestions, public safety and
security etc are forcing many city planners around the world to look for
smarter ways to manage them and make cities sustainable and livable.
• The idea of smart city makes use of computer and communication technology
along with IoT, WoT(Web of Things) to manage and distribute resources
efficiently.
• Example:
o The smart building uses sensors to detect earthquake tremors and then
warn nearby buildings so that they can prepare themselves accordingly.
o The smart bridge uses wireless sensors to detect any loose bolt, cable
or crack.
Cloud Computing
• Computer-based services delivered over the Internet or the cloud, which can
be accessed any where using any smart device.
• The services comprise software, hardware (servers), databases, storage, etc.
• These resources are provided by companies called cloud service providers and
usually charge on pay per use basis, like the way we pay for electricity usage.
• Cloud computing offers cost-effective, on-demand resources.
• A user can avail need-based resources from the cloud at a very
reasonable cost.
Cloud Services
• Different computing services delivered through cloud are Infrastructure as a
Service (IaaS), Platform as a Service (PaaS), and Software as a Service
(SaaS).
• Infrastructure as a Service (IaaS): 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.
• Platform as a Service (PaaS): Through this service, a user can install and
execute an application without worrying about the underlying infrastructure
and their setup. That is, PaaS provides a platform or environment to develop,
test, and deliver software applications.
• Software as a Service (SaaS): SaaS provides on-demand access to application
software, usually requiring a licensing or subscription by the user. While using
Google doc, Microsoft Office 365, Drop Box, etc., to edit a document online,
we use SaaS from cloud. A user is not concerned about installation or
configuration of the software application if the required software is accessible.
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.
• The constituent resources are called nodes.
• These different nodes temporarily come together to solve a single large task
and to reach a common goal.
• Grid can be of two types—
o Data grid, used to manage large and distributed data having the required
multi-user access.
o CPU or Processor grid, where processing is moved from one PC to
another as needed or a large task is divided into subtasks, and allotted
to various nodes for parallel processing.
• The Globus toolkit is a software toolkit used for building grids, and it is as
open source.
• It includes software for security, resource management, data management,
communication, fault detection, etc.

Blockchains
• Traditionally, we perform digital transactions by storing data in a centralised
database and the transactions performed are updated one by one on the
database. That is how the ticket booking websites or banks operate. However,
since all the data is stored on a central location, there are chances of data being
hacked or lost.
• The blockchain technology works on the concept of decentralised and shared
database where each computer has a copy of the database.
• A block can be thought as a secured chunk of data or valid transaction.
• Each block has some data called its header, which is visible to every other
node, while only the owner has access to the private data of the block. Such
blocks form a chain called blockchain.
• We can define blockchain as a system that allows a group of connected
computers to maintain a single updated and secure ledger. Each computer or
node that participates in the blockchain receives a full copy of the database.
• It maintains an ‘append only’ open ledger which is updated only after all the
nodes within the network authenticate the transaction. Safety and security of
the transactions are ensured because all the members in the network keep a
copy of the blockchain and so it is not possible for a single member of the
network to make changes or alter data.
• Popular application of blockchains technology is in digital currency.
Worksheet
Unit 1: Introduction to computer system (Level 1)
1 Which of the following is used to hold the running program instructions?
(i) Primary Storage (ii) Virtual Storage
(iii) Internal Storage (iv) Minor Device

2 Who developed python programming language


a. Alan Turing
b. Dennis Richie
c. Guido Van Rossum
d. Tim Berners Lee

3 A …………… is an elementary unit of the memory


4 Identify the input and output devices:
a. barcode reader
b. web cam
c. plotter
d. speaker

5 Expand the following:


i. ALU
ii. CPU

6 CPU has two main components _______ & ______.


a. ALU And Memory Unit
b. CU and ALU
c. Input and Output Unit
d. None of the above

7 Group of 4 bit is called………….


8 What is OS? Write any two examples for OS?
9 Draw the block diagram of components of computer system?
10 Differentiate between RAM and ROM?
Worksheet
Unit 1: Introduction to computer system (Level 2)
1 1 GB is equivalent to
a. 210 bytes
b. 230 bytes
c. 220 bytes
d. None of the above
2 Data entered through input device is temporarily stored in ________.
a. RAM
b. ROM
c. Hard disk
d. All of the above
3 Identify the category(Free and open source/proprietary/Freeware) of
following software:
a. OpenOffice
b. Adobe Photoshop
c. Skype
d. Python
4 Classify the following into system software and application software:
a. Windows
b. spread sheet
c. Banking software
d. Compression software
5 Which utility software helps to protect the computer system from
viruses and prevent the computer system files from being corrupt?
(a) Disk cleanup
(b) Disk defragmenter
(c) Antivirus
(d) All
6 The device capable of recognizing a pre-specified type of mark made
with dark pencil or ink
a. OCR
b. OMR
c. MICR
d. Barcode reader
7 Which technology is used in fifth generation computer?
8 What is the need of cache memory? Where cache memory is placed?
9 What is the need of secondary memory? Write two examples for
secondary memory?
10 Differentiate general purpose software and specific purpose software?
write one example?
Worksheet
Unit 1: Introduction to computer system (Level 3)
1 Recently used data are kept in ___________memory.
a. RAM
b. Hard Disk
c. Cache
d. ROM

2 The device which converts human-understandable data and programs into a


form that computers can understand is
a) Output
b) Monitor
c) Input
d) All of the above

3 A half byte is known as_____.


a. HB b. Hbyte c. Nibble d. Bit
4 Which of the following are not input devices?
(a) Webcam and Microphone
(b) Bar Code Reader and Smart Card Reader
(c) OCR and OMR
(d) Monitor and Printer

5 Which of the following has highest storage?


a.Mega byte b. Giga byte c.Tera byte d. Kilo byte
6 Expand FOSS?
7 Identify the device used in banks to read the string of characters that appears
at the bottom of the check.
8 List out any two security concerns associated with data?
9 Suppose you are asked to develop a software that performs all the operations
in the billing section in the supermarket. What type of software you will
chose? Why?
10 Differentiate freeware and proprietary software? Write one eg for each?
Answers for Worksheet (Level 1)

1 i
2 c
3 bit
4 a. barcode reader-input
b. web cam-input
c. plotter-output
d. speaker-output
5 ALU: arithmetic and logic unit
CPU-Central processing unit
6 b
7 Nibble
8 OS stands for operating system. It acts as an interface between user and the
computer hardware.
Eg: Windows, Linux

10 RAM ROM
Random access memory Read only memory
Volatile memory Non-Volatile memory
It is used to store data temporarily Startup program (boot loader) is
while the computer is working stored in a ROM
Temporary storage Permanent storage
Answers for Worksheet (Level 2)

1 b
2 a
3 a. Free and open source
b. Proprietary
c. Freeware
d. Free and open source

4 a. System software
b. Application software
c. Application software
d. System software

5 c
6 b
7 Artificial Intelligence
8 RAM is not as fast as a computer processor. This makes the CPU to slow
down the processing. To make the processing fast, a high-speed memory
is used. That memory is cache memory. It is placed between CPU and
RAM.

9 Primary memory has limited storage capacity and that is not enough to
store the data. Thus, a computer system needs another memory to store data
permanently and with large capacity. For that purpose, secondary memory
is used.
Eg: hard disk, CD

10 General purpose software: These are ready to use software for daily use
purpose. Eg: spread sheet
Specific purpose software: These are custom or tailor-made application
software, that are developed to meet the requirements of a specific
organisation or an individual
Eg: Banking software
Answers for Worksheet (Level 3)

1. c
2 c
3 c
4 d
5 c
6 Free and open-source software
7 MICR
8 ➢ Deletion by some unauthorised person or software
o This can be avoided by using passwords or encrypting the
files
➢ Unwanted recovery of data by unauthorised user/software
o While discarding old, broken or malfunctioning storage
devices, make sure that the data is deleted

9 Customized software (Specific purpose application software)


Reason: These are custom or tailor-made application software, that are
developed to meet the requirements of a specific organisation or an
individual.

10 Freeware:-software is freely available for use but source code may not be
available.
Eg: Skype
proprietary software: - When software to be used has to be purchased
from the vendor who has the copyright of the software is called
proprietary software
Eg: Microsoft Windows
PYTHON FUNDAMENTALS
ASSIGNMENTS - L1
1. What are literals in Python? How many types of literals are there in Python?
2. How string literal is represented in Python?
3. What is a statement and expression?
4. What is the role of indention in Python?
5. What are variables?
6. What is dynamic typing in python?
7. Differentiate keyword and identifier.
8. What are tokens in Python?
9. What will be the output of following?
a=20
b=33
print(a+b)
10. What is wrong with following code fragment?
a=20
c=a+b
print(c)

11. What is wrong with following code fragment?


name="shreya"
classs=4
print(name+classs)
12. What will be the output of following python code?a,b=3,4
a,b,c=b,a+3,b-1
print(a,b,c)
13. What will be the output of following python code?
a,b=3,4
c,a=b*4,a+4
print(a,b,c)
14. What will be the output of following python code/code fragment?
a) print(print("vishal"))
b) print("vishal")print("indian")
c) print("vishal",end=" ")print("indian")
d) a=int(input("enter first no"))
b=int(input("enter second no"))
a,b=b,a
print("a=",a)
print("b=",b)
15. Write a Python program to find out the simple interest.
16. Write a Python program to find out the compound interest.
17. Write a Python program to find out the area of the triangle.
18. Write a Python program to find out the circumference of circle.
19. Write a Python program to find out the area of the circle.
20. Write a Python program to convert Celsius to Fahrenheit.
21. Write a Python program to reverse a three digit number.
22. Which of the following is an invalid statement?
a) abc = 1,000,000
b) a b c = 1000 2000 3000
c) a,b,c = 1000, 2000, 3000
d) a_b_c = 1,000,000
23. How comments are given in Python program?
DATA HANDLING
WORKSHEET-L2

1. Write the corresponding Python assignment statements:


a) Assign 10 to variable length and 20 to variable breadth.
b) Assign the average of values of variables length and breadth to a variable
sum.
c) Assign a list containing strings ‘Paper’, ‘Gel Pen’, and ‘Eraser’ to a
variable stationery.
d) Assign the strings ‘Mohandas’, ‘Karamchand’, and ‘Gandhi’ to
variables first, middle and last.
e) Assign the concatenated value of string variables first, middle and last
to variable fullname. Make sure to incorporate blank spaces
appropriately between different parts of names.

2. Which data type will be used to represent the following data values and
why?
a) Number of months in a year
b) Resident of Delhi or not
c) Mobile number
d) Pocket money
e) Volume of a sphere
f) Perimeter of a square
g) Name of the student
h) Address of the student

3. Give the output of the following when num1 = 4, num2 = 3, num3= 2


a) num1 += num2 + num3
b) print (num1)
c) num1 = num1 ** (num2 + num3)
d) print (num1)
e) num1 **= num2 + c
f) num1 = '5' + '5'
g) print(num1)
h) print(4.00/(2.0+2.0))
i) num1 = 2+9*((3*12)-8)/10
j) print(num1)
k) num1 = float(10)
l) print (num1)
m) num1 = int('3.14')
n) print (num1)
o) print(10 != 9 and 20 >= 20)
p) print(5 % 10 + 10 < 50 and 29 <= 29)

4. Categorise the following as syntax error, logical error or runtime error:

a) 25 / 0
b) num1 = 25; num2 = 0;
num1/num2
5. Write a Python program to calculate the amount payable if money has
been lent on simple interest. Principal or money lent = P, Rate = R% per
annum and Time = T years. Then Simple Interest (SI) = (P x R x T)/
100.
Amount payable = Principal + SI.
P, R and T are given as input to the program.

6. Write a program to repeat the string ‘‘GOOD MORNING” n times. Here


n is an integer entered by the user.
7. Write a program to find the average of 3 numbers.
8. Write a program that asks the user to enter one's name and age. Print out
a message addressed to the user that tells the user the year in which
he/she will turn 100 years old.
9. What is the difference between else and elif construct of ifstatement?
10. Find the output of the following program segments:

a) for i in range(20,30,2):
print(i)
b) country = 'INDIA'
for i in country:print (i)
c) i = 0; sum = 0
while i < 9:
if i % 4 == 0:
sum = sum + ii = i + 2
print (sum)
DATA HANDLING
WORKSHEET L3
1. How many parts are there for any complex number?
2. What is data type in python? Is there any importance of data type?
3. Differentiate mutable and immutable data types? List them.
4. List the augmented assignment operator supported by python.
5. What is the output of the
following code :print(9//2)
6. Can you identify the data types of following values, if yes write their data
type.[4,5,2] , {2,34,5} , (4,23,55) , {33,4,4) , 4, 5.2, 8j , ’1’ , ”1” , 4+0j
7. Is Boolean is a subtype of integers?
8. Write the names of python built in data types.
9. What will be the output of the following
codeprint(5/2)
print(5//2)
10. What will the output of following
codesprint (8*2 - 2*4)
print (3 + 18/9 -
3**2+1) print ((4 +
24)/8 - (2**3+3))
11. What will the output of following code
snippetx = 5
y = -1
print ((x+y)*1./x)
print
(3*x )
print (x )
12. Write the python programs for following formulas

13. Write the equivalent Boolean value


a. 7+3*4<3*3+4
b. 4+3*4==3*3+7
14. What is the problem with following code fragments
a. x="m
arks"
+100
print(
x)
b. a=5
b=a+500
a="marks"
c=a/2
print(c)
15. What will be the output of following code
fragmentsa,b=5,6
a,b,c=10,b,a
a,b,c=c/2,a
+4,b*62
print(a)
print(b)
print(c)
16. What will be the output of following python
statementsprint(type(100))
print(type(100/0))
print(type('0'))
print(type(5.2))
17. Python Program to Swap Two Variables
18. Python Program to Convert Kilometers to Miles
19. Python Program to Convert Celsius To Fahrenheit
20. Find out the compound interest of entered amount, rate and time through
python program.
PYTHON FUNDAMENTALS
WORKSHEET - L1 Solutions
1. What are literals in Python? How many types of literals are there in Python?
Literals in Python is defined as the raw data assigned to variables or constants while
programming. We mainly have five types of literals which includes string literals,
numeric literals, boolean literals, literal collections and a special literal None

2. How string literal is represented in Python?


String literals can be enclosed by either double or single quotes

3. What is a statement and expression?


A Statement is a action or a command that does something.
A Expression is a combination of values, operators and literals which yields something

4. What is the role of indention in Python?


Indentation refers to the spaces at the beginning of a code line.

5. What are variables?


A Python variable is a reserved memory location to store values.

6. What is dynamic typing in python?


Dynamic typing means that the type of the variable is determined only during runtime

7. Differentiate keyword and identifier.


In general, keywords are the predefined and specific reserved words, which hold
special meaning. On the other hand, an identifier is a different term or name given to a
variable, label of class in the program or function.

8. What are tokens in Python?


A token is the smallest individual unit in a python program. All statements and
instructions in a program are built with tokens.
9. What will be the output of following?
a=20
b=33
print(a+b)
Output: 53

10. What is wrong with following code fragment?


a=20
c=a+b
print(c)
Sol: b is not defined

11. What is wrong with following code fragment?


name="shreya"
classs=4
print(name+classs)
Sol: String cannot be added with integer
12. What will be the output of following python code?a,b=3,4
a,b,c=b,a+3,b-1
print(a,b,c)
Output: Error

13. What will be the output of following python code?


a,b=3,4
c,a=b*4,a+4
print(a,b,c)
Output: 7 4 16
14. What will be the output of following python code/code fragment?
a) print(print("vishal"))
Output:
vishal
None
b) print("vishal")
print("indian")
Output:
vishal
indian
c) print("vishal",end=" ")
print("indian")
Output:
vishal indian
d) a=int(input("enter first no"))
b=int(input("enter second no"))
a,b=b,a
print("a=",a)
print("b=",b)
Output:
enter first no 7
enter second no 10
a=10
b=7
15. Write a Python program to find out the simple interest.
p=int(input("Enter Principal amount"))
r=int(input("Enter rate"))
t=int(input("Enter time"))
SI=(p*r*t)/100
print("Simple Interest is : ", SI)
16. Write a Python program to find out the compound interest.
p=int(input("Enter Principal amount"))
r=int(input("Enter rate"))
t=int(input("Enter time"))
CI=(p*(1+r/100)**t)-p
print("Compound Interest is : ", CI)

17. Write a Python program to find out the area of the triangle.
# Three sides of the triangle is a, b and c:
a = float(input('Enter first side: '))
b = float(input('Enter second side: '))
c = float(input('Enter third side: '))
# calculate the semi-perimeter.
s = (a + b + c) / 2.
# calculate the area.
area = (s*(s-a)*(s-b)*(s-c)) ** 0.5.
print(“area= ”,area)

18. Write a Python program to find out the circumference of circle.


r=int(input("Enter radius of circle"))
c=2*(22/7)*r
print("Circumference is : ", c)

19. Write a Python program to find out the area of the circle.
r=int(input("Enter radius of circle"))
a=(22/7)*r*r
print("Area is : ", a)

20. Write a Python program to convert Celsius to Fahrenheit.


Celsius=40
fahrenheit = (celsius * 1.8) + 32
# printing the result
print(Temperature in Fahrenheit is',fahrenheit))

21. Write a Python program to reverse a three digit number.


num = 1234
reversed_num = 0
while num != 0:
digit = num % 10
reversed_num = reversed_num * 10 + digit
num //= 10
print("Reversed Number: " + reversed_num)

22. Which of the following is an invalid statement?


a) abc = 1,000,000 #invalid
b) a b c = 1000 2000 3000 #invalid
c) a,b,c = 1000, 2000, 3000 #valid
d) a_b_c = 1,000,000 #invalid

23. How comments are given in Python program?


Comments in Python begin with a hash mark ( # )
L2 WORKSHEET

1)SOLUTION:
a)length,breadth=10,20
b)sum=(length+breadth)/2
c)stationary=[‘Paper’,’Gel pen’ ,’Eraser’]
d)first,middle,last=”Mohandas”, “Karamchand”, “Gandhi”
e)fullname = first + “ “ + middle+ “ “ + last

2) Solution
a) Number of months in a year = int as it can’t be string or float
b) Resident of Delhi or not = boolean as it is a condition like ‘either or’
c) Mobile number = int as it can’t be float or string
d) Pocket money = float as it can be a decimal value i.e. 10.50
e) Volume of a sphere = float as volume of sphere = 4/3( * r3), value of = 3.14 and r value can
be decimal i.e. 4.5 unit
f) Perimeter of a square = float as perimeter = 4 * length of side, the length of side can be a
decimal value
g) Name of the student = string as name is combinations of characters
h) Address of the student = string as address is the concatenated form of different strings.

3) Solution
a. 9
Explanation:
num1 = num1 + 3 + 2 = 4 + 3 + 2 = 9
Therefore, print(num1) will give the output 9.
b. 1024
Explanation:
num1 = 4 ** (3 + 2) = 4 ** 5 = 1024
Therefore, print(num1) will give the output 1024
c. 1024
Explanation:
num1 **= (3 + 2)
num1 = num1 ** 5
num1 = 4 ** 5
num1 = 1024
Therefore, the output will be 1024.
d. 55
Explanation:
Everything written inside ‘’ considered as string and in case of string ‘+’ is used for string
concatenation.
e. 1.0
Explanation:
The numbers written in the statement are in float data type therefore, the output will be also in
float data type.
print(4.00/(2.0 + 2.0))
print(4.0/4.0)
f. 27.2
Explanation:
num1 = 2 + 9 * (36 - 8) /10
num1 = 2 + 9 * 28/10
num1 = 2 + 252/10
num1 = 2 + 25.2
num1 = 27.2
Therefore, the output will be 27.2.
g. 3
Explanation:
num1 = 6 // 2 #When floor division is used, return value will be int data type num1 = 3
Therefore, the output will be 3
h. 10.0
Explanation:
float(10) will convert integer value to float value and therefore, the output will be 10.0.
i. Runtime error as we cannot pass string representation of float to an int function.
j. False
Explanation:
As Python compares string character to character and when different characters are found then
their Unicode value is compared. The character with lower Unicode value is considered to be
smaller. Here, 'y' has Unicode 121 and 'Y' has 89. Therefore, the output will be 'False'.

4) Solution:
a) 25/0 : Runtime Error (ZeroDivisionError)
b) num1=25; num2=0; num1/num2 : Runtime Error(ZeroDivisionError)

5)p=float(input(‘Enter Principal:’))
r= float(input(‘Enter Rate of interest:’))
t=float(input(‘Enter Time(years):’))
simple_interst=(p*r*t)/100
amount_payable=p+simple_interest
print(“amount to be paid:”,amount_payable)

6) str = "GOOD MORNING "


n = int(input("Ask user for the real value of n: "))
if n>0:
print(str * n)

7) Program:
a = int (input(" Please Enter the First Number: "))
b = int (input(" Please Enter the second number: "))
c = int (input(" Please Enter the third number: "))
average=(a+b+c)/3.
print("The average of three numbers is ", average)
Output:
Please Enter the First Number: 3
Please Enter the second number: 5
Please Enter the third number: 1
The average of three numbers is 3

8) name = input("Enter your name: ")


current_age = int(input("Enter your age: "))
hundredth_year = 2020 + (100 - current_age)
print(f'{name} will become 100 years old in the year {hundredth_year}.')

9) Else’ is used along with ‘if’ to define the alternative path if the condition mentioned in
the ‘if’ statement is incorrect. This means that only one statement can be evaluated using
if else statement.

If more than one statements need to be evaluated, ‘elif’ construct is used. There is no limit
on the number of ‘elif’ construct which should be used in a statement. However, the
conditions mentioned in each ‘elif’ construct should be mutually exclusive i.e. if one of
the conditions in elif is correct, it stops and doesn’t evaluate the rest.

Else assesses a solitary articulation before shutting the loop. Elif permits you to assess
various explanations before shutting the loop.
10)(a)
20
22
24
26
28
(b)
I
N
D
I
A
(c)
12
DATA HANDLING
WORKSHEET L3- Solutions

1. How many parts are there for any complex number?


Each complex number consist of one real part and one imaginary part

2. What is data type in python? Is there any importance of data type?


Data types are the classification or categorization of data items. It represents
the kind of value that tells what operations can be performed on a particular data.

3. Differentiate mutable and immutable data types? List them.


The major difference between mutable and immutable objects in Python is
that mutable objects can be modified or changed after their creation but the
immutable objects can not be modified after their creation.
Mutable: List, Dictionary, Sets
Immutable: String, Tuple

4. List the augmented assignment operator supported by python.


=+ ,=- ,=* ,=/ ,=%, =**, =//

5. What is the output of the


following code :print(9//2)
Output: 4

6. Can you identify the data types of following values, if yes write their data
type.[4,5,2]- List , {2,34,5}-Set , (4,23,55)-Tuple , {33,4,4)-invalid , 4-
Int, 5.2-float, 8j-complex , ’1’-string , ”1”-string , 4+0j-complex

7. Is Boolean is a subtype of integers?


No, it is a separate category of Literals that stores only True or False.

8. Write the names of python built in data types.


String, Int, Float, Boolean, None
9. What will be the output of the following
codeprint(5/2)
print(5//2)
Output:
2.5
2

10. What will the output of following


codesprint (8*2 - 2*4)
print (3 + 18/9 -
3**2+1) print ((4 +
24)/8*(2**3+3))
Output:
8
-3.0
38.5

11. What will the output of following code


snippetx = 5
y = -1
print ((x+y)*1/x)
print (3*x )
print (x)
Output:
0.8
15
5
12. Write the python programs for following formulas

Cylinder V=b*h
Volume Cone V=b*h/3
sphere V=(4/3)*(22/7)*r**3
Circumference Circle C=2*22/7*r
Square A=a*a
rectangle A=l*b
Area Triangle A=(1/2)*b*h
Trapezium A=(b1+b2)*h/2
Circle A=(22/7)*r*r
Square S=6*a**2
Cylinder S=2*(22/7)*r*h
Surface area
Cone S=(22/7)*r*l
Sphere S=4*(22/7)*r*r
Square P=4*a
Perimeter
Rectangle P=2*(l+b)
13. Write the equivalent Boolean value
a. 7+3*4<3*3+4 #False
b. 4+3*4==3*3+7 #True
14. What is the problem with following code fragments
a. x="marks"+100
print(x)
Sol: String cannot be added with integer
b. a=5
b=a+500
a="mark
s"c=a/2
print(c)
Sol: Srtring cannot be divided

15. What will be the output of following code


fragmentsa,b=5,6
a,b,c=10,b,a
a,b,c=c/2,a+4,b*62
print(a)
print(b)
print(c)
Output:
2.5
14
372

16. What will be the output of following python


statementsprint(type(100))
print(type(100/0))
print(type('0'))
print(type(5.2))
Output:
Int
Error
Str
Float
17. Python Program to Swap Two Variables
a=10
b=30
a,b=b,a
print("a=",a)
print("b=",b)

18. Python Program to Convert Kilometers to Miles


# Taking kilometers input from the user
kilometers = float(input("Enter value in kilometers: "))
# conversion factor
conv_fac = 0.621371
# calculate miles
miles = kilometers * conv_fac
print(“distance in miles”, miles)

19. Python Program to Convert Celsius To Fahrenheit


Celsius=40
fahrenheit = (celsius * 1.8) + 32
# printing the result
print(Temperature in Fahrenheit is',fahrenheit))

20. Find out the compound interest of entered amount, rate and time through
python program.
p=int(input("Enter Principal amount"))
r=int(input("Enter rate"))
t=int(input("Enter time"))
CI=(p*(1+r/100)**t)-p
print("Compound Interest is : ", CI)
Worksheet
For loop (Level 1)

1. How many times will the value “Best” be printed, on executing the following codes
(a) and (b)?
(a) for I in range(0, 2):
print(“Best”)

(b) for I in range(1, 5):


if I%2==0:
print(“Best”)
2. Write a Python program to display the first 10 numbers and their squares
3. What will be the value of x, after executing the for loop?
x=3
for i in range(0, x):
x=i+1
(a) 2 (c) 4
(b) 3 (d) 5
4. Complete the following statements, such that the first 5 multiples of 10 are printed.
for val in range ( 0 , 51, ___ ):
print (val)
5. Predict the output:
x, y = 3, 15
for i in range(2,8):
x=x+2
y=y+2
print(x," : ",y)
print(x, "," , y)
For loop (Level 2)

1. How many times will the value “Best” be printed, on executing the following codes
(a) and (b)?
(a) for I in range(25, 5, -10):
print(“Best”)

(b) for I in range(10, 50, 5):


if I%2==0:
print(“Best”)
2. Write a Python program to display Fibonacci series upto N numbers
3. What will be the value of x, after executing the for loop?
x=3
for i in range(x, x+2):
x=x+i
8 (c) 10
9 (d) 5
4. Complete the following statements, such that the first 5 multiples of 3 are printed.
for val in range ( 3, ___, ___ ):
print (val)

5. Predict the output:


x, y = 3, 15
for i in range(2,8,3):
x=x+y
x=x+2
y=y+2
print(x," : ",y)
print(x, "," , y)
For loop (Level 3)

1. Write a for loop program to obtain the series like


10 20 30……301
2. Write a program to print the factorial series like
5!=5*4*2*1=120
3. Predict the output of :
3.1 for i in “goodmorning”:
print(i,”@”)

3.2 for i in “hello”:


print(i,end=”- ”)

3.3 for i in [1,2,3]:


print(i)
print(“i”)

4. What do you mean by continue and break keyworks

5. Predict the output:

For x in range(2):
For y in range(2):
print(x,y)
Worksheet
List (Level 1)

1. What is the output of print list[0] if list = [ 'abcd', 786 , 2.23, 'john', 70.2 ]?
2. What is the output of print tinylist * 2 if tinylist = [123, 'john']?
3. What is the output of print list[2:] if list = [ 'abcd', 786 , 2.23, 'john', 70.2 ]?
4. What do you understand by list ?
5. What is a nested list ?

Worksheet
List (Level 2)
1. Write a short note on indexing in a list
2. Predict the output based on the list, cod = [98, 45, 62, 14, 1007]
a. print(len(cod))
b. print(cod * 2)
c. print(1007 in cod)
d. print(cod[:2]+cod[2:])
e. cod. append(1010)
print(cod)
f. print(cod. pop(1))
3. The record of a student is stored as a list in the following format(Name, Roll.No,
Marks in 3 subjects, Percentage)
RecordList = [‘Komal’, ‘A-19’, [71, 86, 72], 76.3]
Write Python statements to retrieve the following information from the list, RecordList
a. Name of the student
b. Mark in the first subject
c. Percentage obtained
d. Change the name of the Student from “Komal” to “Kunal”
4. Write a program to accept elements of a list from the user. Multiply all the elements
of the list with 7 and display the elements.
5. Consider the following list, p = [‘v’, ‘a’, ‘c’, ‘c’, ‘i’, ‘n’, ‘a’, ‘t’, ‘i’, ‘o’, ‘n’).
Write a program to display each character along with its positive index and negative
index
Worksheet
List (Level 3)

6. Differentiate between list and dictionary with examples

7. Predict the output based on the list, cod = [98, 45, 62, 14, 1007]
a. print(len(cod+cod))
b. print(cod[2:4] * 3)
c. print(‘14’ not in cod)
d. print(50-5 in cod)
e. print(cod[::-1]+cod[0:1])
f. cod. extend([10, 11])
print(cod)
g. cod. insert(2, 3)
print(cod)
h. print(cod. pop())

8. The record of a student is stored as a list in the following format(Name, Roll.No,


Marks in 3 subjects, Percentage)
RecordList = [‘Komal’, ‘A-19’, [71, 86, 72], 76.3]
Write Python statements to retrieve the following information from the list, RecordList
a. Percentage of the student
b. Total of all the marks
c. Maximum mark obtained
d. Copy only the marks to a new list, m1

9. Write a program to accept elements of a list from the user. Multiply elements of the
list with 7, if an element is a multiple of 7 otherwise multiply each element with 4.
After processing, display the elements.

10.Consider the following list, p = [‘v’, ‘a’, ‘c’, ‘c’, ‘i’, ‘n’, ‘a’, ‘t’, ‘i’, ‘o’, ‘n’). Write a
program to display each character along with its frequency of occurrence, and also
excluding duplicates from displaying multiple times.
Worksheet
Dictionary (Level 1)
1. Predict the output of

i. dict = {(3,4,8):4,(5,6,9):3}

ii. print('output:',dict[5,6,9])

2. What is python dictionary

3. What are the properties of dictionary

4. What is dict() in dictionary

5. Write the code to print all the keys of the dictionary


Worksheet
Dictionary (Level 2)

1. Write a python statement to add a new key, 11 and corresponding value “Eleven”
to the dictionary, “ODD “
2. Consider the following dictionary cpwords:
cpwords = {"Soil": "Pollution", "Traffic": "Jam", "Air": "Purifier", "Play": "Ground"}
Find the output of the following statements
a. print(cpwords[‘Soil’])
b. print(cpwords. keys())
c. print(cpwords. values())
d. cpwords. update({"Play": "Station"})
print(cpwords)
e. del cpwords["Traffic"]
print(cpwords)
f. cpwords. update({"Water" : "Conservation"})
print(cpwords)

3. Write Python statements for performing the following on a dictionary, “PTM”


a. To check whether the value “s1” is existing as the dictionary’s keys
b. To remove the key ‘s3’ and its corresponding values from the dictionary
c. To find the number of elements in a dictionary
d. To change the value corresponding to “s5” to 99
e. To find the minimum value among the keys of the dictionary

4. Write a Python program to accept names of 5 students and their corresponding


marks, and adds it to a dictionary named Stu_mark.

5. Write a Python program that can accept a month’s number( from 1 to 12) and
display the number of days in the given month, based on an existing dictionary
month, which has number of the month as keys and the number of days as values.
Worksheet
Dictionary (Level 3)

6. Write a python statement, to delete the item from the dictionary corresponding to
the key 9 of the following dictionary,
ODD = {1:'One',3:'Three',5:'Five',7:'Seven',9:'Nine'}

7. Consider the following dictionary cpwords:


cpwords = {"Soil": "Pollution", "Traffic": "Jam", "Air": "Purifier", "Play": "Ground"}
Find the output of the following statements
a. print(cpwords. get("Air"))
b. print(“Play” in cpwords. keys())
c. print(“ground” not in cpwords. values())
d. cpwords. update({"play": "Station"})
print(cpwords)
e. del cpwords["Jam"]

8. Write Python statements for performing the following on a dictionary, “PTM”


a. To check whether the value “s1” is existing as the dictionary’s values
b. To remove the value 93 from the dictionary
c. To concatenate dictionary, d2={“s5” : 100, “s9”: 97} with PTM
d. To find the minimum value among the values of the dictionary
e. To add a key “s8” with value 74, if the key already exists then it should only
update the value.

9. Write a Python program to accept names of 5 students and their corresponding


marks, and adds it to a dictionary named Stu_mark. Input a student name and
display his/ her corresponding mark.
10.Write a Python program that can accept a month’s name and display the number
of days in the given month, based on an existing dictionary month, which has month
name as keys and the number of days as values.
Worksheet – Answers
For loop - Level 1
1. a. Best will be printed 2 times, b. Best will be printed 4 times
2. for i in range(1, 11, 1):
print(“Number=”, i, “Square of it=”, i**2)
3. b–3
4. 10
5. 5 : 17
7 : 19
9 : 21
11 : 23
13 : 25
15 : 27
For loop – Level 2
6. a. Best will be printed 2 times, b. Best will be printed 8 times

7. a, b = 0,1
n = int(input(“Enter a number”))
print(a, “ “, b, end=” “)
for i in range(1, n):
c = a+b
print(c, end=” “)
a=b
b=c
8. c – 10

9. 16, 17 or 18(first blank), 3(second blank)

10.20 : 17
39 : 19
39 , 19
For loop – Level 3

1. Write a for loop program to obtain the series like


10 20 30……301
Ans: for i in range(10,301,10):
print(i)
2. Write a program to print the factorial series like
5!=5*4*2*1=120
Ans: a=int(input(“enter the no from user”)
fact1=1
for i in range(1,a+1):
fact1=fact1*i
3. Predict the output of :
3.1 for i in “good”:
print(i,”@”)
Output: g @
o@
o@
d@
3.2 for i in “hello”:
print(i,end=”- ”)
Output: h-e-l-l-o
3.3 for i in [1,2,3]:
print(i)
print(“i”)
Output: 1
i
2
i
3
i
4. What do you mean by continue and break keyworks
The break statement terminates the loop containing it. Control of the program flows to
the statement immediately after the body of the loop.
The continue statement is used to skip the rest of the code inside a loop for the current
iteration only. Loop does not terminate but continues on with the next iteration.
5. Predict the output:
for x in range(2):
for y in range(2):
print(x,y)
Ans: 0 0
01
02
10
1 1
12

List – Level 1
1. What is the output of print list[0] if list = [ 'abcd', 786 , 2.23, 'john', 70.2 ]?
Ans: abcd
2. What is the output of print tinylist * 2 if tinylist = [123, 'john']?
Ans: [123,’john’,123,’john’]
3. What is the output of print list[2:] if list = [ 'abcd', 786 , 2.23, 'john', 70.2 ]?
Ans: [2.23,’john’,70.2]
4. What do you mean by list
Ans: A list is the data structure which is mutable and ordered sequence
of elements
5. What do you mean by nested list
Ans: A list inside another the list is known as nested list
List – Level 2
1. Each element in list is accessed using value called index.
• The first index value is 0, the second index is 1 and so on.
• Elements in the list are assigned index values in increasing order sterling from 0.
• To access an element, use square brackets with the index [] value of that element.
• We may also use negative index value to access elements starting from the last
element in the list, having index value -0.
Eg: L=[1, 2, 3, 4, 5]
print(L[0]) will display 1 and print(L[-1]) will display 5

2.
a. 5
b. [98, 45, 62, 14, 1007, 98, 45, 62, 14, 1007]
c. True
d. [98, 45, 62, 14, 1007]
e. [98, 45, 62, 14, 1007, 1010]
f. 45

3.
a. RecordList[0]
b. RecordList[2][0]
c. RecordList[-1]
d. RecordList[0]=”Kunal”

4. num = eval(input(“Enter a list of numbers:”))


for i in range(len(num)):
num[i] = num[i] * 7
print(“List after processing”, num)

5. pos_index = 0
neg_index = -1
for val in p:
print(val, “Positive index=”, pos_index, “Negative index=”, neg_index)
pos_index +=1
neg_index -=1
List – Level 3
6. List vs Dictionary
• Lists are mutable ordered sequences of values while Dictionaries are mutable
unordered collection with items in the form of key-value pairs.
• List value can be accessed with indices, whereas dictionary values are accessible
with the keys.
Eg: L=[1, 2, 3, 4, 5]
D = {1:’one’, 2:’two’, 3:’three’}
7.
a. 10
b. [62, 14, 62, 14, 62, 14]
c. True
d. True
e. [1007, 14, 62, 45, 98, 98]
f. [98, 45, 62, 14, 1007, 10, 11]
g. [98, 45, 3, 62, 14, 1007, 10, 11]
h. 11

8.
a. RecordList[3] (or) RecordList[-1]
b. Sum(RecordList[2])
c. max(RecordList[2])
d. m1=RecordList[2]

9. num = eval(input(“Enter a list of numbers:”))


for i in range(len(num)):
if num[i]%7==0:
num[i] = num[i] * 7
else:
num[i] = num[i] * 4
print(“List after processing”, num)
10. k=[]
for val in p:
if val not in k:
c = p. count(val)
print(val, “occurs”, c, “times”)
k. append(val)
Dictionary Level 1:
1. Predict the output of
dict = {(3,4,8):4,(5,6,9):3}
print('output:',dict[5,6,9])
Ans: 3
2. What is python dictionary
Ans: dictionary consists of a collection of key-value pairs. Each key-value pair
maps the key to its associated value. Dictionary is listed in curly brackets, inside
these curly brackets, keys and values are declared. Each key is separated from its
value by a colon (:), while commas separating each element.
3. What are the properties of dictionary
Ans: Dictionaries hold the data as key-value pairs. For each key, we have a value
that makes the dictionaries very easy to access.
Dictionaries are unordered and their data elements are not accessible in a defined
order
4. What is dict() in dictionary
Ans: The dict() is a constructor to create a dictionary. It does not return anything.
5. Write the code to print all the keys of the dictionary
Ans: To get all keys of the Python dictionary inbuilt keys() method is used.

Dictionary – Level 2
1. ODD[11] = “Eleven”
2.
a. Pollution
b. dict_keys["Soil", "Traffic", "Air", "Play"]
c. dict_values["Pollution", "Jam", "Purifier", "Ground"]
d. {"Soil": "Pollution", "Air": "Purifier", "Play": "Ground"}
e. {"Soil": "Pollution", "Traffic": "Jam", "Air": "Purifier", "Play": "Station"}
f. {"Soil": "Pollution", "Air": "Purifier", "Play": "Ground", "Water":
"Conservation"}
3.
a. ‘s1’ in PTM
b. PTM. clear()
c. len(PTM)
d. PTM[‘s5’]=99
e. min(PTM)
4. Stu_mark={}
for i in range(5):
name = input(“Enter the name of the student”)
mark = int(input(“Enter the mark obtained”))
Stu_mark[name] = mark
print(Stu_mark)
5.
month={1: 31, 2: 28, 3: 31, 4: 30, 5: 31, 6:30, 7: 31, 8: 31, 9: 30, 10: 30, 11:30,
12: 31}
mon = int(input(“Enter the number of the month”))
if mon in month:
d = month[m1]
print(mon, “has”, d, “days”)
else:
print(“Enter a valid month name”)

Dictionary – Level 3
6. del ODD[9]
7.
a. Purifier
b. True
c. True
d. {"Soil": "Pollution", "Air": "Purifier", "Play": "Ground", "play": "Station" }
e. KeyError
8.
a. ‘s1’ in PTM. values()
b. for key in PTM:
if PTM[key]==93:
del PTM[key]
c. PTM. update(d2)
d. min(PTM. values())
e. PTM. update({‘s8’: 74})
9. Stu_mark={}
for i in range(5):
name = input(“Enter the name of the student”)
mark = int(input(“Enter the mark obtained”))
Stu_mark[name] = mark
Name1 = input(“Enter a name for searching”)
if Name1 in Stu_marks:
print(Stu_marks[Name1])
else:
print(“No such student exists..”)
10.
month={‘january’: 31, ‘february’: 28, ‘march’:31, ‘april’: 30, ‘may’: 31, ‘june’:30,
‘july’: 31, ‘august’: 31, ‘september’: 30, ‘october’: 30, ‘november”:30,
‘december’: 31}
mon = input(“Enter the name of a month”)
m1 = mon. lower()
if mon in month:
d = month[m1]
print(mon, “has”, d, “days”)
else:
print(“Enter a valid month name”)
UNIT- 3 - Database concepts and the Structured Query Language
WORKSHEET
L1 QUESTIONS
1. What is the full form of DBMS?
a) Data of Binary Management System
b) Database Management System
c) Database Management Service
d) Data Backup Management System

2. What is a database?
a) Organized collection of information that cannot be accessed, updated, and
managed
b) Collection of data or information without organizing
c) Organized collection of data or information that can be accessed, updated,
and managed
d) Organized collection of data that cannot be updated

3. What is a DBMS?
4. What is a RDBMS?
5. What is a Relation?
6. What is Domain?
7. What is a Tuple?
8. What is an Attribute?
9. What is Degree?
10.What is Cardinality?
11.What is a Primary Key?
12.What is a Candidate Key?
13.What is a Alternate Key?
14.Write the command to create database.
15.Write command to open database.
16.Write a command to display all details of table EMP.
L2 QUESTIONS

1. What is Data integrity?

2. In which of the following formats data is stored in the database management


system?
a) Image
b) Text
c) Table
d) Graph

3. Which of the following is not an example of DBMS?


a) MySQL
b) Microsoft Acess
c) IBM DB2
d) Google

4. What does an RDBMS consist of?


a) Collection of Records
b) Collection of Keys
c) Collection of Tables
d) Collection of Fields

5. What is Data Inconsistency?

6. What will the degree and cardinality of given table.


Table: Student
Rollno Name Class
12 Arya 11
32 Karthik 11
14 Bella 11
11 Mercy 11

7. Consider the table EMP with attributes(Empno, Ename, DName, Job, DOJ,
Location).
Write a command to insert values {1254, Ramesh, HR, Manager, 12-10-2010,
Chennai} into employee table .
8. Consider the table EMP with attributes(Empno, Ename, DName, Job, DOJ,
Location).
Write a command to display name of employee with their job type.

9. Consider the table EMP with attributes(Empno, Ename, DName, Job, DOJ,
Location). Write a command to display all details of table EMP whose JOB
type is CLERK.

10. Write a command to display name of employees whose location is CHICAGO.


L3 QUESTIONS
1. The logical design, and the snapshot of the data at a given instant in time is
known as?
a) Instance & Relation
b) Relation & Schema
c) Domain & Schema
d) Schema & Instance

2. Consider the table Employee, identify the primary key, alternate keys and
candidate keys. The attributes are as follow:

Emp_Id Emp_Name Dept_no Age Aadhar_no Mobile no.

3. Write command to create table EMP with attributes(Empno, Ename, DName,


Job, DOJ, Location)
4. Consider the following tables EMPLOYEE and JOB given below. Write SQL
statements from (i) to (iv)
EMPLOYEE
EID NAME SALES JOBTITLE
E1 SUMIT SINHA 1100000 PRESIDENT
E2 VIJAY SINGH TOMAR 1300000 VICE PRESIDENT
E3 AJAY RAJPAL 1400000 ADMINISTRATION
ASSISTANT
E4 MOHIT 1250000 ACCOUNTING
MANAGER
E5 SHAILAJA 1450000 ACCOUNTANT

i) Display the name and id of all the employees


ii) Display the name and job title of the employee
iii) Display the employee details whose sales are more than 1250000
iv) Display the jobtitle of Mohit.
UNIT- 3 - Database concepts and the Structured Query Language
WORKSHEET WITH SOLUTIONS
L1 QUESTIONS
1. What is the full form of DBMS?
a) Data of Binary Management System
b) Database Management System
c) Database Management Service
d) Data Backup Management System

Ans: b)

2. What is a database?
a) Organized collection of information that cannot be accessed, updated, and
managed
b) Collection of data or information without organizing
c) Organized collection of data or information that can be accessed, updated,
and managed
d) Organized collection of data that cannot be updated

Ans: c)

3. What is a DBMS?
Ans: A DBMS refers to a software that is responsible for
storing, maintaining and utilizing database in an efficient way.

4. What is a RDBMS?
Ans: A relational database is a collective set of multiple data sets organized
by tables, records and columns.

5. What is a Relation?
Ans: A Relation also called Table, is Matrix like structure arranged in Rows
and Columns.

6. What is Domain?
Ans: It is collection of values from which the value is derived
for a column.

7. What is a Tuple?
Ans: Rows of a table is called Tuple or Record.
8. What is an Attribute?
Ans: Column of a table is called Attribute or Field.

9. What is Degree?
Ans: Number of columns (attributes) in a table.

10. What is Cardinality?


Ans: Number of rows (Records) in a table.

11. What is a Primary Key?


Ans: A primary is a column or set of columns in a table that uniquely identifies
tuples (rows) in that table.

12. What is a Candidate Key?


Ans: It is an attribute or a set of attributes or keys participating for Primary Key, to
uniquely identify each record in that table.

13. What is a Alternate Key?


Ans: Out of all candidate keys, only one gets selected as primary key, remaining
keys are known as alternate or secondary keys.
14. Write the command to create database.
Ans: CREATE DATABASE databasename;
15. Write command to open database.
Ans: USE databasename;
16. Write a command to display all details of table EMP.
Ans: SELECT * FROM EMP;

L2 QUESTIONS

1. What is Data integrity?


Ans: This means that the data in the database is accurate and reliable. In
databases, we can be assured of accuracy and consistency of data due to the
built in integrity checks and access controls. For ex. A date can’t be like
31/31/2000.

2. In which of the following formats data is stored in the database management


system?
a) Image
b) Text
c) Table
d) Graph

Ans: c)

3. Which of the following is not an example of DBMS?


a) MySQL
b) Microsoft Acess
c) IBM DB2
d) Google

Ans: d)

4. What does an RDBMS consist of?


a) Collection of Records
b) Collection of Keys
c) Collection of Tables
d) Collection of Fields

Ans: c)

5. What is Data Inconsistency?


Ans: When two copies of the same data do not agree to each other, then
it is called Inconsistency.
6. What will the degree and cardinality of given table.
Table: Student
Rollno Name Class
12 Arya 11
32 Karthik 11
14 Bella 11
11 Mercy 11

Ans: Degree – 3(no of columns)


Cardinality - 4(no of rows)
7. Consider the table EMP with attributes(Empno, Ename, DName, Job, DOJ,
Location).
Write a command to insert values {1254, Ramesh, HR, Manager, 12-10-
2010, Chennai} into employee table .
Ans. INSERT INTO Employee values( 1254, ‘Ramesh’, ‘HR’,
‘Manager’, ‘2010-10-12’, ‘Chennai’ );
8. Consider the table EMP with attributes(Empno, Ename, DName, Job, DOJ,
Location).
Write a command to display name of employee with their job type.
Ans: SELECT ENAME, JOB FROM EMP;

9. Consider the table EMP with attributes(Empno, Ename, DName, Job, DOJ,
Location). Write a command to display all details of table EMP whose JOB
type is CLERK.
Ans: SELECT * FROM EMP WHERE JOB=’CLERK’;
10. Write a command to display name of employees whose location is
CHICAGO.

Ans: SELECT ENAME FROM EMP WHERE Location=’CHICAGO’;

L3 QUESTIONS
1. The logical design, and the snapshot of the data at a given instant in time is
known as?
a) Instance & Relation
b) Relation & Schema
c) Domain & Schema
d) Schema & Instance

Ans: d)

2. Consider the table Employee, identify the primary key, alternate keys and
candidate keys. The attributes are as follow:

Emp_Id Emp_Name Dept_no Age Aadhar_no Mobile no.

Ans:
Primary Key: Emp_Id (Note: it can be Aadhar_no/Mobile no also)
Alternate Key: Aadhar_no and Mobile no (Note: when primary key is
Emp_Id)
Candidate Key: Emp_Id, Aadhar_no and Mobile no
3. Write command to create table EMP with attributes(Empno, Ename,
DName, Job, DOJ, Location)
Ans. CREATE TABLE EMP( Empno int primary key, Ename varchar(20),
DName Varchar(15), Job Varchar(15), DOJ date, Location varchar(15));
4. Consider the following tables EMPLOYEE and JOB given below. Write
SQL statements from (i) to (iv)
EMPLOYEE
EID NAME SALES JOBTITLE
E1 SUMIT SINHA 1100000 PRESIDENT
E2 VIJAY SINGH 1300000 VICE PRESIDENT
TOMAR
E3 AJAY RAJPAL 1400000 ADMINISTRATION
ASSISTANT
E4 MOHIT 1250000 ACCOUNTING
MANAGER
E5 SHAILAJA 1450000 ACCOUNTANT

i) Display the name and id of all the employees


ii) Display the name and job title of the employee
iii) Display the employee details whose sales are more than 1250000
iv) Display the jobtitle of Mohit.

Ans. i) select EID,NAME from EMPLOYEE;


ii) Select Name, Jobtitle of employee;
iii) Select * from Employee where Sales >1250000;
iv) Select Jobtitle from employee where Name=’Mohit’;
WORKSHEET ON EMERGING TRENDS

L1 - QUESTIONS
1. What is Artificial Intelligence?
2. What is Machine Learning?
3. Explain NLP.
4. What is VR?
5. Explain AR.
6. Define Robotics.
7. What is Big data?
8. What are sensors?
9. Explain IoT.
10.Write about cloud computing.
11.Explain grid computing.
12.Explain Block chain technology.
L2 – QUESTIONS
1. Differentiate between cloud computing and grid computing with suitable
examples.
2. Explain the use of sensors with example.
3. Five friends plan to try a startup. However, theyhave a limited budget and
limited computer infrastructure. How can they avail the benefits of cloud
services to launch theirstartup?
4. Which is not one of the features of loT devices?
5. Microsoft Office365 is an example of which type of cloud service model?
6. PaaS offerings typically follow a pay-as-you-go pricing model.
L3 - QUESTIONS
1. 'Storage of data is cost effective and time saving in cloud computing.'
Justify the above statement.
2. What is on-demand service? How it is provided in cloud computing?
3. Write examples of the following:
a) Government provided cloud computing platform
b) Large scale private cloud service providers and the services
4. 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 combined into a platform for deploying and
running customised applications. What type of cloud computing model fits
these requirements?
ANSWERS - WORKSHEET ON EMERGING TRENDS

L1 - ANSWERS
1. Artificial Intelligence (AI) basically refers to the ability of a machine or a
computer program to think and learn.

2. Machine Learning comprises of algorithms that use data to


learn on their own and make predictions.

3. NLP is an artificial intelligence technique that lets machines process and


understand language like humans do.

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


that simulates the real world.

5. AR adds components of the digital world to the physical world, along with
the associated tactile and other sensory requirements.

6. A robot is basically a machine capable of carrying out one or more tasks


automatically with accuracy and precision.

7. Data sets of enormous volume and complexity are called Big Data.

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

9. The ‘Internet of Things’ is a network of devices that have an embedded


hardware and software to communicate (connect and exchange data) with
other devices on the same network.

10. Computer-based services delivered over the Internet or the cloud, which
can be accessed any where using any smart device

11. A grid is a computer network of geographically dispersed and


heterogeneous computational resources.

12. The blockchain technology works on the concept of decentralised and


shared database where each computer has a copy of the database.
L2 – ANSWERS
1. Ans:

Cloud Computing Grid Computing


One server to computer several tasks Multiple Servers are allocated on
or services concurrently i,e the Single Application.
Virtualization of services.

It is Service Oriented i.e more Application oriented, i.e. typically


frequently used to support long used for job execution for a limited
services. time.

Multiple Services Single Application


On demand services Maximum computing for one
application.
A central computer server with A decentralized system, which
single access point and spans several spans geographically distributed
computing centres. Like Google and sites and lack of central control.
Amazon.
Virtualization of hardware, software Virtualization of data and
and storage platforms. computing resources.
Google Drive, One Drive, Mobile GridGain, JPPF, IBo55Cache,
Applications EhCache

2. Sensors are very commonly used for monitoring and observing elements
in real world applications.
Example: What happens when you hold your mobile vertically or
horizontally?
The display also changes to vertical or horizontal with respect to the way
we hold our mobile. This is possible with the help of two sensors, namely
accelerometer and gyroscope (gyro). The accelerometer sensor in the
mobile phones detects the orientation of the phone. The gyroscope sensors
tracks rotation or twist of your hand and add to the information supplied
by the accelerometer.

3. They can use some free services available on public clouds


such as Google Drive, AWS(Amazon Web Services) etc.

4. b) Programmable
5. c) Software as a Service

6. a) True

L3 - ANSWERS
1. In cloud computing, the on-demand services are available instantly and one
has to pay only for the service and not for theentire infrastructure. Thus,
when one avails storage on a cloud, they just pay for the storage they used
and not for other infrastructure, hence it is cost-effective. And since cloud
services are readily available, these are time-saving too.

2. On-demand services allow users to use a service instantly as and when


required. The cloud services are on-demand services which make available
the cloud resources at run time, when and where needed. On-demand cloud
services allow end users to use cloud computing, storage, software and
other resources instantly and in many cases without limits.

3. a) MeghRaj

b) DropBox, Google Drive, One Drive

4. c) Infrastructure as a Service
Unit 1: Introduction to Computer System

➢ Abacus
➢ Pascaline
➢ Analytical Engine
➢ Tabulating Machine
Evolution of computing ➢ Turing Machine
➢ EDVAC/ENIAC
➢ Transistor
➢ Integrated Circuit

➢ Input device
➢ Output device
Components of computer
➢ Central processing unit
system
➢ Memory unit

➢ Mouse
➢ Keyboard
➢ Joystick
➢ Webcam
➢ Scanner
Input Devices ➢ MICR
➢ OMR
➢ OCR
➢ Monitor
➢ Printer
➢ Speaker
➢ Projector
Output Devices
➢ Plotter

➢ Primary memory
Eg: RAM, ROM
Memory types ➢ Secondary memory
Eg: CD, Hard Disk,
DVD

➢ Operating system
➢ Language processor
System Software ➢ Utility software
➢ Device drivers

➢ General purpose software


Application (eg: spreadsheet, ms word)
software
➢ Customized software
(eg: railway
reservation, banking
software)
➢ Assembler
Language ➢ Compiler
processors ➢ Interpreter

➢ Assembler ➢ Microsoft windows


Operating System ➢ Linux
➢ Solaris

➢ Assembler ➢ Antivirus software


Utility software ➢ Text editor
➢ Compression software
➢ Backup software
➢ Disk fragmenter
Unit 2- Introduction to Python

IDENTIFIERS

KEYWORDS

TOKENS
LITERALS

OPERATORS

PUNCTUATORS
STRING LITERAL

NUMERICAL LITERAL

LITERALS
BOOLEAN LITERAL

SPECIAL LITERAL (NONE)


OPERATORS

ARITHMETIC OPERATORS (+, -, *, /, //, %, **)

LOGICAL OPERATORS (not, and, or)

RELATIONAL OPERATORS (<,>,<=,>=,!=,==)

ASSIGNMENT OPERATORS (+=,-=,*=,/=,//=,%=)

IDENTITY OPERATORS (is, is not)

MEMBERSHIP OPERATORS (in, not in)


List
 Standard data type
 Sequence of values
Characteristics  Mutable & Ordered

 Positive index, starts from 0


 Negative index starts from -1
Indexing

 Updating elements with index


 Deleting elements with del
 Joining list with +
List manipulation  Replicating list with *
List Functions
 append(<item>)
 extend(<list>)
Adding elements  insert(<pos>, <item>)

 pop(<index>)
 remove(<item>)
Removing
 clear()
elements

 len()
 index(<item>)
 count(<item>)
Other functions  reverse()
 sort()
Dictionary
 Standard data type
Characteristics  Key-Value pairs
 Mutable & Unordered

 len()
 clear()
 get(<key>)
Dictionary  items()
functions  keys()
 values()
 update(<dict>)
Unit 3: Database concepts and Structured Query
Language

Database Management System


DBMS

❖ Increases Competency
❖ Time-saving
❖ Security
Need for DBMS ❖ Flow of information

❖ Centralized storing
Advantages of ❖ Reduces Data inconsistency
❖ Reduces data redundancy
DBMS ❖ Sharing of data
Relational Database
RDBMS Management System

Relation Table

Row in a Table
Tuple
Terminologies
Column in a Table
Attribute

Domain Set of values of a column

Degree No. of columns in a table

Cardinality No. of rows in a able


Keys in a Relation

Uniquely identifies rows


Primary Key

Capable of becoming Primary Key

Candidate Key

Candidate key which is not primary


key
Alternate Key = Candidate Key-
Alternate Key Primary Key
SQL Structured Query Language:-
Language for accessing and
SQL
manipulating databases

Categories of SQL ❖ DDL


❖ DML
❖ DQL
❖ DCL

DDL
Data Definition Language
Eg:- CREATE, ALTER, DROP

DML
Data Manipulation Language
Eg:- INSERT, UPDATE, DELETE

DQL
Data Query Language
Eg:- SELECT
❖ INT
❖ FLOAT(M, D)
❖ DECIMAL(M, D)
❖ CHAR(x)
Datatypes in SQL
❖ VARCHAR(x)
❖ DATE
❖ TIME
QUERIES

CREATE DATABASE
DATABASENAME;
Eg:- CREATE DATABASE EMPDB;
Create Database

USE DATABASENAME;
Eg:- USE EMPDB;

Open database
CREATE TABLE
TABLENAME(([column definitions])
[table parameters];
Eg:- CREATE TABLE Employee
(Empid INT PRIMARY KEY,
Create table Firstname CHAR(50), Lastname
CHAR (75) NOT NULL);
QUERIES

Insert Values in INSERT INTO tablename


VALUES(value 1, value 2, ....);
table
Eg:- INSERT INTO Employee
values(101,"Rahul", "Saxena");

View data in table


SELECT Columnnames FROM
Tablename WHERE Condition;

Eg:- SELECT * FROM Employee


WHERE firstname=“Rahul”;
UNIT4 :EMERGING TRENDS

Humanoid Robot - SOPHIA

Siri or Alexa
AI
EXAMPLES Google’s NEST

Self-Driving cars - TESLA

Online games- Alien: Isolation


SUPERVISED

MACHINE LEARNING
UNSUPERVISED

REINFORCEMENT
SENTIMENT ANALYSIS

PREDICTIVE TEXT

APPLICATIONS OF NLP SPEECH RECOGNITION

AUTOMATIC SUMMARIZATION

MACHINE TRANSLATION
VIRTUAL REALITY

IMMERSIVE EXPERIENCES

AUGMENTED REALITY

NASA’S MARS EXPLORATION ROVER (MER)


ROBOTICS
EXAMPLE SOPHIA

A DRONE
VOLUME

VELOCITY

BIG DATA CHARACTERISTICS VARIETY

VERACITY

VALUE
ACCELEROMETER

SENSORS EXAMPLE

GYROSCOPE

SMART TUNNEL

SMART CITY EXAMPLE SMART BUILDING

SMART BRIDGE
INFRASTRUCTURE AS A SERVICE (IAAS)

CLOUD SERVICES
PLATFORM AS A SERVICE (PAAS)

SOFTWARE AS A SERVICE (SAAS)


DISPERSED
GRID COMPUTING –
COMPUTATIONAL RESOURCES

HETEROGENEOUS

DECENTRALISED
BLOCKCHAIN TECHNOLOGY
- DATABASE

SHARED
INTERNET OF THINGS
KENDRIYA VIDYALAYA, CHENNAI REGION

SAMPLE QUESTION PAPER

CLASS XI

SUBJECT: INFORMATICS PRACTICES (065)

General Instructions:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A have 18 questions carrying 01 mark each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
5. Section C has 05 Short Answer type questions carrying 03 marks each.
6. Section D has 03 Long Answer type questions carrying 05 marks each.
7. Section E has 02 questions carrying 04 marks each.
8. All programming questions are to be answered using Python Language only.

PART A
1 Which of the following is valid arithmetic operator in Python: 1
(i) // (ii) && (iii) > (iv) and
2 Out of the following, which one is an example for Utility software? 1
a. Operating system
b. Antivirus software
c. compiler
d. MS Word

3 In DML, M stands for 1


a. maintain
b. manage
c. manipulation
d. manipulate
4 Which of the following is correct? 1
a. Keywords can be used as a variable name.
b. Variable name can start with a digit.
c. Variable name can start with an underscore.
d. Variable name can have symbols like: @, #, $ etc.
5 Identify the odd one from the following: 1
a. MySQL
b. SQLite
c. Python
d. Oracle
6 consider L=(2,3,4). What is the output of print( L*2) 1
a. (2,3,4),(2,3,4)
b. (2,3,4,2,3,4)
c. (2,2,3,3,4,4)
d. error
7 A candidate key that is not a primary key are 1
called______________________
a. Super key
b. Alternate Key
c. Primary Key
d. Foreign Key
8 The device capable of recognizing a pre-specified type of mark 1
made with dark pencil or ink
a. OCR
b. OMR
c. MICR
d. Barcode reader
9 Evaluate: 1
not(1==1 and 0!=1)
a. True
b. False
c. Error
d. Cannot say
10 The number of rows in a relation is called ________________ 1
a. Tuple
b. Attribute
c. Cardinality
d. Degree

11 Which one is not a characteristic of Big Data? 1


a. Volume
b. Variety
c. Velocity
d. Virtual
12 Identify the correct SQL query to create a database named SCHOOL 1
a. CREATE SCHOOL;
b. CREATE DATABASE SCHOOL;
c. CREATE SCHOOL DATABASE;
d. CREATE DATABASES SCHOOL;
13 1 GB is equivalent to 1
a. 210 bytes
b. 230 bytes
c. 220 bytes
d. None of the above
14 Which SQL command helps to fetch data from a relation. 1
a. Use
b. Show
c. Fetch
d. Select
15 In IoT, T stands for 1
a. Technology
b. Things
c. Technical
d. Traffic
16 D1={1: ‘India’, 2: ‘Russia’, 3: ‘World’} 1
D2={‘School’: ‘EOIS’, ‘Place’: ‘Moscow’}
print( D1.update(D2))
Write the output of the above code:
a. None
b. {1: 'India', 2: 'Russia', 3: 'World', 'School': 'EOIS', 'Place':
'Moscow'}
c. Error
d. None of the above
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
17 Assertion (A) :MySQL is open source. 1
Reason (R) :MySQL is not available for free of cost.

18 Assertion (A) : Python is an interpreted language. 1


Reason (R) : python executes the code line by line.

PART B
19 Distinguish between primary memory and secondary memory? 2
OR
What is the function of input devices? Write any two examples?

20 Identify the category(Free and open source/proprietary/Freeware) of 2


following software:
a. OpenOffice
b. Adobe Photoshop
c. Skype
d. Python
21 What will be the output of the following code 2
p=10
q=20
p*=q/2
q+=p+q*2
print('p=',p)
print('q=',q)
22 Categorize following commands into DDL and DML commands? 2
INSERT, DROP, ALTER, UPDATE
23 What will be the output of the following program? 2
a,b,c = 10,20,30
a,b,a = c+2,a+5,c+3
print(a,b)

OR

What will be the output?

for num in range(2,10,2):


s=0
print(num,end=’’)
s=s+num
print(“sum=”,s)

24 Arvind is learning MySQL for managing different databases and 2


tables for his Python based application/software. Tell him the SQL
commands for the following:-
(i) How to show pre-existing databases.
(ii) How to use a desired database

25 With the help of suitable table, explain candidate key and alternate 2
key?

PART C
26 Briefly explain computer system with neat diagram 3

27 Evaluate the following 3


a. 17//5
b. 25>10 and 50<10
c. 15<5 or 7>10 and 3>2 or not 5
d.
28 a. What are the different datatypes in SQL. 1+2
b. Differentiate between char and varchar datatype in SQL?
c.
29 a. Explain grid computing? 3
b. List out the three cloud computing services?
c. Write any two applications of Artificial Intelligence

OR
What is big data? What are the characteristics of big data?
30 Consider the given list, L=[20,30,40,100]. What will be the output 3
of the following:
i. print(L*2)
ii. print(L[-2])
iii. print(L.pop())

or
Explain the following list functions with example:
i. insert()
ii. remove()
iii. append()
PART D
31 Write output for SQL queries (i) to (v) based on the table: SCHOOL 5

i. SELECT * FROM SCHOOL WHERE


SUBJECT=’ENGLISH’;
ii. SELECT CODE, TEACHERNAME FROM SCHOOL;
iii. SELECT SUBJECT FROM SCHOOL;
iv. SELECT TEACHERNAME FROM SCHOOL WHERE
EXPERIENCE>10;
v. SELECT DOJ FROM SCHOOL WHERE
SUBJECT=’CHEMISTRY’ OR EXPERIENCE=15;

OR

i. List out any two examples for RDBMS.


ii. Write any two advantages of database over traditional
file system.
iii. What is SQL?
iv. Write the data type for the column teachername and
experience.
v. Which SQL clause is used to apply condition to
individual rows.
32 Lima wants to write a program for currency conversion. The rate for 5
currency conversion is 1$=₹ 72.50. Answer the following questions:
rupee=input("Enter the amount in rupees:")#Statement 1
dollar=rupee//72.5 # Formula for conversion #(Statement2)
if dollar>1: #Statement 3
print("Amount in dollars is:", dollar, end= '') #Statement 4
else:
print("Enter valid amount!!!",end= '')
print("Thank you for using currency converter!")
i. Find out the error in statement 1:
a. No error
b. Single quotations to be used in place of double quotation marks
c. Type conversion function to be used
d. None of the above
ii. Is the operator used in statement 2 correct? If not, which is the
correct one?
a. // is correct
b. /
c. %
d. None of the above
iii. The comment used in statement 2 (shown in bold letters) is:
a. Single line comment
b. Multiline comment
c. Inline comment
d. Specific comment
iv. The best suited data type for rupee will be
a. string
b. int
c. float
d. list
v. Suppose the input value rupees is accepted in integer form, then
what will be the output of the above program, when the input is
given as 200?
33 Consider the given table and write SQL queries for the following: 5

i. To create the table organisation.


ii. To add one more row with the given values(2006,
REENA,DEPUTY MANAGER,D001,22-DEC-2012)
iii. To display the post from the table organisation?
iv. To display the name and post of employees whose
SGRADE is D003.
v. To display the SGRADE and POST of all employees.

OR
Explain the following terms with an example table:
i. Relation
ii. Tuple
iii. Domain
iv. primary key
v. cardinality
PART E
34 Consider the following table “ACTIVITY” and answer the 1+1+2
following question based on this table?

a. What is the degree and cardinality of the given table?


b. Suppose two more columns are added to the given table, then
what will be the cardinality and degree?
c. Write the names of most appropriate columns, which can be
considered as Primary Key. Justify your answer
OR (Option for part c only)
Difference between DDL and DML with example?
35 Consider the given dictionary, 1+1+2
D={1:’monday’, 2:’Tuesday’, 3:’Wednesday’,4:’Thursday’}.
a. What will be the output of following code:
i. print(D.values())
ii. print(D.get(2))
b. write python code to add a new value ‘Friday ‘with index 5.
Or (Option for part b only)
Write python code to remove the value ‘Wednesday’ from the
dictionary.
KENDRIYA VIDYALAYA, CHENNAI REGION

SAMPLE QUESTION PAPER

CLASS XI

SUBJECT: INFORMATICS PRACTICES (065)

ANSWER KEY

PART A
1 (i) // 1
2 Antivirus software 1
3 Manipulation 1
4 Variable name can start with an underscore. 1
5 Python 1
6 b. (2,3,4,2,3,4) 1
7 Alternate Key 1
8 OMR 1
9 False 1
10 Cardinality 1
11 Virtual 1
12 CREATE DATABASE SCHOOL; 1
13 230 bytes 1
14 Select 1
15 Things 1
16 None 1
17 iii 1
18 i 1
PART B
19 Any two correct difference 2
Or
Function of input device( 1 mark), two eg(1 mark)
20 a. OpenOffice-Free and open source 2
b. Adobe Photoshop-Proprietary
c. Skype-Freeware
d. Python- Free and open source
21 p=100.0 2
q=160.0
(1 mark for each correct answer)
22 DDL-, DROP, ALTER 2
DML-INSERT,UPDATE
23 33 15 2
Or
2468
Sum=8

24 (i) SHOW DATABASES; 2


(ii) USE<DATABASENAME>
25 Candidate key and alternate key with example 2
PART C
26 Diagram- 1.5mark 3
Explanation -1.5 mark
27 a. 3 3
b. False
c. False

28 a. Int,date, float,decimal, char, varchar( Any four-1 mark0 3


b. Any two difference( 2 mark)

29 a. A grid is a computer network of geographically dispersed and 3


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 an storage.(1 mark)
b. Infrastructure as a Service (IaaS), Platform as a Service
(PaaS), Software as a Service (SaaS)- 1 mark
c. (Any two application)-1 mark
Handwriting Recognition, Gaming Intelligent Robots
Natural Language Processing

OR
(definition-1 mark, charctersitics with explanation-2 mark)
Data sets of enormous volume and complexity are called Big Data.
Characteristics of Big Data:
o Volume : Enormous size.
o Velocity : Rate at which the data under consideration is being
generated and stored.
o Variety : Data set has varied data, such as structured,
semistructured and unstructured data. Some examples are text,
images,
videos, web pages and so on.
o Veracity : Veracity refers to the trustworthiness of the data. Big
data can be sometimes inconsistent, biased, noisy.
o Value : Big data possess to have hidden patterns and useful
knowledge.

30 a. [20,30,40,100,20,30,40,100] 3
b. 40
c. 100

or
explanation with eg, each carries 1 mark
PART D
31 5
i. SELECT * FROM SCHOOL WHERE
SUBJECT=’ENGLISH’;

ii. SELECT CODE, TEACHERNAME FROM SCHOOL;

iii. SELECT SUBJECT FROM SCHOOL;

iv. SELECT TEACHERNAME FROM SCHOOL WHERE


EXPERIENCE>10;
v. SELECT DOJ FROM SCHOOL WHERE
SUBJECT=’CHEMISTRY’ OR EXPERIENCE=15;

OR
i. MySQL, oracle, SQlite, Postgres(any two- 1 mark)
ii. Database facilitates centralized storing, Reduces Data
inconsistency, Reduces data redundancy, Sharing of data is
possible etc (Any two correct points- 1 mark)
iii. Structured Query Language (SQL) is a standard language for
accessing and manipulating databases.(1 mark)
iv. Teachername-char/varchar(1/2 mark)
Experience-int(1/2 mark)
v. WHERE(1 mark)

32 i. Type conversion function to be used

ii. b./
iii. a. Single line comment
iv. c. float
v. Amount in dollars is:2.0Thank you for using currency converter!
33 5
i. CREATE TABLE ORGANISATION(ECODE
INT,NAMEVARCHAR(10),POST
VARCHAR(20),SGRAD VARCHAR(4),DOJ DATE);
ii. INSERT INTO ORGANISATION VALUES(2006,
“REENA”,”DEPUTY MANAGER”,”D001”,”22-DEC-
2012”);
iii. SELECT POST FROM ORGANISATION;
iv. SELECT NAME,POST FROM ORGANISATION
WHERE SGRADE=’D003’;
v. SELECT SGRADE,POST FROM ORGANISATION;

OR
i. Relation - Tables in Relational Database
ii. Tuples - Records/Rows in a relation
iii. Domain - Set of values taken for an attribute
iv. Primary key - Key attribute that uniquely identifies a tuple
v. Cardinality – No. of Tuples/records in a relation
(explanation with eg table- 1 mark for each)

PART E
34 a. DEGREE=5,CARDINALITY=5(1 mark) 4
b. DEGREE=7, CARDINALITY=5(1 mark)
c. ACODE as PRIMARY KEY, Because it is unique and not
null( 2 mark)
OR
Any two difference with eg(2 mark)
35 a. i. Monday,Tuesday, Wedneday,Thursday( 1 mark) 4
ii.Tuesday(1 mark)
b. D[5]=’Friday’(2 mark)
Or
del D[3](2 mark)
KENDIRYA VIDYALAYA SANGATHAN, CHENNAI REGION
SAMPLE PAPER CLASS XI
INFORMATICS PRACTICES 065
MM:70 TIME: 180 MIN

General Instructions:

1. This question paper contains five sections, Section A to E.

2. All questions are compulsory.


3. Section A have 18 questions carrying 01 mark each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
5. Section C has 05 Short Answer type questions carrying 03 marks each.
6. Section D has 03 Long Answer type questions carrying 05 marks each.
7. Section E has 02 questions carrying 04 marks each. One internal choice is given in
Q35 against part c only.

8. All programming questions are to be answered using Python Language only.

PART-A

1 1
An Antivirus software is an example of
i) Application Software
ii) System software
iii) Utility software
iv) None of these

2 1
First time, Integrated Circuits (ICs) are introduced in generation of
computers?
i) First generation
ii) Second generation
iii) Third generation
iv) Fourth generation

3 8 GB=________ bits? 1

4 Which one of the following is invalid Identifier? 1


(i) 11IPCommerce (ii) While (iii) _Number (iv) Apple12
5 Operator with the highest precedence is : 1
i) %
ii) +
iii) and
iv) **

6 Which of the following are illegal operations on lists? 1


i) L+L
ii) L*2
iii)L+2
iv) L*L

7 Which of the following is a mutable data type? 1


i) String
ii) List
ii) Tuple
iv) Float

8 Tuples are represented using : 1


i) []
ii) ( )
iii { }
iv) < >

9 SQL stands for: 1


i) Scripting Questioning Language
ii) Scripting Query Language
iii) Simple Query Language
iv) structured Query Language

10 Which command is used to show the structure of a table? 1


i) Use
ii) Show
iii) Desc
iv) Alter

11 Which command is used to delete a column from a table: 1


i) Update
ii) Delete
iii) Drop
iv) Alter

12 Attribute is another name for: 1


i) Row
ii) column
iii) Table
iv) Relation
13 Which one is not a DDL command: 1
i) Alter
ii) Update
iii) Create
iv) Drop

14 Which key is having constraint Unique and Not NULL in it. 1


i) Primary Key
ii) Foreign Key
iii) Not Null Key
iv) Unique Key

15 What does IoT stand for? 1


i) Internet Of Transmission
ii) Interview Of Things
iii) Internet Of Things
iv) Interconnection Of Tables

16 Which is not a personal assistant application : 1


i) Alexa
ii) Google Assistant
iii) Instagram
iv) Siri

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

17 Assertion (A): - Updating value of any element in a tuple will give error. 1

Reasoning (R):- Tuple is Immuatble


18 Assertion (A): -.Alter command is used to update values in a table. 1

Reasoning (R):- Alter is a DDL command and it deals with the structure of a table.
PART-B
19 Differentiate between RAM and ROM. 2

Or

Differentiate between Primary and Secondary Memory.

20 Differentiate between System Software and Application Software. Give examples of each. 2

21 2
Write the corresponding Python assignment statement.
a) Assign 10 to a variable height and 20 to a variable weight.
b) Assign the sum of height and weight to a variable total.

22 Write the output of following code: 2


d1={'Name':'Mohit','Age':15,'Class':11,'Section':'B'}
d2={'Name':'Astha','Age':17,'RollNo':3}
d1.update(d2)
print(d1)
print(d2)

23 Name any two DML commands along with their use. 2


Or
Write the use of Show and Use command.

24 2
Explain the role of where clause in MYSQL with the help of an example.

25 Differentiate between Char and Varchar datatypes in MySQL. 2 2

PART-C

26 Write a short note on Operating Systems and its Functions. 3

27 Write a program to calculate factorial of a given number. 3

28 Write a program to take a list input and find the smallest number from the list. 3

29 Write SQL queries for the following: 3


(i) Create table Result having following columns:
RollNo int,
Name varchar(30),
Marks int
(ii) Add a column Percentage of type decimal(5,2) in an existing table Result.
(iii) Delete table Result.

OR

Explain the Purpose of Database Management System


30 What is Cloud Computing? Explain its three different Services. 3
Or
Write a short note on Big Data.

PART-D

31 Write a program to take input as a list and store the characters and their number of 5
occurences in a dictionary as key value pairs and then display the dictionary.
Eg: Input :[ 'a','a','b','b','a','c','c','c','c','c','d','d','d','d','d','e','e','e']
Output: {'a':3,'b':2,'c':5,'d':5,'e':3}

Or

Write a program to Create a dictionary of students to store names and marks obtained in 5
subjects.

32 5

Write SQL Queries for the following:


i) To display names of stores along with SalesAmount of those stores that have
NoOfEmp is more than 10 in their store names.
ii) To display Stores names, Location and DateOfOpen of stores that were opened
before 1st March, 2015.
iii) To display name and location of those store which have salesAmount less
than 40000.
iv) To display all the records of the table Store where city is Mumbai.
v) To display the stores where sales amount is between 40000 to 70000.
33 On the basis of following table answer the given questions: 5

(i) Write the degree and cardinality of the above table.


(ii) What will be the output of the following query :
Select * From Customer_Details order by DOJ;
(iii) Write the sql query to display the row from the table where customer has no accumulated
amount.
(iv) What will be the output of the following query:
Select * from Customer_Details where Acc_Type='Savings';
(v) Write the sql query to display all the customer names having DOJ more than ‘02/19/1994’.

Or

i) What are the attributes available in the table Customer Details?


ii) What do you mean by a tuple in an SQL table?
iii) Write a query to update the Accumlt_Amt=20000 for Manpreet.
iv) What will be the output of the following query:
Select * from Customer_Details where Acc_Type='Current'
v) Write a query to display all customer name salong with their DOJ.

PART- E
34 Consider the following list and answer any four questions from (i) to (iv) 1+1+2
lst1 = [1, 3, 5]
lst2 = [6, 7, 8]
lst3 = [10, 11, 12]
i) Predict the output for the following process
>>> lst1 + lst2 + lst3

ii) What will be the possible result of the replication process of the given list
>>> lst1 * 3
a) [3, 9, 15]
b) [1, 3, 5, 1, 3, 5, 1, 3, 5]
c) [4, 6, 8]
c) None of the Above

iii) What will be the output of the following code?


>>> len(lst1 + lst2 + lst3)
a) [17, 21, 25]
b) 9
c) 8
d) None of the Above

or
Predict the output of the following code >>>l1.append(100)
a) [1, 3, 5, 100]
b) [1, 3, 100, 5]
c) [100, 1, 3, 5]
d) None of the Above

35 1+1+2
a)Using SQL statements in MySQL, create the Database Name: Univ also write a
query to open the database Univ.
Answer parts b), c) on the basis of the structure table job.

b) Create a table Job with the specification given above.


c) Identify the primary and alternate key.
or
How will you enlist the name of database and the tables in a database?
KENDIRYA VIDYALAYA SANGATHAN, CHENNAI REGION
SAMPLE PAPER MARKING SCHEME CLASS XI
INFORMATICS PRACTICES 065
MM:70 TIME: 180 MIN

General Instructions:

1. This question paper contains five sections, Section A to E.

2. All questions are compulsory.


3. Section A have 18 questions carrying 01 mark each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
5. Section C has 05 Short Answer type questions carrying 03 marks each.
6. Section D has 03 Long Answer type questions carrying 05 marks each.
7. Section E has 02 questions carrying 04 marks each. One internal choice is given in
Q35 against part c only.

8. All programming questions are to be answered using Python Language only.

PART-A

1 iii) Utility software 1

2 iii) Third generation 1

3 8 GB=________ bits? 1

4 i)11IPCommerce 1

5 iv) ** 1

6 i) L+L 1
ii) L*2

7 ii) List 1

8 ii) () 1

9 iv) structured Query Language 1


10 iii) Desc 1

11 iv) Alter 1

12 ii) column 1

13 ii) Update 1

14 i) Primary Key 1

15 iii) Internet Of Things 1

16 iii) Instagram 1

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

17 i 1

18 iv 1

PART-B

19 2 Marks for any two differences 2

Or

2 Marks for any two differences

20 2 Marks for any two differences along with example 2

21 2

a) 1 mark for correct answer


b) 1 mark for correct answer

22 {'Name': 'Astha', 'Age': 17, 'Class': 11, 'Section': 'B', 'RollNo': 3} 2


{'Name': 'Astha', 'Age': 17, 'RollNo': 3}
1 Mark each for each output
23 Name any two DML commands along with their use. 2
Or
Write the use of Show and Use command.

24 2
1 Mark for explanation and 1 Mark for example

25 2 Marks for 2 correct differences 2

PART-C

26 1 Mark for definition 3


1 Mark for functions
1 Mark for Examples

27 1 Mark for correct input 3


1 Mark for correct loop
1 Mark for calculation of factorial

28 1 Mark for correct input 3


1 Mark for correct loop
1 Mark for computing smallest number

29 Write SQL queries for the following: 3


(i) Create table Result (RollNo int, Name varchar(30), Marks int);
(ii) Alter table Result add column Percentage decimal(5,2)
(iii) Drop table Result.
1 Mark for each correct query

OR

3 Marks for correct explanation

30 3 Marks for correct explanation 3


Or
3 Marks for correct explanation

PART-D
31 L=eval(input("Enter list elements : ")) 1 Mark for correct input 5
d={} ½ mark for empty dictionary
for e in L: 1 Mark for correct outer loop
if e not in d.keys(): 1 Mark for correct outer loop
d[e]=L.count(e) 1 Mark for correct statement
print(d) ½ mark for output

Or

d={}
ch='y'
while ch=='y': #1 Mark for loop
name=input("Enter name of student") #2 Marks for all inputs
m1=int(input("Enter marks in subject 1:"))
m2=int(input("Enter marks in subject 2:"))
m3=int(input("Enter marks in subject 3:"))
m4=int(input("Enter marks in subject 4:"))
m5=int(input("Enter marks in subject 5:"))
d[name]=[m1,m2,m3,m4,m5] #1 Mark for adding element to
dictionary
ch=input("Add more...?? (y/n") #1 Mark for statement
print(d)

32 i) Select name, salesAmount from Stores where NoOfEmp>10; 5


ii) Select Stores names, Location, DateOpen from stores where DateOpen
<’15-03-01’.
iii) Select name, location from stores where salesAmount < 40000
iv) Select * from stores where city=’ Mumbai’.
v) Select name from stores where sales amount between 40000 and 70000.

33 5

(i) Degree=6 and cardinality=4.


(ii) 1st, 4th, 2nd and 3rd will be sequence of rows
(iii) Select * from Customer_Details where Accumlt is null;
(iv) 1st and 3rd row
(v) Select cust_names from customer_details where DOJ > ‘02/19/1994.

Or

i) Cust_ID, Cust_Name, Acc_Type, Accumlt_Amt,DOJ, Gender


ii) Tuple means row
iii) update customer_details set Accumlt_Amt=20000 where name= ‘Manpreet’.
iv) 2nd and 4th row
v) Select cust_name, DOJ from Customer_Details.
PART- E

34 1+1+2
i) [1,3,5,6,7,8,10,11,12]

ii) b) [1, 3, 5, 1, 3, 5, 1, 3, 5]

iii) b) 9

or

a) [1, 3, 5, 100]

35 1+1+2
a) create database Univ.

Use univ

b) Create table Job (Job_Id int(4), Job_des varchar(30), Alloc_on date, Due_on date, Emp_id
int(4));
c) primary key- Job_id and there is no alternate key.
or
show databases and show tables.
KENDRIYA VIDYALAYA SANGATHAN CHENNAI REGION

SAMPLE QUESTION PAPER

CLASS : XI

INFORMATICS PRACTICES ( 065 )

DURATION: 3 Hrs. MAX MARKS : 70

______________________________________________________________________________
General Instructions:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A have 18 questions carrying 01 mark each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
5. Section C has 05 Short Answer type questions carrying 03 marks each.
6. Section D has 03 Long Answer type questions carrying 05 marks each.
7. Section E has 02 questions carrying 04 marks each. One internal choice is
given in Q35 against part c only.
8. All programming questions are to be answered using Python Language only.
Section A [18 x 1= 18]

Q Question Mark
No s
.

1 Who developed python? 1

a) Charles Babbage b) Guido Van Rossum

c) Tim Berners Lee d) Robert E Kahn

2 ROM is a --------- memory. 1


a) Volatile b) non- volatile c) both a and b
d) None of these
3 Which of the following is not an input device? 1
a) Keyboard b) Monitor c) Joystick
d) Microphone
4 ____________ is a system software that translates and executes 1
instructions
written in a computer program line-by-line.
a) Assembler b) Interpreter c) Compiler
d) None of these
5 Which for loop statement will produce first 5 odd numbers: (Two 1
options are correct)
a) for x in range(1,9,2): b) for x in range(1,10,2):
c) for x in range(9, 1, -2): d) for x in range(9,-1,-2):
6 Suppose list1 is [1,3,2], What is list1 * 2? 1
a) [2,6,4] b) [1,3,2,1,3] c) [1,3,2,1,3,2]
d) [1,3,2,3,2,1]
7 What will be the output of the following Python code? 1
D={1:”A”,2:”B”,3:”C”}
for i in D:
print(i,end=” “)
a) 1 2 3 b) A B C c) 1 ‘A’ 2 ‘B’ 3 ‘C’
d) Error
8 Write output of the expression, 22 % 3 : 1
a) 7 b) 1 c) 0 d) 5
9 Find the invalid identifier(s) from the following: 1
a) Name1 b) _Total c) my-name d) break
10 _______________ command is used to add a new record in a table. 1
a) SELECT b) INSERT c) UPDATE d) USE
11 Choose DML command from the following: 1
a) CREATE b) ALTER c) DELETE d) DROP
12 SELECT * statement displays all -------------------- of a table. 1
a) Rows b) Attributes c) Tuples d)
Domain values
13 Horizontal subset of table is known as ---------------- 1
a) Tuple b) Attribute c) domain d) Degree
14 Consider the table EMPLOYEE 1

EID NAME SALES JOBID

E1 SUMIT SINHA 1100000 102

E2 VIJAY SINGH 1300000 101


TOMAR

E3 AJAY RAJPAL 1400000 103

E4 MOHIT 1250000 102


E5 SHAILAJA 1450000 103

What is the cardinality of the table?

a) 4 b) 5 c) 1 d) 20

15 --------------------- is an artificially intelligent technology that help 1


computers understand, interpret, and manipulate human language.
a) NLP b) AR c) VR d) ML
16 Which one of these is not an area of AI? 1
a) Face/Image Recognition b) Voice Recognition
c) Robotics d) Web Designing
17 Q No. 17 and 18 are ASSERTION AND REASONING based 1
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
Assertion (A): - The keyword DISTINCT is used to eliminate
redundant data from a table.
Reasoning (R):- WHERE clause is used to select specific rows.
18 Assertion (A): - Python is an interpreted programming language. 1
Reasoning (R):- The Python program is processed at runtime by the
interpreter and you do not need to compile your program before
executing it.

Section B [7 x 2= 14]
19 Briefly explain system software and application software with 2
examples.
OR
Briefly explain the components of computer system using block
diagram.
20 Write the difference between compiler and interpreter. 2

21 Predict the output of the following code 2

x=2
y=5
z =x + 2**3
x = y *2
y=x+z
print (“Python Program”)
print (“Value of x : ”, x)
print (“Value of y : ”, y)
print (“Value of z : ”, z)
22 What will be the output of the following statements? 2

i) list1 = [12,32,65,26,80,10]
list1.sort()
print(list1)
ii) myList = [1,2,3,4,5,6,7,8,9,10]
del myList[:5]
print(myList)
23 Consider the table STUDENT and answer the following: 2

RollNo Name Class Mark

1 Anitha 11C 58

2 Neha 11C 65

3 Sanjay 11D 89

i) Write the degree and cardinality of the table STUDENT.


ii) Write the query to display name and mark of the
student whose roll number is 2.

OR

Predict output:

i) SELECT name FROM STUDENT WHERE Mark>70;


ii) SELECT * FROM STUDENT WHERE class=”11D”;

24 What is DBMS ? Write names of any two DBMSs. 2

25 Define Primary key of a table with the help of an example. 2

Section C [5 x 3= 15]

26 Explain primary memory and secondary memory with examples. 3


OR
Expand the following
i) ALU ii) LCD iii) CD-ROM iv) DVD v)
FOSS vi) MICR
27 Write a Python program to print the factorial of a number. 3

OR

Write a Python program to calculate the compound interest. The


principal, rate of interest and time must be entered by the user.

(Formula: Compound Interest = Principal (1 + Rate/100)Time )

28 Write a program to calculate the average and total of 5 numbers in a 3


list.

29 Explain two categories of SQL and mention the commands in each. 3

30 What is artificial intelligence? List any 2 applications of AI 3

OR

What do you understand by immersive experience?

Section D [3 x 5= 15]

31 Write a program to read a list of n integers (positive as well as 5


negative). Create two new lists, one having all positive number and
the other having all negative numbers from the given list. Print all
three lists.

OR

The record of a student (Name, Roll No., Marks in five subjects and
percentage of marks) is stored in the following list:

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

Write Python statements to retrieve the following information from


the list stRecord.

(a) Percentage of the student

(b) Marks in the fifth subject

(c) Maximum mark of the student

(d) Roll no. of the student

(e) Change the name of the student from ‘Raman’ to ‘Raghav’


32 Explain the following terms in DBMS with the help of a table. 5
Mention examples of each term based on the table data:

i) Relation
ii) Tuple
iii) Domain
iv) Attribute
v) Primary key

33 Consider the table SUBJECT and answer the following: 5

SubCode SubName Teacher EnrolNum

S065 Informatics Practices Rahul Sharma 40

S083 Computer Science Varun Kumar 45

S042 Physics K Raja 50

S030 Economics Ahmed Khan 48

i) Write query to display the name of the teacher teaching subject


with subject code “S042”.
ii) Write query to display the number of enrolled students for the
subject Economics.
iii) Write query to display the details of subjects in which enrolled
students are more than 45.
iv) Write query to display the subject name that Varun Kumar
teaches.
v) Write query to display the name of Physics teacher.

OR

Predict Output:

i) SELECT * FROM subject where SubCode=”S042”;


ii) SELECT SubName from Subject WHERE EnrolNum<45;
iii) SELECT Teacher from Subject WHERE EnrolNum<48 AND
EnrolNum>=45;
iv) SELECT * from Subject WHERE SubName=’Economics’;
v) SELECT SubName, EnrolNum from Subject;

Section E [2 x 4= 8]

34 Write a program to calculate EMI as per formula: E=PR(1+R)n 4


/((1+R)n -1)
Where E=EMI, P= Principal Loan amount, R= Rate of Interest per
month (i.e. Annual Rate of Interest/100/12), tenure of loan repayment
in months;

Get the input from user (e.g., calculate EMI for loan amount of 200000
at 10% p.a. rate of interest) for a period of 2 years i.e., 24 months.

OR

Write a Python program to accept a number from user and prints the
frequency of the number in the list LST . If the number is not in LST ,
it should print “ Not in the list”.

For example : LST=[12,25,15,64,12,65]

If the number entered by user is 12, it will show the output : 2

35 Consider the table EMP_TBL and answer the following: 4

ECode EName Dept Salary

101 Gautam Gupta Sales 55000

102 Nina Sharma Marketing 62000

103 Venkat HR 75000

104 Karan Kumar Sales 45000

105 Asha Yadav HR 72000

A. Write Query :
i) To display the names of employees whose salary is between
50000 and 70000.
ii) To display the name and salary of employees of sales
department.
B. Predict Output
i) SELECT Ename FROM EMP_TBL WHERE dept=”Sales”;
ii) SELECT salary FROM EMP_TBL WHERE ECode=”103”;

OR ( Choice is only for Part B)

Predict Output:
i) SELECT dept FROM EMP_TBL WHERE EName=”Nina
Sharma”;
ii) SELECT * FROM EMP_TBL WHERE Salary >60000 and
Salary<75000;
KENDRIYA VIDYALAYA SANGATHAN CHENNAI REGION

SAMPLE QUESTION PAPER

CLASS : XI - INFORMATICS PRACTICES ( 065 )

MARKING SCHEME

DURATION: 3 Hrs. MAX MARKS : 70

______________________________________________________________________________
General Instructions:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A have 18 questions carrying 01 mark each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
5. Section C has 05 Short Answer type questions carrying 03 marks each.
6. Section D has 03 Long Answer type questions carrying 05 marks each.
7. Section E has 02 questions carrying 04 marks each. One internal choice is
given in Q35 against part c only.
8. All programming questions are to be answered using Python Language only.

Section A [18 x 1= 18]

Q Question Mark
No s
.

1 Who developed python? 1

a) Charles Babbage b) Guido Van Rossum

c) Tim Berners Lee d) Robert E Kahn

2 ROM is a --------- memory. 1


a) Volatile b) non- volatile c) both a and b d)
None of these
3 Which of the following is not an input device? b)
a) Keyboard b) Monitor c) Joystick d)
Microphone
4 ____________ is a system software that translates and executes
instructions
written in a computer program line-by-line.
a) Assembler b) Interpreter c) Compiler d)
None of these
5 Which for loop statement will produce first 5 odd numbers: (Two options
are correct)
a) for x in range(1,9,2): b) for x in range(1,10,2):
c) for x in range(9, 1, -2): d) for x in range(9,-1,-2):
6 Suppose list1 is [1,3,2], What is list1 * 2?
a) [2,6,4] b) [1,3,2,1,3] c) [1,3,2,1,3,2] d)
[1,3,2,3,2,1]
7 What will be the output of the following Python code? 1
D={1:”A”,2:”B”,3:”C”}
for i in D:
print(i,end=” “)
a) 1 2 3 b) A B C c) 1 ‘A’ 2 ‘B’ 3 ‘C’ d)
Error
8 Write output of the expression, 22 % 3 :
a) 7 b) 1 c) 0 d) 5
9 Find the invalid identifier(s) from the following:
a) Name1 b) _Total c) my-name d) break
10 _______________ command is used to add a new record in a table.
a) SELECT b) INSERT c) UPDATE d) USE
11 Choose DML command from the following:
a) CREATE b) ALTER c) DELETE d) DROP
12 SELECT * statement displays all -------------------- of a table.
a) Rows b) Attributes c) Tuples d) Domain
values
13 Horizontal subset of table is known as ----------------
a) Tuple b) Attribute c) domain d) Degree
14 Consider the table EMPLOYEE 1

EID NAME SALES JOBID

E1 SUMIT SINHA 1100000 102


E2 VIJAY SINGH 1300000 101
TOMAR

E3 AJAY RAJPAL 1400000 103

E4 MOHIT 1250000 102

E5 SHAILAJA 1450000 103

What is the cardinality of the table?

a) 4 b) 5 c) 1 d) 20

15 --------------------- is an artificially intelligent technology that help 1


computers understand, interpret, and manipulate human language.
a) NLP b) AR c) VR d) ML
16 Which one of these is not an area of AI? 1
a) Face/Image Recognition b) Voice Recognition
c) Robotics d) Web Designing
17 Q No. 17 and 18 are ASSERTION AND REASONING based questions. 1
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
Assertion (A): - The keyword DISTINCT is used to eliminate redundant
data from a table.
Reasoning (R):- WHERE clause is used to select specific rows.
Ans. ii
18 Assertion (A): - Python is an interpreted programming language. 1
Reasoning (R):- The Python program is processed at runtime by the
interpreter and you do not need to compile your program before
executing it.
Ans. i

Section B [7 x 2= 14]
19 Briefly explain system software and application software with examples. 2
Ans. System software Example- Operating System
Application software Example- MS Office, MS Paint
OR
Briefly explain the components of computer system using block diagram.
Ans . Input unit, Output unit, CPU- ALU, Control unit, Memory unit
20 Write the difference between compiler and interpreter. 2
Ans. Compiler transforms code written in a high-level programming
language into the machine code, at once, before program runs, whereas
an Interpreter converts each high-level program statement, one by one,
into the machine code, during program run.
Compiled code runs faster while interpreted code runs slower.
Compiler displays all errors after compilation, on the other hand, the
Interpreter displays errors of each line one by one.
Compiler takes an entire program whereas the Interpreter takes a single
line of code.
21 Predict the output of the following code 2

x=2
y=5
z =x + 2**3
x = y *2
y=x+z
print (“Python Program”)
print (“Value of x : ”, x)
print (“Value of y : ”, y)
print (“Value of z : ”, z)
Ans. 10
20
10
22 What will be the output of the following statements? 2

i) list1 = [12,32,65,26,80,10]

list1.sort()

print(list1)

Ans. [10, 12, 26, 32, 65, 80]

ii) myList = [1,2,3,4,5,6,7,8,9,10]

del myList[:5]
print(myList)

Ans. [6, 7, 8, 9, 10]

23 Consider the table STUDENT and answer the following: 2

RollNo Name Class Mark

1 Anitha 11C 58

2 Neha 11C 65

3 Sanjay 11D 89

i) Write the degree and cardinality of the table STUDENT.


ii) Write the query to display name and mark of the
student whose roll number is 2.

Ans. i) Degree =4, Cardinality = 3

ii)SELECT Name, Mark from Student WHERE RollNo=2;

OR

Predict output:

i) SELECT name FROM STUDENT WHERE Mark>70;


ii) SELECT * FROM STUDENT WHERE class=”11D”;

Ans. i) Sanjay

ii).

3 Sanjay 11D 89

24 What is DBMS ? Write names of any two DBMSs. 2

Ans. It is a software that is responsible for storing, manipulating,


maintaining and utilizing database. Eg:- MySQL, Oracle

25 Define Primary key of a table with the help of an example. 2

Ans. Key attribute that uniquely identifies a tuple

• Only one primary key in a relation

• No null values in primary key column

• No values can be repeated in a primary key column

Definition 1 mark, Example with table I mark


Section C [5 x 3= 15]

26 Explain primary memory and secondary memory with examples. 3


Ans. Primary memory -RAM and ROM : 1.5 marks
Secondary memory with example : 1.5 marks
OR
Expand the following
i) ALU – Arithmetic Logic Unit ii) LCD – Liquid Crystal
Display
iii) CD-ROM - Compact Disk- Read Only Memory iv) DVD –
Digital Video Disk
v) FOSS–Free and Open Source Software vi) MICR-Magnetic Ink
Character Recognition
27 Write a Python program to print the factorial of a number. 3

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


factorial = 1
if num < 0:
print("Sorry, factorial does not exist for negative numbers")
elif num == 0:
print("The factorial of 0 is 1")
else:
for i in range(1,num + 1):
factorial = factorial*i
print("The factorial of",num,"is",factorial)
OR

Write a Python program to calculate the compound interest. The


principal, rate of interest and time must be entered by the user.

(Formula: Compound Interest = Principal (1 + Rate/100)Time )

Ans.

principal = int(input("Enter principal amount: "))


rate = int(input("Enter interest rate: "))
time = int(input("Enter time(years): "))
ci= principal * ((1 + rate / 100)**time) - principal
print("Compound interest is ",ci)
28 Write a program to calculate the average and total of 5 numbers in a list. 3

Ans.
a=[]
for i in range(0,5):
elem=int(input("Enter element: "))
a.append(elem)
avg=sum(a)/5
print("Average of elements in the list", avg)
29 Explain two categories of SQL and mention the commands in each. 3

Ans. DDL – Create, Alter, Drop


DML- Insert , Update, Delete
DQL – Select
Category+ example :- 1 mark each

30 What is artificial intelligence? List any 2 applications of AI 3

AI refers to artificial creation of human like intelligence.

Applications:

1. Gaming
2. Natural Language processing
3. Expert systems
4. Speech Recognition
5. Intelligent robots

Or

What do you understand by immersive experience?

Ans. It includes various technologies that enhance our senses and gives
us immersive experience. It includes technologies Virtual Reality (VR)
and Augmented Reality (AR).

Points on AR, and VR :- 1 mark each

Section D [3 x 5= 15]

31 Write a program to read a list of n integers (positive as well as negative). 5


Create two new lists, one having all positive number and the other having
all negative numbers from the given list. Print all three lists.

Ans.

L=eval(input("Enter list elements"))


P=[]
N=[]
for i in L:
if i<0:
N.append(i)
elif i>0:
P.append(i)
print("Positive elements are: ",P)
print("Negative elements are: ",N)
print("Original elements are: ",L)
OR

The record of a student (Name, Roll No., Marks in five subjects and
percentage of marks) is stored in the following list:

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

Write Python statements to retrieve the following information from the


list stRecord.

(a) Percentage of the student

(b) Marks in the fifth subject

(c) Maximum mark of the student

(d) Roll no. of the student

(e) Change the name of the student from ‘Raman’ to ‘Raghav’

Ans. a) stRecord[3]

b) stRecord[2][4]
c) max(stRecord[2])
d) stRecord[1]
e) stRecord[0]=”Raghav”

Each correct answer carries 1 mark

32 Explain the following terms in DBMS with the help of a table. Mention 5
examples of each term based on the table data:

i) Relation
ii) Tuple
iii) Domain
iv) Attribute
v) Primary key

Ans.

Empi Enam Ag Dept Designatio Date_of_Joi Salar


d e e n n y
101 Manis 35 Sales Salesman 22-05-2010 35000
h

102 Rekha 30 HR Accountant 01-07-2015 40000

103 Swati 40 HR Manager 05-09-2011 55000

104 Rahul 26 Marketin Manager 08-01-2018 30000


g

➢ Relation - Tables in Relational Database

Eg:Employee

➢ Attributes - Columns in a Relation

Eg: Empid, Ename, Age, Dept, Designation, Date_of_Join, Salary

➢ Tuples - Records/Rows in a relation

Eg: 101, Manish, 35, Sales, Salesman, 22-05-2010 ,


35000

➢ Domain - Set of values taken for an attribute

Eg: Domain of (Ename)={ Manish, Rekha, Swati, Rahul}

➢Primary key - Key attribute that uniquely identifies a tuple

Eg: Empid in Employee table

a Consider the table SUBJECT and answer the following: 5

SubCode SubName Teacher EnrolNum

S065 Informatics Rahul 40


Practices Sharma

S083 Computer Varun 45


Science Kumar

S042 Physics K Raja 50

S030 Economics Ahmed 48


Khan
i) Write query to display the name of the teacher teaching subject
with subject code “S042”.
ii) Write query to display the number of enrolled students for the
subject Economics.
iii) Write query to display the details of subjects in which enrolled
students are more than 45.
iv) Write query to display the subject name that Varun Kumar teaches.
v) Write query to display the name of Physics teacher.
S030 Economics Ahmed 48
Ans.
Khan

i) Select teacher from Subject where SubCode=”S042”;


ii) Select EnrolNum from subject where Subname=”Economics”;
iii) Select * from Subject where enrolnum>45;
iv) Select subname from subject where Teacher=”Varun Kumar”;
v) Select Teacher from Subject where Subname=”Physics”;

OR

Predict Output:

i) SELECT * FROM subject where SubCode=”S042”;


ii) SELECT SubName from Subject WHERE EnrolNum<45;
iii) SELECT Teacher from Subject WHERE EnrolNum<48 AND
EnrolNum>=45;
iv) SELECT * from Subject WHERE SubName=’Economics’;
v) SELECT SubName, EnrolNum from Subject;

Ans. S042 Physics K Raja 50


i)
ii) Informatics Practices
iii) Varun Kumar

iv) SubName EnrolNum

Informatics Practices 40
v)
Computer Science 45

Physics 50

Economics 48

Section E [2 x 4= 8]
34 Write a program to calculate EMI as per formula: E=PR(1+R)n /((1+R)n - 4
1)

Where E=EMI, P= Principal Loan amount, R= Rate of Interest per month


(i.e. Annual Rate of Interest/100/12), tenure of loan repayment in
months;

Get the input from user (e.g., calculate EMI for loan amount of 200000 at
10% p.a. rate of interest for a period of 2 years i.e., 24 months.),
calculate and print the EMI.

Ans. Correct input statement for P, R and n – 1 ½ marks

Correct expression for calculating EMI – 1 ½ marks

Correct print statement – 1 mark

OR

Write a Python program to accept a number from user and prints the
frequency of the number in the list LST . If the number is not in LST , it
should print “ Not in the list”.

For example : LST=[12,25,15,64,12,65]

If the number entered by user is 12, it will show the output : 2

Ans.

LST=eval(input(“Enter elements”))
elm=int(input(“Enter elemnt:”))
c=0
for I in range(0,len(LST)):
if elm==LST[i]:
c=c+1
if c==0:
print(elm,” Not Found”)
else:
print(c )
35 Consider the table EMP_TBL and answer the following: 4

ECode EName Dept Salary

101 Gautam Gupta Sales 55000

102 Nina Sharma Marketing 62000

103 Venkat HR 75000

104 Karan Kumar Sales 45000


105 Asha Yadav HR 72000

A. Write Query :
i) Write query to display the names of employees whose salary is
between 50000 and 70000.

Ans. SELECT EName FROM EMP_TBL WHERE SALARY>=50000


AND SALARY<=70000;

ii) Write query to display the name and salary of employees of


sales department.

Ans. SELECT EName, SALARY FROM EMP_TBL WHERE


DEPT=’Sales’;

B. Predict Output
i) SELECT Ename FROM EMP_TBL WHERE dept=”Sales”;
Ans. GAUTAM GUPTA
KARAN KUMAR
ii) SELECT salary FROM EMP_TBL WHERE ECode=”103”;
Ans. 75000

OR ( Choice is only for Part B)

Predict Output:
i) SELECT dept FROM EMP_TBL WHERE EName=”Nina
Sharma”;
Ans. MARKETING
ii) SELECT * FROM EMP_TBL WHERE Salary >60000 and
Salary<75000;
102 Nina Sharma Marketing 62000
Ans.
105 Asha Yadav HR 72000
KENDRIYA VIDYALAYA SANGATHAN CHENNAI REGION
SAMPLE QUESTION PAPER
CLASS XI INFORMATICS PRACTICES (065)
TIME: 3 HOURS 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.
5. Section C has 05 Short Answer type questions carrying 03 marks each.
6. Section D has 03 Long Answer type questions carrying 05 marks each.
7. Section E has 02 questions carrying 04 marks each. One internal choice is given in Q35
against part c only.
8. All programming questions are to be answered using Python Language

PART A
1 Arrange the memory in ascending order 1
TB, MB, GB, KB, B
2 What will be the value of the following Python expression? 1
4+3%5
3 Which of the following characters is used to give single- 1
line comments in Python?
a) //
b) #
c) !
d) /*
4 What will be the output of the following Python code? 1

x = [1,4,5,3]
for i in x:
print(i)

5 To add a new element to a list we use which Python 1


command?
a) list1.addEnd(5)
b) list1.addLast(5)
c) list1.append(5)
d) list1.add(5)
6 What will be the output of the following Python statement? 1

>>>[1]]+[3,4]
a) [1,4,3]

b) [[1],[3,4]]

c) [1,3,4]

7 1. names1 = ['Amir', 'Bala', 'Chales'] 1


2.
3. if 'amir' in names1:
4. print(1)
5. else:
6. print(2)

a) None
b) 1
c) 2
d) Error

8 What is the full form of DBMS? 1


a) Data of Binary Management System
b) Database Management System
c) Database Management Service
d) Data Backup Management System
9 Which of the following provides the ability to query 1
information from the database and insert tuples into, delete
tuples from, and modify tuples in the database?
DML(Data Manipulation Language)
DDL(Data Definition Language)
Query
Relational Schema
10 Which one of the following attribute can be taken as a 1
primary key?
a) Name
b) Street
c) Id
d) Department
11 What is true about Unique and primary key? 1
a) Unique can have multiple NULL values but Primary
can’t have.
b) Unique can have single NULL value but Primary can’t
have even single.
c) Both can have duplicate values
d) None of the Mentioned
12 Rows of a relation are known as the _______. 1
a) Degree
b) Tuples
c) Entity
d) All of the above

13 Which one of the following is a type of Data Manipulation 1


Command?
a) Create
b) Alter
c) Delete
d) All of the above

14 A Group of columns serving as a primary key are known 1


as:
a. Primary key
b. Candidate key
c. Foreign key
d. None of the above
15 In the query mentioned below which keyword has to be 1
inserted
Insert into employee _______(1002,”kaushik”,2000)

a. Table
b. Values
c. Relation
d. field
16 Distributed computing system formed by a network of 1
independent computers is known as___________
computing
a. Cloud
b. Grid
c. AI
d. Smart
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
17 Assertion: Cloud computing is the internet based 1
computing
Reasoning: It enables uses to be able to provision, monitor
and manage the computing resources
18 Assertion: List is mutable data type 1
Reasoning: We can update the values of list elements like
l[1]=5
PART B

19 Define the software and write the classification of software 2


Or
Define the computer memory and write the classification
of memory
20 Predict the error 2
x= int(“Enter value of x:”)
for in range [0,10]:
if x=y
print( x + y)
else:
Print( x‐y)
21 Predict the output 2
a. for i in range (10,6,-2):
print (i* 2)
b. for x in range (10,20):
if (x%2==0) :
continue
print (x)

22 Consider a table student 2

rollno name city 10marks


1 anu tiruvallur 90
2 mohini chennai 56
3 zafreen bangalore 98
4 christia rameshwara 70
m

Write the SQL Query to


1. Insert one more record with rollno 5, name mohan,
city chennai and 10marks 89
2. Display the students with names starting with ‘a’
23 Define DDL and DML statements. Give two examples of 2
each
Or
Categorize the following into DDL or DML
Create
Alter
Select
Update

24 I. What do you mean by volatile memory. Give one 2


example
II. What do you mean by compiler and interpretor

25 A school has a rule that each student must participate 2


in a sports activity. So each one should give only one
preference for sports activity. Suppose there are five
students in a class, each having a unique roll number.
The class representative has prepared a list of sports
preferences as shown below. Answer the following:

Table: Sports Preferences

Roll_no Preference

9 Cricket

13 Football

17 Badminton

21 Hockey

24 NULL

NULL Kabaddi

I. What is the degree and cardinality of the table


II. Can Roll_No be the primary key. Give the reason for
the same
SECTION C

26 What will be the output produced by the following code: 3


lst1=[0,1,[2]]
lst1[2][0]=3
print(lst1)
lst1[2].append(4)
print(lst1)
lst1[2]=2
print(lst1)
27 Write a python program which takes a list from the user 3
and finds the average of the elements of the list
28 Based on table STUDENT given here, 3

RollNo Name Gender


1 Abhishek M
2 Anamika F

write suitable SQL queries for the following:


i. Display the whole table
ii. Display the Name column of the table
iii. Display the name of females
29 I. Give 2 examples of input and output devices 3
II. What is cache memory
III What is the difference between RAM and ROM

Or
I. What do you mean by operating system
II. Write 2 functions of operating system
Iii. give 2 examples of operating systems
30 Define the following: 3
a. Machine Learning
b. Blockchain technology
c. Internet of Things

Or

Write a short note on smart cities


SECTION D

31 Consider the following dictionary: 5


statecapital={“Assam”:”Guwahati”,”Bihar”:”patna”,”Rajas
than”:”Jaipur”}

Find the output of following:


a. print(statecapital.keys())
b. print(statecapital.values())
c. print(len(statecapital)
d. print(statecapital.get(“Bihar”))
e. print(“Maharashtra” in statecapital)

Or

I. Define dictionary with an example


Ii Write the code to take a dictionary from user
Iii Write a code to add an element to the dictionary
Iv write the code to find the number of elements in the
dictionary
V Write the code to find the values of the dictionary

32 Consider the table Library and the queries, predict the 5


output:

Title Author Pub Price


Data Lipschutz McGraw 217
Structure
Computer Sumita BPB 75
Science Arora
DBMS Palmer BPB 350
OS Norton PHI 175

I. select * from Library where Title like “O%”


II select * from Library where Price>100
III select distinct(Pub) from Library
IV select Author from Library
V select Title from Library where Price >200

33 Write the SQL Queries to perform the following: 5


1. Create the database school
2. Select the database school
3. Create a table student inside the school database
having studentid, studentname, and gender
4. Insert 1 record in the table student
5. Display all the records from the table student

Or

Write the SQL queries to perform the following:


1. Create a table employee with employeeid,
employeename, designation and salary
2. Insert 2 records in the table
3. Select all the records from the table employee
4. Select two columns employeename and designation
from the table employee
5. Select all the details of employee whose employeeid
is 1

SECTION E

34 Write the python program to do the following: 1+1+2


I. Which accepts 3 marks from the user
II. Find the average of marks
III. If the average marks is greater than 50, print it is
greater than 50 otherwise print it is less than 50
marks

Or
Write a python program which
I takes the selling price and cost price from the user
Ii find whether it is profit or loss
Iii if it is profit, display the total profit and if it is loss,
display the total loss

35 Define the following: 4


I. primary key
II. Candidate key
III. Tuple
IV Attribute
Or
Answer the following:
I. what do you mean by constraints
II. Name any two constraints
III. What is a database
IV. why do we need dbms
KENDRIYA VIDYALAYA SANGATHAN CHENNAI REGION
SAMPLE QUESTION PAPER
CLASS XI INFORMATICS PRACTICES (065)
TIME: 3 HOURS 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.
5. Section C has 05 Short Answer type questions carrying 03 marks each.
6. Section D has 03 Long Answer type questions carrying 05 marks each.
7. Section E has 02 questions carrying 04 marks each. One internal choice is given in Q35
against part c only.
8. All programming questions are to be answered using Python Language

PART A
1 Arrange the memory in ascending order 1
TB, MB, GB, KB, B

Ans: B, KB, MB, GB, TB


2 What will be the value of the following Python expression? 1
4+3%5

Ans: 7
3 Which of the following characters is used to give single-line 1
comments in Python?
a) //
b) #
c) !
d) /*

Ans: b #
4 What will be the output of the following Python code? 1

x = [1,4,5,3]
for i in x:
print(i)

Ans: 1
4
5
3
5 To add a new element to a list we use which Python 1
command?
a) list1.addEnd(5)
b) list1.addLast(5)
c) list1.append(5)
d) list1.add(5)

Ans: c list1.append(5)
6 What will be the output of the following Python statement? 1

>>>[1]]+[3,4]
a) [1,4,3]

b) [[1],[3,4]]

c) [1,3,4]

Ans: [1,3,4]
7 1. names1 = ['Amir', 'Bala', 'Chales'] 1
2.
3. if 'amir' in names1:
4. print(1)
5. else:
6. print(2)

a) None
b) 1
c) 2
d) Error

Ans: c 2
8 What is the full form of DBMS? 1
a) Data of Binary Management System
b) Database Management System
c) Database Management Service
d) Data Backup Management System

Ans b Database Management System


9 Which of the following provides the ability to query 1
information from the database and insert tuples into, delete
tuples from, and modify tuples in the database?

a. DML(Data Manipulation Language)

b. DDL(Data Definition Language)

c. Query

d. Relational Schema

Ans: DML

10 Which one of the following attribute can be taken as a 1


primary key?
a) Name
b) Street
c) Id
d) Department

Ans c Id
11 What is true about Unique and primary key? 1
a) Unique can have multiple NULL values but Primary can’t
have.
b) Unique can have single NULL value but Primary can’t
have even single.
c) Both can have duplicate values
d) None of the Mentioned

Ans b
12 1
Rows of a relation are known as the _______.

a. Degree

b. Tuples

c. Entity

d. All of the above

Ans b
13 1
Which one of the following is a type of Data Manipulation
Command?

a. Create

b. Alter

c. Delete

d. All of the above

Ans c delete
14 A Group of columns serving as a primary key are known as: 1
a. Primary key
b. Candidate key
c. Foreign key
d. None of the above
Ans b candidate key
15 In the query mentioned below which keyword has to be 1
inserted
Insert into employee _______(1002,”kaushik”,2000)

a. Table
b. Values
c. Relation
d. field
Ans b values
16 Distributed computing system formed by a network of 1
independent computers is known as___________ computing
a. Cloud
b. Grid
c. AI
d. Smart
Ans: cloud
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

17 Assertion: Cloud computing is the internet based computing 1


Reasoning: It enables uses to be able to provision, monitor
and manage the computing resources

Ans: ii
18 Assertion: List is mutable data type 1
Reasoning: We can update the values of list elements like
l[1]=5

Ans i

PART B

19 Define the software and write the classification of software 1


Or marks
Define the computer memory and write the classification of for
memory each
correct
answer

20 Predict the error 1/2


x= int(“Enter value of x:”) marks
for in range [0,10]: for
if x=y input
print( x + y)
else: 1/2
Print( x‐y) marks
for ==
in
checki
ng

½ for
range

½ for
semico
lon
21 Predict the output 1
a. for i in range (10,6,-2): marks
for
print (i* 2) each
Ans: 20 correct
answer
16 r

for x in range (10,20):


if (x%2==0) :
continue
print (x)
Ans: 11
13
15
17
19

22 Consider a table student 1


marks
for
rollno name city 10marks each
correct
1 anu tiruvallur 90 query

2 mohini chennai 56
3 zafreen bangalore 98
4 christia rameshwara 70
m

Write the SQL Query to


1. Insert one more record with rollno 5, name mohan,
city chennai and 10marks 89
2. Display the students with names starting with ‘a’
23 Define DML statements. Give two examples 1 mark
Or for
Categorize the following into DDL or DML each
Create correct
Alter answer
Select
Update Or

½
marks
for
each
correct
classifi
caion
24 I. What do you mean by volatile memory. Give one example 1
II. What do you mean by compiler and interpretor marks
for
each
correct
answer
25 A school has a rule that each student must participate in 1
a sports activity. So each one should give only one marks
preference for sports activity. Suppose there are five for
students in a class, each having a unique roll number. each
The class representative has prepared a list of sports correct
preferences as shown below. Answer the following answer

Table: Sports Preferences

Roll_no Preference

9 Cricket

13 Football

17 Badminton

21 Hockey

24 NULL

NULL Kabaddi

I. What is the degree and cardinality of the table


II. Can Roll_No be the primary key. Give the reason for the
same
SECTION C

26 What will be the output produced by the following code: 1


marks
lst1=[0,1,[2]]
for
lst1[2][0]=3 each
correct
print(lst1)
print
lst1[2].append(4)
print(lst1)
lst1[2]=2
print(lst1)

Ans:
[0, 1, [3]]
[0, 1, [3, 4]]
[0, 1, 2]

27 Write a python program which takes a list from the user and 1
finds the average of the elements of the list marks
for
input
1
marks
for
adding
1
marks
for
averag
e
28 Based on table STUDENT given here, 1
marks
for
RollNo Name Gender each
correct
1 Abhishek M answer
2 Anamika F

write suitable SQL queries for the following:


i. Display the whole table
ii. Display the Name column of the table
iii. Display the name of females
29 I. Give 2 examples of input and output devices 1
II. What is cache memory marks
III What is the difference between RAM and ROM for
each
Or correct
I. What do you mean by operating system answer
II. Write 2 functions of operating system
Iii. give 2 examples of operating systems
30 Define the following: 1
a. Machine Learning marks
b. Blockchain technology for
c. Internet of Things each
Or
Or 1
marks
Write a short note on smart cities for
definiti
on
2
marks
for
charact
eristics

SECTION D

31 Consider the following dictionary: 1


statecapital={“Assam”:”Guwahati”,”Bihar”:”patna”,”Rajast marks
han”:”Jaipur”} for
each
Find the output of following: correct
a. print(statecapital.keys()) answer
b. print(statecapital.values())
c. print(len(statecapital)
d. print(statecapital.get(“Bihar”))
e. print(“Maharashtra” in statecapital)

Ans: dict_keys(['Assam', 'Bihar', 'Rajasthan'])


dict_values(['Guwahati', 'patna', 'Jaipur'])
3
patna
False
Or

I. Define dictionary with an example


Ii Write the code to take a dictionary from user
Iii Write a code to add an element to the dictionary
Iv write the code to find the number of elements in the
dictionary
V Write the code to find the values of the dictionary

32 Consider the table Library and the queries, predict the 1


output: marks
for
Title Author Pub Price each
correct
Data Lipschutz McGraw 217 output
Structure
Computer Sumita BPB 75
Science Arora
DBMS Palmer BPB 350
OS Norton PHI 175

I. select * from Library where Title like “O%”


II select * from Library where Price>100
III select distinct(Pub) from Library
IV select Author from Library
V select Title from Library where Price >200

33 Write the SQL Queries to perform the following: 1


1. Create the database school marks
2. Select the database school for
3. Create a table student inside the school database each
having studentid, studentname, and gender correct
4. Insert 1 record in the table student query
5. Display all the records from the table student

Or
Write the SQL queries to perform the following:
1. Create a table employee with employeeid,
employeename, designation and salary
2. Insert 2 records in the table
3. Select all the records from the table employee
4. Select two columns employeename and designation
from the table employee
5. Select all the details of employee whose employeeid is
1

SECTION E

34 Write the python program to do the following: 1


I. Which accepts 3 marks from the user (input marks
statements) +1
II. Find the average of marks (add and divide by 3) marks
III. If the average marks is greater than 50, print it is +2
greater than 50 otherwise print it is less than 50 marks marks
1 marks for if else and 1 marks for logic

Or
Write a python program which
I takes the selling price and cost price from the user
Ii find whether it is profit or loss
Iii if it is profit, display the total profit and if it is loss,
display the total loss

35 Define the following: 1 mark


I. primary key for
II. Candidate key each
III. Tuple correct
IV Attribute answe
R
Or
Answer the following:
I. what do you mean by constraints
II. Name any two constraints
III. What is a database
IV. why do we need dbms

You might also like