You are on page 1of 157

KENDRIYA VIDYALAYA SANGATHAN

REGIONAL OFFICE RAIPUR


STUDY MATERIAL AND SAMPLE PAPER
SESSION 2022-23
For
Class – XI Subject- Informatics Practices

SUBJECT CO-ORDINATION BY

Mrs. Sandhya Lakra,


Principal, KV No. 4 Korba

CONTENT TEAM

1. Mr. Manish Kumar Gupta, PGT CS, KV Rajnandgaon


2. Mrs. Anshu Sinha, PGT CS, KV No. 3 Kusmunda
3. Mrs. Shalini Singh, PGT CS, KV Chirimiri
4. Mrs. Tara Yadav, PGT CS, KV Bilaspur
5. Ms. Priyanka Kulshresta, PGT CS, KV Dongargarh
6. Mr. Nitin Sharma, PGT CS, KV Bacheli
7. Mr. Ravi Kumar, PGT CS KV Baikuntpur

COMPILATION, REVIEW & VETTING BY

Mr. Surendra Kumar Vishwarkarma, PGT CS, KV No. 4 Korba


KENDRIYA VIDYALAYA SANGATHAN
RAIPUR REGION
BLUEPRINT – MODEL TEST PAPER
INFORMATICS PRACTICES (065) – 2022-23
Class XI

Unit No Unit Name Marks

1 Introduction to computer system 10

2 Introduction to Python 25

Database concepts and the


3 30
Structured Query Language

4 Introduction to Emerging Trends 5

TOTAL - 70
What is Computer?
Computer is an advanced electronic device that takes raw data as input from the user and processes these data
under the control of set of instructions (called program) and gives the result (output) and saves output for the
future use. It can process both numerical and non-numerical (arithmetic and logical) calculations.
nput (Data):
Input is the raw information entered into a computer from the input devices. It is the collection of letters,
numbers, images etc.
Computer System
All of the components of a computer system can be summarized with the simple equations. COMPUTER
SYSTEM = HARDWARE + SOFTWARE+ USER
• Hardware = Internal Devices + Peripheral Devices
All physical parts of the computer (or everything that we can touch) are known as Hardware.
• Software = Programs
Software gives “intelligence” to the computer.
• USER = Person, who operates computer.
Generation of computer:
First Generation (1940-56):
The first generation computers used vaccum tubes & machine language was used for giving the instructions.
These computer were large in size & their programming was difficult task. The electricity consumption was
very high. Some computers of this generation are ENIAC, EDVAC, EDSAC & UNIVAC-1.
Second Generation(1956-63):
In 2nd generation computers, vaccum tubes were replaced by transistors. They required only 1/10 of power
required by tubes. This generation computers generated less heat & were reliable. The first operating system
developed in this generation.
The Third Generation(1964-71):
The 3rd generation computers replaced transistors with Integrated circuit known as chip. From Small scale
integrated circuits which had 10 transistors per chip, technology developed to MSI circuits with 100 transistors
per chip. These computers were smaller, faster & more reliable. High level languages invented in this
generation.
The fourth Generation(1972- present):
LSI & VLSI were used in this generation. As a result microprocessors came into existence. The computers
using this technology known to be Micro Computers. High capacity hard disk were invented. There is great
development in data communication.
The Fifth Generation (Present & Beyond):
Fifth generation computing devices, based on artificial intelligence, are still in development, though there are
some applications, such as voice recognition, that are being used today. The use of parallel processing and
superconductors is helping to make artificial intelligence a reality. Quantum computation and molecular and
nanotechnology will radically change the face of computers in years to come.
ARCHITECTURE OF COMPUTER

Input Devices: Those devices which help to enter data into computer system. Eg. Keyboad, Mouse,
Touchscreen, Barcode Reader, Scanner, MICR, OMR etc.
Output Devices: Those devices which help to display the processed information. Eg. Monitor, Printer, Plotter,
Projector
CENTRAL PROCESSING UNIT (CPU)
The main component to make a computer operate is the computer chip or microprocessor. This is referred to as
the Central Processing Unit (CPU) and is housed in the computer case. Together, they are also called the CPU.
It performs arithmetic and logic operations. The CPU (Central Processing Unit) is the device that interprets and
executes instructions.
Memory: It facilitates the remembrance power to computer system. It refers to the physical devices used to
store programs (sequences of instructions) or data (e.g. program state information) on a temporary or
permanent basis for use in a computer or other digital electronic device. The term primary memory is used for
the information in physical systems which are fast (i.e. RAM), as a distinction from secondary memory, which
are physical devices for program and data storage which are slow to access but offer higher memory capacity.
Primary memory stored on secondary memory is called virtual memory. Primary Memory can be categorized
as Volatile Memory & Non-Volatile Memory.
Volatile memory(RAM)
Volatile memory is computer memory that requires power to maintain the stored information. Most modern
semiconductor volatile memory is either Static RAM or dynamic RAM.
SRAM retains its contents as long as the power is connected and is easy to interface to but uses six transistors
per bit.
Non Volatile Memory (ROM)
Non-volatile memory is computer memory that can retain the stored information even when not powered.
Examples of non-volatile memory are flash memory and ROM/PROM/EPROM/EEPROM memory (used for
firmware such as boot programs).

Cache Memory:
Cache memory is random access memory (RAM) that a computer microprocessor can access more quickly
than it can access regular RAM. As the microprocessor processes data, it looks first in the cache memory and if
it finds the data there (from a previous reading of data), it does not have to do the more time-consuming
reading of data from larger memory. It is of two types- L1 cache is on the same chip as the microprocessor. L2
is usually a separate static RAM (SRAM) chip.
Secondary Memory:
A. Hard Disk (Local Disk)
B. Optical Disks: CD-R, CD-RW, DVD-R, DVD-RW
C. Pen Drive
D. Floppy Disks
F. Memory Cards
G. External Hard Disk
H. Blu Ray Disk
Units of Memory:
The smallest unit is bit, which mean either 0 or 1.
1 bit = 0 or 1
1 Byte = 8 bit
1 Nibble = 4 bit
1 Kilo Byte = 1024 Byte= 210 Byte
1 Mega Byte = 1024 KB= 210 KB
1 Gega Byte = 1024 MB= 210 MB
1 Tera Byte = 1024 GB= 210 GB
1 Peta Byte =1024 TB= 210 TB
1 Exa Byte =1024 PB= 210 PB
1 Zetta Byte = 1024 EB= 210 EB
1 Yotta Byte = 1024 ZB= 210 ZB
Software
Software, simply are the computer programs. The instructions given to the computer in the form of a program
is called Software. Software is the set of programs, which are used for different purposes. All the programs
used in computer to perform specific task is called Software.
Types of software
1. System software:
a) Operating System Software
DOS, Windows XP, Windows Vista, Unix/Linux, MAC/OS X etc.
b) Utility Software
Windows Explorer (File/Folder Management), Compression Tool, Anti-Virus Utilities, Disk Defragmentation,
Disk Clean, BackUp, WinZip, WinRAR etc…
c) Language Processors
Compiler, Interpreter and Assembler
2. Application software:
a) Package Software/General Purpose software
Ms. Office 2003, Ms. Office 2007, Macromedia (Dreamweaver, Flash, Freehand), Adobe (PageMaker,
PhotoShop)

b) Tailored or Customized Software


School Management system, Inventory Management System, Payroll system, financial system etc.
Operating system
Operating system is a platform between hardware and user which is responsible for the management and
coordination of activities and the sharing of the resources of a computer. It hosts the several applications that
run on a computer and handles the operations of computer hardware.
Functions of operating System:
• Processor Management
• Memory Management
• File Management
• Device Management
Types of Operating System:
• Real-time Operating System: It is a multitasking operating system that aims at executing real-time
applications. Example of Use: e.g. control of nuclear power plants, oil refining, chemical processing and traffic
control systems, air
• Single User Systems: Provides a platform for only one user at a time. They are popularly associated with
Desk Top operating system which run on standalone systems where no user accounts are required. Example:
DOS.
• Multi User Systems: Provides regulated access for a number of users by maintaining a database of known
users. Refers to computer systems that support two or more simultaneous users. Another term for multi-user is
time sharing. Ex: All mainframes are multi-user systems. Example: Unix
• Multi-tasking and Single-tasking Operating Systems: When a single program is allowed to run at a time,
the system is grouped under the single-tasking system category, while in case the operating system allows for
execution of multiple tasks at a time, it is classified as a multitasking operating system.
• Distributed Operating System: An operating system that manages a group of independent computers and
makes them appear to be a single computer is known as a distributed operating system. Distributed
computations are carried out on more than one machine. When computers in a group work in cooperation, they
make a distributed system.
LANGUAGE PROCESSORS: Since a computer hardware is capable of understanding only machine level
instructions, So it is necessary to convert the HLL into Machine Level Language. There are three Language
processors:
A. Compiler: It is translator which coverts the HLL language into machine language in one go. A Source
program in High Level Language get converted into Object Program in Machine Level Language.
B. Interpreter: It is a translator which converts the HLL language into machine language line by line. It takes
one statement of HLL and converts it into machine code which is immediately executed. It eliminate the need
of separate compilation/run. However, It is slow in processing as compare to compiler.
C. Assembler: It translate the assembly language into machine code.
Introduction to Python
INTRODUCTION TO PYTHON PROGRAMMING LANGUAGE
Python is an interesting, general purpose, high-level, interpreted programming language

● It is developed by Guido Van Rossum in February 1991.

● It is an easy to learn, playful language with powerful and distinctive object oriented language (OOP)
features.
● Python is a case-sensitive language (Uppercase and Lowercase letters are treated differently)

ADVANTAGES OF PYTHON

● Compact and very easy to use language

● Simple syntax rules( programmer friendly)

● Object Oriented language (OOP)

● High level Interpreted language

● Free and Open Source Language

● Complete and expressive language

● Cross-platform language

● Diverse language with wide applications

LIMITATIONS of Python

● Slower than many languages


Python programs are first semi-compiled and then interpreted which makes it slower. But, it has faster
development times due to lesser syntax writing
● Lesser libraries than other programming languages
Python has less library support than others
● Weak in Data Type-Binding
a variable can be declared using multiple data types which is a Type-mismatch situation
● Not easily convertible
tough to convert from Python to other programming languages like C++ as others have a strong syntax
About IDE (Integrated Development Environment)
An IDE (or Integrated Development Environment) is a program dedicated to software development. As the
name implies, IDEs integrate several tools specifically designed for software development.
Python Interpreters : Python Charm IDE ,Anaconda Distribution for Python IDE ,CPython.
MODES of PYTHON
There are two distinct modes of Python:

● INTERACTIVE MODE

● SCRIPT MODE

STRUCTURE OF A PROGRAM IN PYTHON

(COMPONENTS/ STRUCTURE/ BAREBONES) OF A PYTHON PROGRAM


EXPRESSIONS: Any legal combination of symbols that represent a value.
STATEMENTS: Any programming instruction that does some work or some action that takes place.
FUNCTIONS: A code that can be executed again and again (can be reused) by calling with the name of the
function wherever needed in the program.
BLOCKS AND INDENTATIONS: A group of statements which are part of another statement or a function
are called block or code-block. Indentation (spaces/gaps )in front of the statements create block. The
statements under the same block must be indented at the same level of indentation. Indentation without reason
in a statement raises error in a program.
COMMENTS: Comments are the non-executable statements which are ignored by the language compiler or
interpreter. It is read by the programmers and given by them for the convenience of the
programmer.Comments are the additional readable information which are given for the understanding of the
user and gives information about the source code.
Comments are of two types: 1) SINGLE LINE COMMENT 2) MULTILINE COMMENT

Comments enclosed in triple (""") or triple apostrophe(' ' ') are called docstrings. We can use either triple-
apostrophe ar triple quotes(""") to write docstrings.
PYTHON CHARACTER SET
A set of valid characters recognized by python. Python uses the traditional ASCII character set. The latest
version recognizes the Unicode character set. The ASCII character set is a subset of the Unicode character set.
• Letters :- A-Z , a-z
• Digits:- 0-9
• Special symbols :- Special symbol available over keyboard
• White spaces:- blank space, tab, carriage return, new line form feed
• Other characters:- Unicode
TOKENS
Smallest individual unit in a program is called a token.
They are:

● Keywords
● Identifiers

● Literals

● Punctuators

● Operators

KEYWORDS: Keywords are the words that convey a special meaning to the language compiler/interpreter.
They are reserved for special purpose and must not be used as normal identifier names.

IDENTIFIERS: Identifiers are the fundamental building blocks of a program which are used to identify a
variable, function name, class name, module name or any object.
RULES OF WRITING AN IDENTIFIER

● An identifier starts with a letter A to Z, a to z or an underscore ( _ ) followed byzero or more letters,


underscores and digits (0 to 9).
● Identifier name canNOT start with a digit.

● Python does NOT allow special characters other than underscore ( _ ).

● Identifier must NOT be a keyword of Python.

● Python is a case sensitive programming language that is uppercase letters (capital letters) and lowercase
letters (small letters) are treated differently.
eg. Marks and marks are two different identifiers in Python.
LITERALS:
Literals are data items that have a fixed value. Python allows several kind of literals:
• Numeric Literals:• Int (signed integers) :Positive or
Negative whole numbers with no decimal point Eg.
10, -96, 1234, 0
• Floating point/Real values :float represent real
numbers and are written with a decimal point dividing
the integer and fractional part.Eg 2.0,54.7,-12.0,-
0.075, .4
• Complex (complex numbers) : a+bj , where

a and b are floats and J(or j) represents -1 ,

which is an imaginary number. a is the real


part and b is the imaginary part of the
number.

Boolean Literals:True and False are the only two


BooleanValues

Special Literal None:


None literal represents absence of a value.
That is why nothing is printed
for the value of b.

String Literal
String literal is a sequence of characters
surrounded by quotes (single or double or
triple)
String literals can be written in either single
quote ‘ ’ or double quote “ ”
ESCAPE SEQUENCES / Non-graphic characters

PUNCTUATORS: Punctuators are certain symbols which are used in the programming languages to organize
programming sentence and structures, and indicate the rhythm and emphasis of expressions, statements,and
program structure.
‘ “ # \ ( ) [] {} @ , : . ` =
OPERATORS: Operators are tokens that trigger some computation/ action when applied to variables and other
objects in an expression.
UNARY OPERATORS:
Unary + , Unary - ,~ Bitwise complement , not logical negation
BINARY OPERATORS:
ARITHMETIC OPERATORS: +,-,*,/,%,//,**
AUGMENTED ASSIGNMENT OPERATORS: = , +=,-=,*=,/=,%=,//=,**=
RELATIONAL OPERATORS: >,<,>=,<=,==,!=
LOGICAL OPERATORS: and , or, not
MEMBERSHIP OPERATORS: in, not in
IDENTITY OPERATORS: is, is not
BITWISE OPERATORS: &(Bitwise AND), ^(Bitwise XOR), |(Bitwise OR)
DATA TYPES : The kind of data for handling the data used in a program code is the data type.

MUTABLE AND IMMUTABLE TYPES:


• Mutable types:The mutable types are those whose values can be changed in place.
Only three types are mutable in Python.
These are: Lists, dictionaries and sets.
• Immutable types:The immutable types are those that can never change their value in place.
In python , the following are the immutable types:
Integers, floating point numbers, booleans, strings, tuples
DATA TYPE: Number in Python
It is used to store numeric values.
Python has three numeric types:
1. Integers
2. Floating point numbers
3. Complex numbers.

DATA TYPE: NUMBER 🡪 Integer


Integer or int are positive or negative numbers
with no decimal point. Integers in Python are
of unlimited size.

Type Conversion to Integer , int( ) function


int() function converts any data type to integer.

DATA TYPE: NUMBER 🡪 Float


Float are positive or negative real numbers
with decimal point. Some Floating point
number examples: 4.5, 2.0, -38.9,-18.0

Type Conversion to Float , float( ) function


float() function converts any data type to
floating point numbers.

DATA TYPE: Complex Number


Complex numbers are combination of a real and imaginary part.

• Complex numbers are in the form of X+Yj , where X is a real part and Y is imaginary part. We know, in mathematic

• Using complex() function , we can also create complex numbers.

DATA TYPE: Boolean


Boolean takes any two values, either True or False
• Every integer number, float number or complex number whether negative or positive
takes a Boolean value True.
• Value 0 , 0.0 , 0+0j are considered False in Boolean.
DATA TYPE: STRING in Python
A string is a sequence of characters. In python, we can create string using single('') or
double quotes(""). Both are same in python.

NOTE:- The index (also called subscript) is the numbered position of a letter in the string.
In python, indices begin from 0,1,2,…. upto (length-1) in the forward direction and -1,-2,-
3,….. (-length) in the backward direction. where length is the length of the string.
DATA TYPE: working with STRING examples
Python allows to have two string types:
1) Single line strings (Basic strings) Text
enclosed in single quote ‘India’ or in double
quotes “Bharat” are normally single line
strings i.e. they must terminate in one line.

2) Multiline strings Text spread across multiple lines as one single string. Two ways of
treating multiline strings:-
i)By adding a backslash at the end of normal (ii) By typing the text in triple quotation or
single quote/double quote strings. apostrophe mark (No backslash needed at
the end of line)

DATA TYPE: LIST in Python


A list in Python represents a list of comma-separated values of any data type between
square brackets e.g. following are some lists: LIST is mutable- one can change/add/delete a
list’s element
DATA TYPE: TUPLE in Python
Tuples are represented as list of comma-separated values of any data type within
parentheses. Some examples of tuples: Tuple is immutable - one cannot change the values
of a tuple.

DATA TYPE: DICTIONARY in Python


Dictionary data type is an unordered set of comma-separated key: value pairs, within { } ,
with the requirement that within a dictionary, no two keys can be the same (i.e. there are
unique keys within a dictionary). Some examples of Dictionary:

VARIABLES
Variable is a name (Named Labels) given to
a memory location that refers to a value and
whose values can be used and processed
during program run. Python is a type infer
language that means you don't need to
specify the datatype of variable. Python
automatically get variable datatype
depending upon the value assigned to the
variable.

ASSIGNING VALUES TO VARIABLES


L-VALUE and R-VALUE OF A VARIABLE
Lvalue: Expressions which can be given on Rvalue: Expressions which can come on the
the LHS(Left Hand Side) of an assignment. RHS(Right hand side) of an assignment.

VARIABLE INTERNALS

id of an object (Identity) The id of an object is generally the memory location of the object. Although id is
implementation dependent but in most implementations it returns the memory location of the object. id() is a
built-in function that returns the id of an object.
Consider, the following code
INPUT through input() function and OUTPUT through print() statement
To take input from the user, input() function is used. input() function takes values in string data type. Syntax of
input Function
input()
To print/display the contents on the console(monitor screen), print() function is used.
Syntax of print Function
print(expression/variable)
sep and end parameters of print() function.
sep is the separator parameter which separates the strings given in print function. The default separator (in the
absence of sep) is a space ‘ ’.
end parameter denotes the end character to be given at the last of the print() functions data/content.

DYNAMIC TYPING

A Variable pointing to a value of a


certain type, can be made to point to
a value/object of different type. This
is called Dynamic typing.

OPERATORS IN PYTHON
ARITHMETIC OPERATORS :
1) BINARY OPERATOR: requires two values(or operands) to calculate a final answer. A + B , where A
and B are Operands and + is the Operator.

2) UNARY OPERATOR : operators that act on one operand. -A , where A is the single Operand and - is
the Unary Operator
Unary +
If a=5 then +a means 5
If a=0 then +a means 0
If a=-4 then +a means -4

Unary –
If a=5 then –a means -5
If a=0 then –a means 0
If a=-4 then –a means 4
Augmented assignment operator

RELATIONAL OPERATORS
Relational Operators are used to compare the values of Left Hand Side (LHS) and Right Hand Side (RHS) of
the relational operator. Relational Operators always return Boolean value True or False
IDENTITY OPERATOR ( is , is not)
Is, is not are the operators which compares two objects in terms of their memory locations which is their
corresponding identity (id)

EQUALITY OPERATOR (==) and IDENTITY OPERATOR (is)


MEMBERSHIP OPERATOR
Membership operator tests for Membership in a sequence. Returns Boolean True or False.

LOGICAL OPERATORS or , and , not


Logical operators are used to perform logical operations on the given two variables or values.
or operator
and operator

not operator

OPERATOR PRECEDENCE
EXPRESSION: It is referred as a valid combination of operators and atoms. An expression is composed of one
or more operations.
Types of Expressions

DATA TYPE CONVERSIONS


The process of converting the value of one data type (integer, string, float, etc.) to another data type is called
type conversion.
Python has two kinds of type conversion.
I)IMPLICIT TYPE CONVERSION
In implicit type conversion, Python automatically converts one data type to another data type. This process
doesn’t need any user involvement.
EXPLICIT TYPE CONVERSION
In Explicit Type Conversion, user converts the data type of an object to required data type. We use the
predefined functions like int(),float(),str() etc.

Debugging
Due to errors, a program may not execute or may generate wrong output. :
i) Syntax errors
Like any programming language, Python has rules that determine how a program is to be written. This is
called syntax. If any syntax error is present, the interpreter shows error message(s) and stops the execution
there.
ii) Logical errors
A logical error/bug (called semantic error) does not stop execution but the program behaves incorrectly and
produces undesired /wrong output. Since the program interprets successfully even when logical errors are
present in it, it is sometimes difficult to identify these errors.
iii) Runtime errors
A runtime error causes abnormal termination of program while it is executing. Runtime error is when the
statement is correct syntactically, but the interpreter can not execute it.
The process of identifying and removing logical errors and runtime errors is called debugging. We need
to debug a program so that is can run successfully and generate the desired output.
CONTROL STATEMENTS
TYPES OF STATEMENTS in Python
Statements are the instructions given to computer to perform any kind of action viz. data movements,
making decision, repeating actions
Statements form the smallest executable unit within a program.
1) Empty statement/ null operation statement –
Statement which does nothing. It is as follows: e.g. pass
2) Simple statement (Single statement) –
Any single executable statement is a simple statement.
a=2
print(a)
3) Compound statement –
A group of statements executed as a unit is a compound statement. A compound statement has:
(i)a header line which begins with a keyword and ends with a colon.
(ii) a body consisting of one or more Python statements, each indented inside the header line. All the
statements are at the same level of indentation.

FLOW OF CONTROL
In a program, statement may be executed sequentially, selectively or iteratively.
Every program language provides or supports the following Types of constructs :
1) Sequence
2) Selection/Conditional/Decisional
🡪if, if-else, if-elif , nested-if
3) Iteration/Looping
🡪 for loop,while loop
1. SEQUENCE CONSTRUCT / SEQUENTIAL FLOW OF CONTROL
• Sequence construct means statement are executed
sequentially.
• It represents the default flow of statements.
• Every program begins with the first statement of the
program. When the final statement of the program is
executed, the program is done.
2. SELECTION / DECISIONAL / CONDITIONAL CONSTRUCT or SELECTION FLOW OF
CONTROL
The Selection construct means the execution of
statement(s) depending upon a condition-test.
• If a condition evaluates to true, a course-of-action(a set
of statements) is followed otherwise another course-of-
action (a different set of statements).
• It helps in making decision about which set-of-
statements is to be executed.
There are three types of decision making statement.
1. if statements
If statement must be provided with a condition.
If the condition is True, the indented body / block gets executed.
If the condition is False, then the control doesn’t execute the if body/block

2. if-else statements
3. Nested if-else statement

CHAPTER 7
FLOW OF CONTROL
Control statements are used to control the flow of execution depending upon the specified condition/logic.
There are three types of control statements.
1. Decision Making Statements
2. Iteration Statements (Loops)
3. Jump Statements (break, continue, pass)
Decision Making Statement Decision making statement used to control the flow of execution of program
depending upon condition. There are three types of decision-making statement.
1. if statements
2. if-else statements
3. Nested if-else statement
Decision Making Statement
1. if statements
An if statement is a programming conditional statement that, if proved true, performs a function or
displays information.

1. if statements
Using logical operator in if statement
x=1
y=2
if(x==1 and y==2):
print(‘condition matching the criteria')
Output :-
condition matching the criteria
-----------------------------------------------------------
a=100
if not(a == 20):
print('a is not equal to 20')
Output :-
a is not equal to 20

2. if-else Statements
If-else statement executes some code if the test expression is true (nonzero) and some

other code if the test expression is false.


3. Nested if-else statement
The nested if...else statement allows you to check for multiple test expressions and execute different
codes for more than two conditions.

To Check whether a number is positive,


negative, or zero.
number = int(input("Enter a number: ")
if number > 0:
print("Number is positive")
elif number < 0:
print("Number is negative")
else:
print("Number is zero")
Iteration Statements (Loops)
Iteration statements(loop) are used to execute a block of statements as long as the condition is true. Loops
statements are used when we need to run same code again and again. Python Iteration (Loops) statements are
of three types :-
1. While Loop 2. For Loop 3. Nested For Loops

1. While Loop
It is used to execute a block of statement as long as a given condition is true. And when the condition become
false, the control will come out of the loop. The condition is checked every time at the beginning of the loop.
Syntax
while (condition):
statement
[statements]
e.g.
x=1
while (x <= 4):
print(x)
x=x+1
2. For Loop
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. When all the items in the range are exhausted, the
statements within loop are not executed and Python interpreter starts executing the statements immediately
following the for loop. While using for loop, we should know in advance the number of times the loop will
execute.
for <control-variable> in <sequence/items in range>:
<statements inside body of the loop>
Program to print even numbers in a given sequence using for loop.
numbers = [1,2,3,4,5,6,7,8,9,10]
for num in numbers:
if (num % 2) == 0:
print(num,'is an even Number')
Output:
2 is an even Number
4 is an even Number
6 is an even Number
8 is an even Number
10 is an even Number

The range() Function


It is used to create a list containing a sequence of integers from the given start value upto stop value (excluding
stop value), with a difference of the given step value. If start value is not specified, by default the list starts
from 0. If step is also not specified, by default the value is incremented by 1 in each iteration. All parameters
of range() function must be integers. The step parameter can be a positive or a negative integer excluding zero
Print multiples of 10 for numbers in a range
for num in range(5):
if num > 0:
print(num * 10)
Output:
10
20
30
40
Nested Loops
A loop may contain another loop inside it. A loop inside another loop is called a nested loop.
for var1 in range(3):
print( "Iteration " + str(var1 + 1) + " of outer loop")
for var2 in range(2): #nested loop
print(var2 + 1)
print("Out of inner loop")
print("Out of outer loop")
Output:
Iteration 1 of outer loop
1
2
Out of inner loop
Iteration 2 of outer loop
1
2
Out of inner loop
Iteration 3 of outer loop
1
2
Out of inner loop
Out of outer loop

3. Jump Statements
Jump statements are used to transfer the program's control from one location to another. Means these are used
to alter the flow of a loop like - to skip a part of a loop or terminate a loop.
There are three types of jump statements used in python.
1.break 2.continue 3.pass

1. break :- It is used to terminate the loop.

for val in "string":


if val == "i":
break
print(val)
print("The end")
Output
s
t
r
The end

2.continue :- It is used to skip all the remaining statements in the loop and move controls back to the top of the
loop.

for val in "init":


if val == "i":
continue
print(val)
print("The end")

Output
n
t
The end

3. pass Statement :-This statement does nothing. It can be used when a statement is required syntactically but
the program requires no action.
Use in loop
while True:
pass # Busy-wait for keyboard interrupt (Ctrl+C)
Chapter 8
Lists
It is a collections of items and each item has its own index value. Index of first item is 0 and the last item is n-
1.Here n is number of items in a list.

Indexing of list

Creating a list
Lists are enclosed in square brackets [ ] and each item is
separated by a comma.
• LONG LIST
L = [1,2,3,44,55,66,77,88,99,4,3,5,6,7,88,100,300
12,13,14,56,78]
• NESTED LIST
L = [1,2,4,[100,200,300], 20]
The above code will create List L with 5 elements because it will
count [100,200,300] as one element. Now L[3] is list of 3
elements
To print if we write : L[1] it will display 2 and to print 200 we
have to write L[3][1] i.e. of 3rd index print 2nd value

Initializing a list
Passing value in list while declaring list is initializing of a list
e.g.
list1 = [‘English', ‘Hindi', 1997, 2000]
list2 = [11, 22, 33, 44, 55 ]
list3 = ["a", "b", "c", "d"]

We can use the following syntax:


• ListName = list(sequence)
For example (with string)
L1 = list(„welcome‟)
>>>L1
[“w‟,‟e‟,‟l‟,‟c‟,‟o‟,‟m‟,‟e‟]
• With tuple
T = (“A‟,‟B‟,‟C‟,‟D‟)
L1 = list(T)
>>>L2
[“A‟,‟B‟,‟C‟,‟D‟]

Blank list creation


A list can be created without element
List4=[ ]
Iterating/Traversing Through A List
List elements can be accessed using looping statement.
e.g.
list =[3,5,9]
for i in range(0, len(list)):
print(list[i])
Output
3
5
9

Basic List Operations

Joining List
Joining the 2 list is very easy, we can use (+) to join 2 or
more list
Fruits=[“apple”,”mango”,”grapes”]
Veg=[“spinach”,”carrot”,”potato”]
Fveg = Fruits + Veg
Fveg # [“apple”,”mango”,”grapes”,
“spinach”,”carrot”,”potato”]
Note: you can only add list with another list not
with int, float, complex, or string type.

Repeating or Replicating List


Repeating any list is very easy, we can use (*)
Fruits=[“apple”,”mango”,”grapes”]
Fruits*2 #[“apple”,”mango”,”grapes”,“apple”,”mango”,”grapes”]

Slicing of A List
List elements can be accessed in subparts.
e.g.
list =['I','N','D','I','A']
print(list[0:3])
print(list[3:])
print(list[:])
Output
['I', 'N', 'D']
['I', 'A']
['I', 'N', 'D', 'I', 'A']

Updating / Manipulating Lists


We can update single or multiple elements of lists by giving the slice on the left-hand side of the assignment
operator.
e.g.
list = ['English', 'Hindi', 94, 97]
print ("Value available at index 2 : ", list[2])
list[2:3] = 94,97
#list[2]=95 for single item update
print ("New value available at index 2 : ", list[2])
print ("New value available at index 3 : ", list[3])
Output
('Value available at index 2 : ', 94)
('New value available at index 2 : ', 95)
('New value available at index 3 : ', 97)

Add Item to A List

Append Method
append() method is used to add an Item to a List.
e.g.
list=[1,2]
print('list before append', list)
list.append(3)
print('list after append', list)
Output
('list before append', [1, 2])
('list after append', [1, 2, 3])

Extend() method

This function is also used for adding multiple items. With extend we can add only “list” to any list. Single
value cannot be added using extend().

For example
>>> subject1=["physics","chemistry","cs"]
>>> subject2=["english","maths"]
>>> subject1.extend(subject2)
>>> subject1
['physics', 'chemistry', 'cs', 'english', 'maths']
Note: here subject1 will add the contents of subject2 in it without
effecting subject2

append() allows to add only 1 items to a list, extend() can add multiple
items to a list.

>>> m1=[1,2,3,4]
>>> m2=[100,200]
>>> m1.append(5)
>>> m1
[1, 2, 3, 4, 5]
>>> m1.append(6,7)

Traceback (most recent call last):


File "<pyshell#16>", line 1, in <module>
m1.append(6,7)
TypeError: append() takes exactly one argument (2 given)

Add Two Lists


e.g.
list = [1,2]
list2 = [3,4]
list3 = list + list2
print(list3)
OUTPUT
[1,2,3,4]

Delete Item From A List


eg.
list=[1,2,3]
print('list before delete', list)
del list [1]
print('list after delete', list)
Output
('list before delete', [1, 2, 3])
('list after delete', [1, 3])
eg.
del list[0:2] # delete first two items
del list # delete entire list

Pop function to delete Item From List


We can also use pop() to remove single elements, not list slices. It not only deletes elements but also returns it.
Both del and pop() are same except pop() deletes and return the deleted value.
>>>Items = [10,20,30,40,50,60,70]
>>>Items.pop() # if no index is passed last item will be deleted
70
>>>Items.pop(2)
30
We can also store the deleted values by pop() as:
N1 = items.pop()
N2 = items.pop(3)
Remove function to remove an Item From List
pop() function is used to remove element whose position is given, but what if you know the value to be
removed, but you don’t know its index or position in the list? Answer is: remove() It remove the first
occurrence of given item from the list and return error if there is no such item in the list. It will not return any
value.

>>> L1.remove(5)
>>> L1
[1, 3, 7, 9, 11, 3, 7]
>>> L1.remove(3)
>>> L1
[1, 7, 9, 11, 3, 7]
>>> L1.remove(10)
Traceback (most recent call last):
File "<pyshell#26>", line 1, in <module>
L1.remove(10)
Value Error: list.remove(x): x not in list
Important methods and functions of List

Index Method
This function is used to get the index of first matched item from the list. It returns index value of item to
search.
For example
>>> L1=[10,20,30,40,50,20]
>>> L1.index(20)
1 # item first matched at index 1
Note: if we pass any element which is not in the list then index
function will return an error: Value Error: n is not in the list
>>> L1.index(100) #Error

Insert Method

This function is used to add elements to list like append() and extend(). However both append() and extend()
insert the element at the end of the list. But insert() allows us to add new elements anywhere in the list i.e. at
position of our choice.
ListObject.insert(Position,item)
>>> L1=[10,20,30,40,50]
>>> L1
[10, 20, 30, 40, 50]
>>> L1.insert(3,35)
>>> L1

[10, 20, 30, 35, 40, 50]

Clear Method
This function removes all the items from the list and the list becomes empty list.
List.clear()
>>> L1=[10,20,30,40,50]
>>> L1.clear()
>>> L1
[]
Note: unlike ‘del listname’ statement, clear( ) will removes only the elements and not the list. After clear( ) the
list object still exists as an empty list.

Count Method
This function returns the count of the item that you passed as an argument. If the given item is not in the list, it
returns zero.
>>> L1=[10,20,30,40,20,30,100]
>>> L1.count(20)
2
>>> L1.count(40)
1
>>> L1.count(11)
0
Reverse method
This function reverses the items in the list. This is done i place i.e. It wil not create a new list . The syntax to
use reverse() is:
>>> L1=[10,20,30,40,20,30,100]
>>> L1.reverse()
>>> L1
[100, 30, 20, 40, 30, 20, 10]
>>> L2=[11,22,33]
>>> L3=L2.reverse() #it will not return any value
>>> L3 # empty
[]

Sort Method
This function sorts the items of the list, by default increasing order. This is done «in place» i.e. It does not
create new list.
>>> L1=[10,1,7,20,8,9,2]
>>> L1.sort()
>>> L1
[1, 2, 7, 8, 9, 10, 20]
>>> L2=['g','e','a','c','b','d']
>>> L2.sort()
>>> L2
['a', 'b', 'c', 'd', 'e', 'g']
>>> L1.sort(reverse=True) # for descending order
>>>L1
[20, 10, 9, 8, 7, 2, 1]
Chapter 9
Dictionaries
Dictionary in Python holds data items in key-value pairs and Items are enclosed in curly brackets { }. dictionaries permit
faster access to data. Every key is separated from its value using a colon (:) sign. The key value pairs of a dictionary can
be accessed using the key. Keys are usually of string type and their values can be of any data type. In order to access
any value in the dictionary, we have to specify its key in square brackets [ ].

#create a dictionary

>>> dict1 = {'Fruit':'Apple', 'Climate':'Cold', 'Price(kg)':120}

>>> print(dict1)

{'Fruit': 'Apple', 'Climate': 'Cold','Price(kg)': 120}

#getting value by specifying a key

>>> print(dict1['Price(kg)'])

Creating a dictionary
Dict1 = {} # empty dictionary
DaysInMonth={"Jan":31,"Feb":28,"Mar":31,"Apr":31, "May":31,"Jun":30,"Jul":31,"Aug":31
"Sep":30,"Oct":31,"Nov":30,"Dec":31}
Accessing elements of Dictionary
 To access Dictionary elements we need the “key” >>>mydict={'empno':1,'name':'Shivam','dept':'sales','salary':25000}

>>> mydict['salary']

25000

Traversing a Dictionary
Python allows to apply “for” loop to traverse every element of dictionary based on their “key”. For loop will get every
key of dictionary and we can access every element based on their key.

mydict={'empno':1,'name':'Shivam','dept':'sales','salary':25000}

for key in mydict:

print(key,'=',mydict[key])

Accessing keys and values simultaneously


>>>mydict={'empno':1,'name':'Shivam','dept':'sales','salary':25000}
>>>mydict.keys()
dict_keys(['empno', 'name', 'dept', 'salary'])
>>>mydict.values()
dict_values([1, 'Shivam', 'sales', 25000])
We can convert the sequence returned by keys() and values() by using list()
as shown below:
>>> list(mydict.keys())
['empno', 'name', 'dept', 'salary']
>>> list(mydict.values())
[1, 'Shivam', 'sales', 25000]
Characteristics of a Dictionary
 Keys must be unique
Each key within dictionary must be unique. However two unique
keys can have same values.
>>> data={1:100, 2:200,3:300,4:200}
 Mutable
Like lists, dictionary are also mutable. We can change the value
of a certain “key” in place
Data[3]=400
>>>Data
So, to change value of dictionary the format is :
DictionaryName[“key” / key ]=new_value
You can not only change but you can add new key:value pair :
DictionaryName[“new key”]= value

Multiple ways of creating dictionaries


1. Initializing a Dictionary : in this method all the key:value pairs of dictionary are written collectively
separated by commas and enclosed in curly braces.
Student={“roll”:1,”name”:”Scott”,”Per”:90}
2. Adding key:value pair to an empty Dictionary : in this method we first create empty dictionary and then key:value
pair are added to it one pair at a time For example
Alphabets={} #Empty dictionary
Or
Alphabets = dict()
Now we will add new pair to this empty dictionary one by one
as:
Alphabets = {}
Alphabets[“a”]=“apple”
Alphabets[“b”]=“boy”
3. Creating dictionary from name and value pairs: using the dict() constructor of dictionary, you can also create
dictionary initialized from specified set of keys and values. There are multiple ways to provide keys and value to dict()
(i) Specific key:value pairs as keyword argument to dict()
Student=dict(roll=1,name=„scott‟,per=89)
(ii) Specify comma-separated key:value pairs
student = dict({„roll‟:1,‟name‟:‟scott‟,‟per‟:89})
(iii) Specify keys separately and corresponding values separately: in this method keys and values are enclosed
separately in parenthesis and are given as arguments to the zip() inside dict()
Emp = dict(zip((„empno‟,‟name‟,‟dept‟),(1,‟Scott‟,‟HR‟)))
(iv) Specify key:value pairs separately in form of sequences : in this method one list of tuple argument is passed to
dict(). These list or tuple contains individual key:value pair Example:
Emp = dict([„name‟,‟Victor‟],[„dept‟,‟sales‟])
Or
Emp = dict(((„name‟,‟john‟),(„dept‟,‟it‟),(„sal‟,1200)))
Nesting Dictionaries :
you can add dictionary as value inside a dictionary. This type of dictionary known as nested dictionary. For example:
Visitor ={“Name‟:‟Scott‟,‟Address‟:{“hno‟:‟11A/B‟,‟City‟:‟Kanpur‟,‟PinCode‟:‟208004‟},
“Name‟:‟Peter‟,‟Address‟:{“hno‟:‟11B/A‟,‟City‟:‟Kanpur‟,‟PinCode‟:‟208004‟}}
Deleting elements from Dictionary
del dictionaryName[“Key”]
>>> D1 = {1:10,2:20,3:30,4:40}
>>> del D1[2]
>>> D1
1:10,2:20,4:40
pop() elements from Dictionary
dictionaryName.pop([“Key”])
>>> D1 = {1:10,2:20,3:30,4:40}
>>> D1.pop(2)
1:10,2:20,4:40
>>> d1
{'a': 'apple', 'b': 'ball', 'c': 'caterpillar', 'd': 'dog'}
>>>d1.pop(“a‟)
>>> d1.pop(“d”,‟Not found‟)
Not found
Checking the existence of key
If you pass “value” of dictionary to search using “in” it will return False
>>>‟apple‟ in alpha
False
To search for a value we have to search in dict.values()
>>>‟apple‟ in alpha.values()

Pretty printing a Dictionary


We generally use print() to print the dictionary in python.
For e.g.
>>>alpha={"a":"apple","b":"boy","c":"cat","d":"dog"}
>>>print(alpha) {'a': 'apple', 'b': 'boy', 'c': 'cat', 'd': 'dog'}
To print dictionary in more readable form we use json module. i.e. import json and then call the function dumps()
>>>alpha={"a":"apple","b":"boy","c":"cat","d":"dog"}
>>>import json
>>> print(json.dumps(alpha,indent=2))
{
"a": "apple",
"c": "cat",
"b": "boy",
"d": "dog"
}
split() function
It is used to break up string into words and create a list out of it.
>>> message ="india is my country"
>>> message.split()
['india', 'is', 'my', 'country']
>>> mylist = message.split()
>>> mylist
['india', 'is', 'my', 'country']
Note: by default it splits the message based on the spaces between the words. However if the message to be
break on any other delimeter we have to pass that delimeter.
>>> message="ravi,vikas,dinesh,suresh"
>>> mylist = message.split(',')
>>> mylist ['ravi', 'vikas', 'dinesh', 'suresh']
Program to count the frequency of list element using a dictionary
import json
sentence="Python learning is great fun \
Python is interpreted language"
words = sentence.split()
d={}
for one in words:
key = one
if key not in d:
count = words.count(key)
d[key]=count
print("Counting frequencies in list\n",words)
print(json.dumps(d,indent=1))
Dictionary functions and methods
 len() : it return the length of dictionary i.e. the count of elements (key:value pairs) in dictionary
>>>alpha = {'a': 'apple', 'b': 'boy', 'c': 'cat', 'd': 'dog'}
>>> len(alpha)
4
 clear() : this method removes all items from dictionary and dictionary becomes empty dictionary
>>>alpha.clear()
>>>alpha # {}
However if you use “del” to delete dictionary it will remove dictionary from memory
>>>alpha = {'a': 'apple', 'b': 'boy', 'c': 'cat', 'd': 'dog'}
>>>del alpha
>>>alpha #Error
“alpha‟ is not defined
 get() : this method is used value of given key, if key not found it raises an exception
>>>alpha.get(“b‟) # boy
>>>alpha.get(“z‟) #Error, nothing will print
>>>alpha.get(„z‟,‟not found‟)
Not found
 items() : this method returns all the items in the
dictionary s a sequence of (key,value) tuple
>>>alpha = {'a': 'apple', 'b': 'boy', 'c': 'cat', 'd': 'dog'}
>>> mytuple = alpha.items()
>>>for item in mytuple:
print(item)
>>>alpha = {'a': 'apple', 'b': 'boy', 'c': 'cat', 'd': 'dog'}
>>> mytuple = alpha.items()
>>>for key,value in mytuple: print(key,value)
 keys() : this method return all the keys in the dictionary as a sequence of keys(not in list form)
>>> alpha.keys()
dict_keys(['a', 'b', 'c', 'd'])
 values() : this method return all the values in the dictionary as a sequence of keys(a list form)
>>> alpha.values()
dict_values(['apple', 'boy', 'cat', 'dog'])
 Update() method : this method merges the key: value pair from the new dictionary into original dictionary,
adding or replacing as needed. The items in the new dictionary are added to the old one and override items
already with the same keys.
>>> d1={1:100,2:200,3:300,4:400}
>>> d2={1:111,2:222,5:555,4:444}
>>> d1.update(d2)
>>> d1
{1: 111, 2: 222, 3: 300, 4: 444, 5: 555}
>>>d2
{1: 111, 2: 222, 5: 555, 4: 444}
It is equivalent to:
for key in d2.keys():
d1[key] = d2[key]
 fromkeys() : return new dictionary with the given set of elements as the keys of the dictionary.

 copy() : as the name suggest, it will create a copy of dictionary

 Popitem() : it will remove the last dictionary item are return key,value.
 max() : this function return highest value in dictionary, this will work only if all the values in dictionary is of
numeric type

 min() : this function return highest value in dictionary, this will work only if all the values in dictionary is of
numeric type.

 sorted() : this function is used to sort the key or value of dictionary in either ascending or descending order. By
default it will sort the keys.

Program to create dictionary for storing employee names and salary and access them

COMPUTER SYSTEM ORGANIZATION


Question and Answers

COMPUTER SYSTEM

VERY SHORT ANSWER QUESTIONS (1 MARK)

Q.1 Data in computer terminology mean?

(a) Figure

(b) Raw facts

(c) Both a & b

(d) None of these

Hide Answer

(c) Both a & b

Q.2 What is information?

(a) Processed Data

(b) Collection of a Program

(c) Raw Data

(d) Collection of Instructions

Hide Answer

(a) Processed Data

Q.3 Full form of ALU

(a) Application Logic Unit

(b) Array Logic Unit

(c) Arithmetic Logic unit

(d) Auxilary Logic Unit

Hide Answer

(c) Arithmetic Logic unit


Q.4 Full form of CPU

(a) Central Processing Unit

(b) Central Program Unit

(c) Common Processing Unit

(d) Central Personal Unit

Hide Answer

(a) Central Processing Unit

Q.5 Full form of IPO

(a) Input Process Output

(b) Input Print Output

(c) Internet Print Output

(d) Internet process Output

Hide Answer

(a) Input Process Output

Q.6 MICR stands for?

(a) Maganetic Ink Character Reader

(b) Maganetic Ink Code Reader

(c) Maganetic Ink Caser Reader

(d) Maganetic Ink Computer Reader

Hide Answer

(a) Maganetic Ink Character Reader

Q.7 The Arithmetic Logic Unit performs which arithmetical operation?

(a) (+ , – , * , / )

(b) ( True. False )


(c) ( <, >, =,> =,< >)

(d) All of these

Answer

(d) All of these

Q.8 Personal computers use no. of chips mounted on a main circuit board. The main board is known as-

(a) Chip

(b) Motherboard

(c) Masterboard

(d) Fastboard

Hide Answer

(b) Motherboard

Q.9 Which of the following are the sub units that make the CPU?

(a) ALU

(b) Control Unit

(c) Both a & b

(d) None of these

Hide Answer

(c) Both a & b

Q.10 Which units in computer are capable of performing arithmetic & Logical operations?

(a) Memory

(b) ALU
(c) Control Unit

(d) None of these

Hide Answer

(b) ALU

Q.11 Which of the following is the part of CPU?

(a) Printer

(b) Keyboard

(c) Mouse

(d) Arithmetic Logic unit

Show Answer

Q.12 Which of the following is also known as brain of the computer?

(a) Input Unit

(b) Central Processing Unit

(c) Output Unit

(d) All of these

Hide Answer

(b) Central Processing Unit

Q.13 What is the responsibility of the logical unit in the CPU of a computer?

(a) To produce result

(b) To compare numbers

(c) To store data

(d) All of these

Hide Answer

(b) To compare numbers


Q.14 Which of the following is input pointing device?

(a) Keyboard

(b) Printer

(c) Mouse

(d) Scanner

Hide Answer

(c) Mouse

Q.15 Which of the following is not an example of output device?

(a) Keyboard

(b) Printer

(c) Monitor

(d) Speaker

Answer: Keyboard

Q.16 Which of the following is not an example of Input device?

(a) Keyboard

(b) Mouse

(c) OMR

(d) Speaker

Answer

(d) Speaker
Q.17 When we work on any document on PC, it is stored temporarily in______ memory

(a) RAM

(b) ROM

(c) CPU

(d) CD-ROM

Answer a RAM

Q.18 Smallest measurement unit of computer memory is?

(a) Megabyte

(b) Bit

(c) Byte

(d) Killo Byte

Answer

19. Which one of the following is not a secondary memory?


(a) Pendrive
(b) Harddisk
( c) CD
(d) ROM

Q 20. Write the full form for ALU .

Ans . Arthmetic Logic Unit

Q 21 1 GB is equal to ______________ MB.


Answer : 1024

SHORT ANSWER QUESTIONS ( 2 MARKS)

1. What are the different types of RAM?


Answer – RAM is a temporary storage device it is also known as Volatile memory. RAM is divided into two
type –
 DRAM
 SRAM
2. What is the difference between SRAM and DRAM?
Answer – SRAM is a memory semiconductor that is more energy-efficient and faster than DRAM. A memory
device called a DRAM can store more data than an SRAM chip, but it also consumes more power.
3. What is Cache Memory?
Answer – Cache memory is a particularly fast memory that helps the CPU keep up with its high speed. It
serves as a buffer and is often positioned between the CPU and primary memory. It is quite pricey but
decreases the average access time to data from the main memory.

4. What is the need of RAM? How does it differ from ROM?


Ans: RAM (random access memory) is used for quickly accessing a data. RAM is a temporary storage
memory and it stores the active using data. Whereas ROM is a read only memory and it is a permanent storage
device. Data in RAM is erased when power goes off whereas in ROM data remain as it is.
5. What is the need for secondary memory?
Ans: Secondary memory provides a large storage facility as well as it is very cheap .There is a need of
secondary storage because it is a permanent storage device. Unlike ROM and RAM secondary memory doesn’t
have limited storage.
6. How do different components of the computer communicate with each other?
Ans: Component of a computer communicate with each other with the help of system bus. System bus
provides the facility to transfer the data as well as memory address between one component to another.

7. Establish a distinction between input and output devices.


Answer – An output device is connected to a computer that receives incoming data, whereas an input device is
connected to a computer that puts out data to the computer. The output device copies or displays the data that
was sent by the input device to the computer for processing.

8. Describe the function of cache memory.


Answer – The effectiveness of data retrieval is increased by cache memory, which is crucial. It saves
information that the CPU will probably need later on, such as data or programme instructions, that are
frequently employed in the execution of programmes.
9. Describe the computer’s storage components.
Answer – A storage device is any piece of computer hardware that is used to store, transfer, or extract data
files and objects. Information can be temporarily or permanently stored by storage devices. They could be
internal to a computer, server, or other computing equipment or external.
10. Briefly describe the roles of the ALU and CU?
Answer –
ALU – Arithmetic Logic Unit is referred to as ALU. It is a crucial component of the CPU. It does all
fundamental arithmetic operations, including addition, subtraction, multiplication, and division, as well as
logical operations.
CU – Control Unit is referred to as CU. It is one of the CPU’s core components. Choosing the most effective
approach to work is the major responsibility of the CU. It directs all associated operations to the various
processing components.

LONG ANSWER QUESTIONS ( 3/4 MARKS)


1. Draw the block diagram of a computer system. Briefly write about the functionality of each
component.
Ans:

INPUT UNIT :
Input unit has following function:
 Input unit takes a data instruction from the user for further processing.
 We know that computer understand machine language. Input unit converts the data to the machine language
(machine readable form)
They are various types of input devices are available like keyboard, scanner, mouse, touch screen devices, etc.
CENTRAL PROCESSING UNIT:
CPU i.e. Central processing unit is responsible for performing all tasks of computer. CPU is like a heart of
computer.CPU consists of 3 units:
 Primary memory
 Control unit
 Arithmetic logic unit
ALU:
Arithmetic and logical unit responsible for performing all arithmetic operation like addition, subtraction,
multiplication and division .It also responsible for conduct merging, sorting like all sorting techniques .All the
calculations of the data perform by ALU.
Control unit:
Control unit is used to control the signals. Control unit receives the instruction, data, and information from
input devices and converts it into control signals.
Primary memory:
There are two types of primary memory
 RAM
 ROM
RAM:
 RAM means random access memory.
 It is a volatile storage.
 The data stored in RAM temporary.
 RAM stores the data of active task.
ROM :
 ROM mans read only memory.
 The data stored in ROM is permanent.
 It cannot be erased during the power cut off.
 It is a non volatile memory.
OUTPUT UNIT:
An output device is one of the components of computer. output devices is responsible to convert machine code
into the human readable form. Monitor, printer etc. are output devices. The output given by the computer can
be in any type like text, graphics, audio, video etc

2. What are the different characteristics of a Computer?


Answer – The different characteristics of a computer are –
a. Speed – Computers are their ability to process data and instructions at a very high speed.
b. Versatility – is the ability of a computer to do a variety of jobs at the same time.
c. Accuracy – Not only does the machine perform varied jobs with high speed, but also does them with high
precision and accuracy.
d. Diligence – Another noteworthy feature of computers is its ability to perform the same task repeatedly over
and over again without getting bored.
e. Memory – One of the notable features of a computer is its memory. However, the computer’s main memory
is volatile, i.e., it is lost when we switch off the computer.
f. Storage – Huge amounts of data and information can be stored in a computer for future retrieval. The human
memory is limited and fades away with time, which is not true for a computer.

3. What are the different memories in the computer system?


Answer – There are two different type of memory in computer system –
a. Primary Memory
b. Secondary memory
Primary Memory – Data stored in Primary Memory is directly accessible by the CPU. The inputs received in
the above steps are stored in the computer memory, called random access memory (RAM). This storage is
relatively fast and expensive as compared to the secondary storage.
Secondary Memory – The memory which is external to the computer system forms the secondary storage, for
example, the magnetic tapes, compact disks, pen drives are all examples of the secondary storage. These are
not directly connected to the CPU.

4. List the various functions of an operating system.


Answer – The various functions of an operating system are –
a. Communication manager – The operating system handles the system’s communication requirements,
whether they include connecting to the internet or peripheral devices.
b. Resource Management – The management of a computer system’s resources has a significant impact on
how well it functions. The resources we discuss in this article include the computer’s memory, CPU time, files,
secondary storage, input/output devices, and more.
c. Process Management – A programme that is now running in memory or waiting for the CPU is referred to
as a process. There are numerous processes running simultaneously in a computer. All of the processes running
on the computer are managed, regulated, and scheduled by the OS.
d. Memory Management – The memory management section of an operating system dynamically allocates
memory to the processes as needed and releases it when not in use.
e. File Management – All of the files and folders (directories) kept on the computer drive are taken care of by
the operating system. The fundamental operations that a user must carry out on files include creating,
renaming, deleting, copying, and relocating files and folders.

5. Name the input or output device used to do the following:


a) To output audio
b) To enter textual data
c) To make hard copy of a text file
d) To display the data or information
e) To enter audio-based command
f) To build 3D models
g) To assist a visually-impaired individual in entering data
Ans:
a) To output audio – Speaker
b) To enter textual data – Keyboard
c) To make hard copy of a text file – Printer
d) To display the data or information – Monitor
e) To enter audio-based command – Mic
f) To build 3D models – 3D Printer
g) To assist a visually-impaired individual in entering data – Braille keyboards
SOFTWARE TYPES:

1.) Name the software required to make a computer functional. Write down its two primary services?
Ans: To make a computer functional operating system is required. The two services of primary services:
1) Operating system provides services for building and running the application.
2) Operating system provide user interface to the user for enable interaction between computer and user.
2.) How does the computer understand a program written in high level language?
Ans: Computer understands only machine level language (0 and 1). High level language is a simple English
type language written in some symmetric format. To convert high level language into machine language there
is need of compiler which can be understood by computer.
3.) Why is the execution time of the machine code less than that of source code?
Ans: We know that computer readable language is machine language. So there is no need to convert machine
language whereas Source codes are written in high level language. So there is need to convert it into machine
language first. Hence, the execution time of machine language is less than source code.
9.) Differentiate between proprietary software and freeware software. Name two software for each type.
Ans:

Proprietary software Freeware software

Proprietary software is software which is Freeware software are available anywhere


not available freely or publically. publically.

To get Proprietary software there is a To get freeware software there is no need


need of authenticate license of authenticate license

To get Proprietary software we must free software are free of charge


have to pay for it

Example: adobe flash player, winRAR Example: Linux, vlc player

14.) Identify the category (system, application, programming tool) of the following software:
a) Compiler
b) Assembler
c) Ubuntu
d) Text editor
Ans:
a) Compiler – Programming tool
b) Assembler – Programming tool
c) Ubuntu – System
d) Text editor – Application

NCERT Solutions for Class 11 Computer Science (Python) – Software Concepts

TOPIC – 1
SOFTWARE

Very Short Answer type Questions [1 mark each]

Question 1:
Name any two popular word processing software.
Answer:
Two popular word processing software are :

1. OO-writer
2. MS-word

Question 2:
Expand OS.
Answer:
OS stands for Operating System.

Question 3:
Name the categories in which the software are classified.
Answer:
Software are classified into following two categories :

1. System software
2. Application software

Question 4:
Name the various categories of system software.
Answer:
System software are divided into following two categories :
1. Operating system
2. Language processor

Question 5:
Expand DBMS.
Answer:
DBMS stands for Data Base Management System.

Question 6:
What is the full form of DTP
Answer:
DTP stands for Desk Top Publishing.

Question 7:
Expand IOCS.
Answer:
IOCS stands for Input-Output Control System.

Question 8:
Write the name of the part of machine level instruction, which tells the central processor what has to be done.
Answer:
Operation code.

Question 9:
A system program that combines the separately compiled modules of a program into a form suitable for
execution.
Answer:
Linking loader.

Question 10:
Which system software does the job of merging the records from two files into one ?
Answer:
Utility program.

Question 11:
A computer cannot “boot” if it does not have the____.
Answer:
Operating system.

Question 12:
Write the name of the system program that sets up an executable program in the main memory ready for
execution.
Answer:
Loader.
Question 11:
What do you mean by bug ?
Answer:
A bug is logical error in a program.

Short Answer type Questions – I [2 mark each]

Question 1:
Define Software. Give its types.
Answer:
Software represents the set of programs that controls the operation of a computer system and utilizes hardware.
Software are of two types :

1. System Software
2. Application Software.

Question 2:
What is system software ? What are its components ?
Answer:
System Software : The software which controls the internal operations of the computer and creates an interface
with software and hardware is known as system software.
The system softwares can be divided into two categories :

1. Operating system
2. Language processors

Question 3:
What do you mean by operating system ?
Answer:
Operating System is a software program which manages the hardware and software resources and links them.
It creates an interface between hardware and software. It is a bridge between the hardware and the software.

Question 4:
What do you mean by graphics software ?
Answer:
Graphics software is the application software which can manipulate images, known as graphics software. The
graphics software can incorporate images, text, sound, animation and video sequence.

Question 5:
Name the various categories of application software.
Answer:
Application software can be divided into following three categories :

1. Packages
2. Utilities
3. Customized Software
Question 6:
Name the major categories of packages.
Answer:
Following are the major categories of packages :

1. Word processing software


2. Database management software
3. Spreadsheets
4. Desktop publishing software
5. Graphics, multimedia and presentation applications.

Question 7:
Explain utility program.
Answer:
A program that performs a specific task related to the management of computer functions, resources, or files as
password protection, memory management, virus protection, and file compression.

Question 8:
Give examples of utility programs.
Answer:
some examples of utility programs are :

1. Virus scanners
2. Disk defragmenters
3. Encryption utilities
4. Backup software

Short Answer type Questions – II [3 mark each]

Question 1:
Explain operating system and utility system software.
Answer:
Operating systems are essential for running a computer. However, as part of the operating system, there are
often other programs which are not essential to the running of the computer. These are known as utilities. If
they were not there, they would not affect the working of the computer. 3

Question 2:
How does the application software and operating system work together ?
Answer:
When we use a program, it sends commands to the computer. But the computer is just a heap of nuts and bolts
and computer chips. It can’t understand the commands by itself. So the operating system catches the
commands and tells the computer what you want it to do.

Question 3:
What are open source software ? Give its examples.
Answer:
Open source software is that computer software whose source code is made available with a license in which
the copyright holder provides the rights to read, change and distribute the software for any purpose. For
example : Linux, Unix etc.

Question 4:
What are the criteria of software development industry to consider a software as open source software ?
Answer:
For a software to be considered as open source software it should meet certain criteria, they are :

1. It should be available free or at low cost.


2. Source code must be included.
3. Everyone should be allowed to edit the source code.
4. Modified versions can be redistributed.

Question 5:
What are Freeware ? Give its examples.
Answer:
It generally refers to the software which re available for use at no cost or for an optional fee to avail all the
functions of the software. For example : WordPad, Paint, Notepad etc.

Question 6:
What are Shareware ? Give its examples.
Answer:
It is that software which is made available with
a right to redistribute copies. It is also known as “Try Before You Buy.” For example : wondershare,
Kaspersky antivirus etc.

Question 7:
What are Proprietary Software ? Give its examples.
Answer:
It is a software which is owned by an individual or a company. Their source code is always kept secret. For
example : Microsoft windows, adobe flash player etc.

Long Answer type Questions [4-5 mark each]

Question 1:
What are the functions of a file system ?
Answer:
The major functions of a file system are given below :

1. It provides file naming freedom to the users and permits controlled sharing of files.
2. It provides long and short term storage of files.
3. It provides security against loss of information due to system failure.
4. It also provides file recovery modules, if required. [1 mark for each point]

Question 2:
Define following with examples :
1. Word processing packages
2. Spreadsheet packages
3. DBMS packages.

What are the functions of a file system ?


Answer:

1. Word processing packages : It is a software package that processes textual matter created to a right to
redistribute copies. It is also known as “Try Before You Buy.” For example : wondershare, Kaspersky
antivirus etc.
organize an error free document. Some popular word processing packages are Wordstar, MS- WORD,
Word Perfect, Softword etc.
2. Spreadsheets packages : It is a software package that accepts data in a tabular form i.e., in rows and
columns and allows the user to manipulate, calculate, edit and analyze the data in the required manner.
Some popular spreadsheet packages are, LOTUS 1-2-3, MS-Excel and Quattro Pro.
3. Data base management software (DBMS)
packages : A DBMS package is a software package which manages the different database with home
bulk information in the form of data. It can manage, add, delete and modify the database. Examples :
FoxPro, FOXBase, SYBase, Dbase IV & MS-Access etc.

TOPIC-2
Operating System(OS)

Very Short Answer type Questions [1 mark each]

Question 1:
Expand the term ROM-BIOS.
Answer:
ROM-BIOS stands for Read Only Memory-Basic Input Output System.

Question 2:
What do you mean by POST ?
Answer:
POST—Power On Self-Test.

Question 3:
What are executable files ?
Answer:
Executable files are those files that can directly be executed by the command processor. The files with
extension, exe or com are known as executable files.

Question 4:
Expand GUI.
Answer:
GUI stands for Graphical User Interface.
Question 5:
Why GUI is used ?
Answer:
GUI is used as an interaction between software and the user.

Question 6:
Does MS-Windows provides GUI ?
Answer:
Yes, MS-Windows provides GUI.

Question 7:
What is MS-DOS ?
Answer:
MS-DOS stands for Microsoft Disk Operating System. It is a Command User Interface (CUI), single user
multi-tasking operating system.

Question 8:
What is considered as a file manager in Windows 98?
Answer:
Windows Explorer is considered as a file manager in Windows 98.

Question 9:
What happens to the files when they are deleted ?
Answer:
When files are deleted, they move to Recycle Bin.

Short Answer type Questions – I [2 mark each]

Question 1:
Define Operating system. Give the names of any three operating systems.
Answer:
Operating System is defined as a collection of programs that coordinates the operations of computer hardware
and software. It acts as a bridge or interface between man and machine. Operating system is a system software
which is mandatory for all computer systems to operate. It is a general purpose software. Some commonly
used operating systems are Windows, BOSS etc.

Question 2:
Explain I/O System Management
Answer:
I/O system hides the peculiarities of specific hardware devices from the user. Only the device driver knows the
peculiarities of the specific device to which it is assigned.

Question 3:
Name some of the icons available on windows.
Answer:
Some of the icons available on windows are:

1. Application icons
2. Shortcut icons
3. Documents icons
4. Disk-Drive icons.

Question 4:
What is the difference between MS-Windows and MS-DOS ?
Answer:
MS-WINDOWS is a GUI (Graphic User Interface), single user multitasking operating system.
Whereas, MS-DOS is a CUI (Command User Interface) single user multi-tasking operating system.
MS-Windows is more user friendly in comparison to MS-DOS.

Short Answer type Questions – II [3 mark each]

Question 1:
Write the objectives of operating system.
Answer:
(a) To hide details of hardware by creating abstraction : An abstraction is software that hides lower level
details and provides a set of higher- level functions.
(b) To allocate resources to processes (manage resources) : An operating system controls how processes (the
active agents) may access resources (passive entities).
(c) Provide a pleasant and effective user interface : The user interacts with the operating systems through the
user interface and usually interested in the “look and feel” of the operating system.

Question 2:
Write the general goals of scheduling.
Answer:
(a) Fairness
(b) Policy enforcement
(c) Efficiency
(d) Response time
(e) Turnaround time
(f) Throughput

Question 3:
Explain real-time operating system.
Or
Write a short note on real-time operating system.
Or
Write a short note on RTOS.
Answer:
A real-time operating system (RTOS) is an i operating system that guarantees a certain capability within a
specified time constraint. For example, an operating system might be designed to ensure that a certain object
was available for a robot on an assembly line.
Question 4:
Explain multi-user operating system.
Or
Write a short note on multi user operating system.
Answer:
It is the type of operating system that allows many users to take the advantage of computer’s resources
simultaneously.
For example : UNIX, VMS etc.

Question 5:
Explain single user operating system.
Or
Write a short note on single user operating system.
Answer:As it is clear from the name single user operating system is designed for one user to effectively use a
computer at a time.
For example : Windows 2007, Windows 8 etc.

Question 6:
What is an operating system and how are they classified on the basis of interaction ?
Answer:
Operating System is defined as a collection of programs that coordinates the operations of computer hardware
and software. It acts as a
bridge or interface between man and machine. Operating system is a system software which is mandatory for
all computer systems to operate. It is a general purpose software. On the basis of interaction, operating systems
are divided in two types :

1. GUI(Graphical user interface) based.


2. CUI(Character user interface) based.

Question 7:
Give any three advantages of windows.
Answer:
The three advantages of windows are as follows :

1. Microsoft has made several advancements and changes that have made it much easier to use operating
system, and although arguably it may not be the easiest operating system, it is still easier than Linux.
2. Because of the large amount of Microsoft windows users, there is a much larger selection of available
software programs, utilities, and games for windows.
3. Microsoft windows includes its own help section, has vast amount of available online documentation
and help, as well as books on each of the versions of windows.

Question 8:
Give three disadvantages of Windows.
Answer:
The three disadvantages of windows are as follows :

1. Microsoft Windows can run between $ 50.00 – $150.00 US dollars per each license copy.
2. Although Microsoft Windows has made great improvements in reliability over the last few versions of
Windows, it still cannot match the reliability of Linux.
3. Although Windows does have software programs, utilities, and games for free, the majority of the
programs will cost anywhere between $20.00 – $200.00+ US dollars per copy.

Question 9:
Explain Bharat Operating System Solutions.
Answer:
Bharat Operating System Solutions (BOSS) is a free and open source computer operating system developed by
the National Resource Centre for Free/Open Source Software (NRCFOSS) of India. This software is also
known by the acronym BOSS GNU/Linux or simply BOSS Linux. The latest version of this operating system,
BOSS GNU/Linux Version 5.0, was released in August 2013. This software package has been described as
“India’s own PC operating system” the most meaningful product to come out of the Indian software industry in
decades and a work that a government department has done The software has also been endorsed by the
Government of India for adoption and implementation on a national scale.

Question 10:
Explain Android.
Answer:

1. Android is a Linux-based operating system for mobile devices such as smartphones and tablet
computers. It is developed by the Open Handset Alliance, led by Google, and other companies.
2. Google purchased the initial developer of the software, Android Inc., in 2005. The unveiling of the
Android distribution in 2007 was announced with the founding of the Open Handset Alliance, a
consortium of 86 hardware, software, and telecommunication companies devoted to advancing open
standards for mobile devices. Google releases the Android code as open-source, under the Apache
License. The Android Open Source Project (AOSP) is tasked with the maintenance and further
development of Android.
3. The first phone of lun on the Android OS was the HTC Dream which was launched on 22nd October
2008.

Answer type Questions – [4-5 mark each]

Question 1:
Explain process management.
Or
What do you mean by processor management of operating system ?
Answer:
The operating system manages many kinds of activities ranging from user programs to system programs like
printer spooler, name servers, file server etc. Each of these activities is encapsulated in a process. A process
includes the complete execution context (code, data, PC, registers, OS resources in use etc.).
The five major activities of an operating system in regard to processor management are :

1. Creation and deletion of user and system processes.


2. Suspension and resumption of processes.
3. A mechanism for process synchronization
4. A mechanism for process communication.
5. A mechanism for deadlock handling.
Question 2:
Explain main-memory management.
Answer:
Primary-memory or Main-memory is a large array of words or bytes. Each word or byte has its own address.
Main-memory provides storage that can be accessed directly by the CPU. That is to say for a program to be
executed, it must be in the main memory.
The major activities of an operating system in regard to memory-management are :

1. Keep track of which part of memory are currently being used and by whom.
2. Decide which process are loaded into the memory when memory space becomes available.
3. Allocate and deallocate memory spaces as needed.

FLOW OF CONTROL
QUESTIONS
1.Find the output of the following program segments:

for i in range(20,30,2):
print(i)
The output will be:

20
22
24
26
28

2.Find the output of the following program segments:


i = 0; sum = 0
while i < 9:
if i % 4 == 0:
sum = sum + i
i=i+2
print (sum)

The output is 12

3. Give output for Python program to show the working of range() function

print(range(15))
print(list(range(15)))
print(list(range(4, 9)))
print(list(range(5, 25, 4)))
output:-
range(0, 15)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
[4, 5, 6, 7, 8]
[5, 9, 13, 17, 21]

4. Give output for the following Python program


i = 20
if (i < 15):
print("i is smaller than 15")
print("i'm in if Block")
else:
print("i is greater than 15")
print("i'm in else Block")
print("i'm not in if and not in else Block")

output:-
i is greater than 15
i'm in else Block
i'm not in if and not in else Block

5. Give output for the following Python program


i = 20
if (i == 10):
print("i is 10")
elif (i == 15):
print("i is 15")
elif (i == 20):
print("i is 20")
else:
print("i is not present")

output:-
i is 20

Lists
Case study based Questions
Q.1. Attempt any 5 questions from this section. Choose the best possible option.
Suppose a list is given as

Example = [‘h’,’e’,’l’,’l’,’o’]

Answer the questions based on the list

what is len(list Example)?


a) 5
b) 4
c) None
d) Error
What is Example[-1] ?
a) Error
b) None
c) ‘o’
d) ‘h’
Which function can be used to add one more element at the end of the list ?
a) append()
b) insert()
c) add()
d) insertinto()
What will be the output for the following:
Example[2: : 2]

a) [‘h’,’e’,’l’,’l’,’o’]
b) [’e’,’l’,’l’,’o’]
c) [’l’,’l’,’o’]
d) [’l’, ’o’]
Which function will delete all the elements of the list ?
a) del
b) drop()
c) clear()
d) remove()
What will be the output for the following code:
print(Example+”2”)

a) [‘h’,’e’,’l’,’l’,’o’,’2’]
b) [‘h’,’e’,’l’,’l’,’o’,2]
c) [‘h’,’e’,’l’,’l’,’o’‘h’,’e’,’l’,’l’,’o’]
d) None of these

Q.2. Lalit is a game programmer and he is designing a game where he has to use different python
functions as much as possible. Apart from other things, following functionalities are to be
implemented in the game.
(1) He is simulating a dice where random number generation is required.

2) Since the program becomes too lengthy, Lalit wants a separate section where he can store all the functions
used in the game program.

Lalit is feeling difficulty in implementing the above functionalities. Help him by giving answers following
questions:

i) To implement functionality (1) which module can be used:


random

b) randomise

c) randint

d) math

ii) In functionality (2), Lalit should use


a) in-built functions
b) He should write another Python program

c) He should use a module with all the required functions

d) He should make a separate section in the same Python program

MCQs
1. What is the output of the following list operation
aList = [10, 20, 30, 40, 50, 60, 70, 80]
print(aList[2:5])
print(aList[:4])
print(aList[3:])
a) [20, 30, 40, 50]
[10, 20, 30, 40]
[30, 40, 50, 60, 70, 80]
b) [30, 40, 50]
[10, 20, 30, 40]
[40, 50, 60, 70, 80]

2. What is the output of the following


aList = [5, 10, 15, 25]
print(aList[::-2])
a) [15, 10, 5]
b)[10, 5]
c) [25, 10]

3. What is the output of the following code


list1 = ['xyz', 'zara', 'PYnative']
print (max(list1))
a)PYnative
b)zara
4. What is the output of the following list operation

sampleList = [10, 20, 30, 40, 50]


print(sampleList[-2])
print(sampleList[-4:-1])
a) 40
[20, 30, 40]
b)IndexError: list index out of range

5. What is the output of the following code

aList = ["PYnative", [4, 8, 12, 16]]


print(aList[0][1])
print(aList[1][3])
a)P 8
Y 16
b)P
12
c)Y
16
6. What is the output of the following code
l = [None] * 10
print(len(l))
a)10
b)0
c)Syntax Error

7. What is the output of the following code


sampleList = [10, 20, 30, 40, 50]
sampleList.append(60)
print(sampleList)

sampleList.append(60)
print(sampleList)
a) [10, 20, 30, 40, 50, 60]
[10, 20, 30, 40, 50, 60]
b) [10, 20, 30, 40, 50, 60]
[10, 20, 30, 40, 50, 60, 60]
8. What is the output of the following code?

sampleList = [10, 20, 30, 40]


del sampleList[0:6]
print(sampleList)

a) []
b) list index out of range.
c) [10, 20]

9. Select all the correct options to copy a list


aList = ['a', 'b', 'c', 'd']
a) newList = copy(aList)
b)newList = aList.copy()
c) newList.copy(aList)
d)newList = list(aList)
10. Select all the correct options to join two lists in Python
listOne = ['a', 'b', 'c', 'd']
listTwo = ['e', 'f', 'g']
a) newList = listOne + listTwo
b)newList = extend(listOne, listTwo)
c)newList = listOne.extend(listTwo)
d)newList.extend(listOne, listTwo)
Dictionaries
Questions
1. In Python, Dictionaries are immutable

a)False
b) True
2. What is the output of the following code

dict1 = {"key1":1, "key2":2}


dict2 = {"key2":2, "key1":1}
print(dict1 == dict2)
a) True
b) False
3. Please select all correct ways to empty the following dictionary

student = {
"name": "Emma",
"class": 9,
"marks": 75
}
a) del student
b) del student[0:2]
c) student.clear()
4. Select correct ways to create an empty dictionary
a) sampleDict = {}
b) sampleDict = dict()
c) sampleDict = dict{}
5. Items are accessed by their position in a dictionary and All the keys in a dictionary must be of the same type.
a) True
b) False
6. Select all correct ways to copy a dictionary in Python
a) dict2 = dict1.copy()
b) dict2 = dict(dict1)
c) dict2 = dict1
7. What is the output of the following dictionary operation

dict1 = {"name": "Mike", "salary": 8000}


temp = dict1.pop("age")
print(temp)
a) KeyError: ‘age’
b) None
8. Select the correct way to print Emma’s age.

student = {1: {'name': 'Emma', 'age': '27', 'sex': 'Female'},


2: {'name': 'Mike', 'age': '22', 'sex': 'Male'}}
a) student[0][1]
b) student[1]["age"]
c) student[0]["age"]
9. Dictionary keys must be immutable

a) True
b) False
10. Select the correct way to access the value of a history subject

sampleDict = {
"class":{
"student":{
"name":"Mike",
"marks":{
"physics":70,
"history":80
}
}
}
}
a) sampleDict['class']['student']['marks']['history']
b) sampleDict['class']['student']['marks'][1]
c) sampleDict['class'][0]['marks']['history']
11. Select the correct ways to get the value of marks key.

student = {
"name": "Emma",
"class": 9,
"marks": 75
}
a) m = student.get(2)
b) m = student.get('marks')
c) m = student[2])
d) m = student['marks'])
12. What is the output of the following dictionary operation

dict1 = {"name": "Mike", "salary": 8000}


temp = dict1.get("age")
print(temp)

a)KeyError: ‘age’
b)None
13. What is the output of the following

sampleDict = dict([
('first', 1),
('second', 2),
('third', 3)
])
print(sampleDict)

a) [ (‘first’, 100), (‘second’, 200), (‘third’, 300) ]


b)Options: SyntaxError: invalid syntax
c){‘first’: 1, ‘second’: 2, ‘third’: 3}
14. Select the all correct way to remove the key marks from a dictionary

student = {
"name": "Emma",
"class": 9,
"marks": 75
}
a) student.pop("marks")
b) del student["marks"]
c) student.remove("marks")
d) student.popitem("marks")
EMERGING TRENDS

INTRODUCTION TO EMERGING TRENDS

Computers have been around for quite some time now. New technologies and initiatives
emerge with each passing day. In order to understand the existing technologies and have a
better view of the developments around us, we must keep an eye on the emerging trends.
Many new technologies are introduced almost every day. Some of these do not succeed and
fade away over time. Some of these new technologies prosper and persist over time, gaining
attention from users. Emerging trends are the state-of-the-art technologies, which gain
popularity and set a new trend among users. In this chapter, we will learn about some
emerging trends that will make a huge impact (in the future) on digital economy and
interaction in digital societies.
ARTIFICIAL INTELLIGENCE (AI)

Have you ever wondered how maps in your smartphone are able to guide you to take the
fastest route to your destination by analysing real time data, such as traffic congestion? On
uploading a photo on a social networking site, has it ever happened that your friends in the
photograph were recognised and tagged automatically? These are some of the examples of
application of Artificial Intelligence. The intelligent digital personal assistants like Siri,
Google Now, Cortana, Alexa are all powered by AI. Artificial Intelligence endeavours to
simulate the natural intelligence of human beings into machines, thus making them behave
intelligently. An intelligent machine is supposed to imitate some of the cognitive functions of
humans like learning, decision- making and problem solving. In order to make machines
perform tasks with minimum human intervention, they are programmed to create a
knowledge base and make decisions based on it. AI system can also learn from past
experiences or outcomes to make new decisions.

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)
The predictive typing 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.
In fact it is possible to search the web or operate or control our devices using our
voice. All this has been possible by NLP. An NLP system can perform text-to-speech and
speech-to-text conversion.
Machine translation is a rapidly emerging field where machines are able to translate texts
from one language to another with fair amount of correctness. Another emerging
application area is automated customer service where a computer software can interact
with customers to serve their queries or complaints.
Immersive Experiences
With the three-dimensional (3D) videography, the joy of watching movies in theatres
has reached to a new level. Video games are also being developed to provide immersive
experiences to the player. 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. Immersive experiences have been used in the field of training, such
as driving simulators (Figure 2.2), flight simulator and so on. Immersive experience can be
achieved using virtual reality and augmented reality.

(A) Virtual Reality


Everything that we experience in our reality is perceived through our senses. From this
came the idea that if we can present our senses with made-up or non- real information,
our perception of reality would also alter in response to that. 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. At present, 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. It is a comparatively new field and has found its
applications in gaming (Figure 2.3), military training, medical procedures, entertainment,
social science and psychology, engineering and other areas where simulation is needed
for a better understanding and learning.
(B) 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 manipulable. Users
can access information about the nearest places with reference to their current location.
They can get information about places and choose on the basis of user reviews. With thet
help of location-based AR App, travellers can access real-time information of historical places
just by pointing their camera viewfinder to subjects as depicted in Figure 2.4. Location-based
AR apps are major forms of AR apps.
Robotics
A robot is basically a machine capable of carrying out one or more tasks automatically with
accuracy and precision. Unlike other machines, a robot is programmable, which means it
can follow the instructions given through computer programs. Robots were initially
conceptualised 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:
• NASA’s Mars Exploration Rover (MER) mission is a robotic space mission to study about
the planet Mars (Figure 2.5).
• Sophia is a humanoid that uses artificial intelligence, visual data processing, facial recognition
and also imitates human gestures and facial expressions, as shown in Figure 2.6.
• A drone is an unmanned aircraft which can be remotely controlled or can fly autonomously
through Software-controlled flight plans in their embedded systems, working in conjunction with onboard
sensors and GPS (Figure 2.7). Drones are being used in many fields, such as journalism, filming and
aerial photography, shipping or delivery at short distances, disaster management, search and rescue
operations, healthcare, geographic mapping and structural safety inspections, agriculture, wildlife
monitoring or pooching, besides law-enforcement and border patrolling.

BIG DATA
With technology making an inroad into almost every sphere of our lives, data is being
produced at a colossal rate. Today, there are over a billion Internet users, and a majority
of the world’s web traffic is coming from smartphones. Figure 2.8 shows that at the
current pace, around
2.5 quintillion bytes of data are created each day, and the pace is increasing with the
continuous evolution of the Internet of Things (IoT). This results in the generation of data sets
of enormous volume and complexity 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. Big data not only represents voluminous data, it also
involves various challenges like integration, storage, analysis, searching, processing,
transfer, querying and visualisation of such data. Big data sometimes hold rich information
and knowledge which is of high business value, and therefore there is a keen effort in
developing software and methods to process and analyse big data.
Characteristics of Big Data
Big data exhibits following five characteristics shown in Figure 2.9, that distinguish it
from traditional data.
(A) Volume
The most prominent characteristic of big data is its enormous size. If a particular data set
is of such large size that it is difficult to process it with traditional DBMS tools, it can be
termed as big data.
(B) Velocity
It represents the rate at which the data under consideration is being generated and
stored. Big data has an exponentially higher rate of generation than traditional data sets.
(C) Variety
It asserts that a data set has varied data, such as structured, semi-structured and
unstructured data. Some examples are text, images, videos, web pages and so on.
(D) Veracity
Big data can be sometimes inconsistent, biased, noisy or there can be abnormality in the
data or issues with the data collection methods. Veracity refers to the trustworthiness
of the data because processing such incorrect data can give wrong results or mislead the
interpretations.
(E) Value
Big data is not only just a big pile of data, but also possess to have hidden patterns and
useful knowledge which can be of high business value. But as there is cost of investment of
resources in processing big data, we should make a preliminary enquiry to see the
potential of the big data in terms of value discovery or else our efforts could be in vain.
Data Analytics
Data analytics is the process of examining data sets in order to draw conclusions about
the information they contain, with the aid of specialised systems and software.
Data analytics technologies and techniques are becoming popular day-by-day. They
are used in commercial industries to enable organisations to make more informed
business decisions. In the field of science and technology, it can be useful for researchers to
verify or disprove scientific models, theories and hypotheses. Pandas is a library of the
programming language Python that can be used as a tool to make data analysis much
simpler.

INTERNET OF THINGS (IoT)


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. Now imagine what if our bulbs, fans and
refrigerator also became a part of this network. How will they communicate with each
other, and what will they communicate? Think about the advantages and tasks that can
be accomplished if all these devices with smart connectivity features are able to
communicate amongst themselves and we are also able to communicate
with them using computers or
smartphones!
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 as shown in Figure 2.10. At present, in a typical household, many devices have
advanced hardware (microcontrollers) and software. These devices are used in isolation
from each other, with maximum human intervention needed for operational directions and
input data. 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.
Web of Things (WoT)
Internet of Things allows us to interact with different devices through Internet with the
help of smartphones or computers, thus creating a personal network. But to interact with
‘n’ number of different devices, we need to install ‘n’ different apps. Wouldn’t it be
convenient to have one interface to connect all the devices? The web is already being
used as a system to communicate with each other. So, will it be possible to use the web
in such a way that all things can communicate with each other in the most efficient
manner by integrating them together? Web of Things (WoT) allows the use of web
services to connect anything in the physical world, besides human identities on web. It
will pave way for creating smart homes, smart offices, smart cities and so on.
Sensors
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.
Sensors are very commonly used for monitoring and observing elements in real world
applications. The evolution of smart electronic sensors is contributing in a large way to the
evolution of IoT. It will lead to creation of new sensor-based, intelligent systems.
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.

Smart Cities
With rapid urbanisation, the load on our cities is increasing day-by-day, and there are
challenges in management of resources like land water, waste, air pollution, health and
sanitation, traffic congestions, public safety and security, besides the overall city
infrastructures including road, rail, bridge, electricity, subways, disaster management,
sports facilities, etc. These challenges 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 a smart city makes use of computer and communication technology
along with IoT, WoT to manage and distribute resources efficiently. The smart building
shown here uses sensors to detect earthquake tremors and then warn nearby buildings so
that they can prepare themselves accordingly. The smart bridge uses wireless sensors t o
detect any loose bolt, cable or crack. It alerts concerned authorities through SMS. The
smart tunnel also uses wireless sensors to detect any leakage or congestion in the tunnel.
This information can be sent as wireless signals across the network of sensor nodes to a
centralized computer for further analysis.
Every sphere of life in a city like transportation systems, power plants, water supply
networks, waste management, law enforcement, information systems, schools, libraries,
hospitals and other community services work in unison to optimize the efficiency of city
operations and services.

CLOUD COMPUTING
Cloud computing is an emerging trend in the field of information technology, where
computer-based services are delivered over the Internet or the cloud, for the case
of their accessibility form 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. We already use cloud services while storing our pictures and files
as backup on Internet, or host a website on the Internet. Through cloud computing, a user
can run a bigger application or process a large amount of data without having the required
storage or processing power on their personal computer as long as they are connected to the
Internet. Besides other numerous features, 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
A better way to understand the cloud is to interpret everything as a service. A service
corresponds to any facility provided by the cloud. There are three standard models to
categorise different computing services delivered through cloud as shown in Figure
2.12. These are Infrastructure as a Service (IaaS), Platform as a Service (PaaS), and
Software as a Service (SaaS).
(A) 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. Using IaaS from the cloud, a user
can use the hardware infrastructure located at a remote location to configure, deploy and
execute any software application on that cloud infrastructure. They can outsource the
hardware and software on demand basis and pay as per the usage, thereby they can
save the cost of software, hardware and other infrastructures as well as the cost of
setting up, maintenance and security.
(B) 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. Suppose we have developed
a web application using MySQL and Python. To run this application online, we can avail a pre-
configured Apache server from cloud having MySQL and Python pre- installed. Thus, we are
not required to install MySQL and Python on the cloud, nor do we need to configure the
web server (Apache, nginx). In PaaS, the user has complete control over the deployed
application and its configuration. It provides a deployment environment for developers at a
much reduced cost lessening the complexity of buying and managing the underlying
hardware and software.
(C) 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 as long as the required
software is accessible. Like PaaS, a user is provided access to the required configuration
settings of the application software, that they are using at present.
In all of the above standard service models, a user can use on-demand infrastructure or
platform or software and is usually charged as per the usage, thereby eliminating the
need of a huge investment upfront for a new or evolving organisation. In order to utilise
and harness the benefits of cloud computing, Government of India has embarked upon an
ambitious initiative — ‘GI Cloud’ which has been named as ‘MeghRaj’ (https://
cloud.gov.in).

GRID COMPUTING
A grid is a computer network of geographically dispersed and heterogeneous
computational resources as shown in Figure 2.13. 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.
Nowadays, countless computational nodes ranging from hand-held mobile devices
to personal computers and workstations are connected to Local Area Network (LAN) or
Internet. Therefore, it is economically feasible to reuse or utilise their resources like
memory as well as processing power. The grid provides an opportunity to solve
computationally intense scientific and research problems without actually procuring a
costly hardware. Grid can be of two types— (i) Data grid, used to manage large and
distributed data having the required multi-user access, and (ii) 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.
Grid computing is different from IaaS cloud service. In case of IaaS cloud service,
there is a service provider who rents the required infrastructure to the users. Whereas in
grid computing, multiple computing nodes join together to solve a common
computational problem.
To set up a grid, by connecting numerous nodes in terms of data as well as CPU, a
middleware is required to implement the distributed processor architecture. The Globus
toolkit (http://toolkit.globus.org/toolkit) is one such 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 shareddatabase 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 as shown in Figure 2.14. 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.

The most popular application of blockchains technology is in digital currency. However, due to
its decentralised nature with openness and security, blockchains are being seen as one of the
ways to ensure transparency, accountability and efficiency in business as well as in governance
systems.

For example, in healthcare, better data sharing between healthcare providers would result in a higher
probability of accurate diagnosis, more effective treatments, and the overall increased ability of healthcare
organisations to deliver cost-effective care. Another potential application can be for land registration
records, to avoid various disputes arising out of land ownership claims and encroachments. A
blockchain based voting system can solve the problem of vote alterations and other issues. Since
everything gets stored in the ledger, voting can become more transparent and authentic. The blockchain
technology can be used in diverse sectors, such as banking, media, telecom, travel and hospitality and
other areas.

SUMMARY

• Artificial Intelligence endeavours to simulate the natural intelligence of human beings into
machines thus making them intelligent.
• Machine learning comprises of algorithms that use data to learn on their own and make
predictions.
• Natural language processing (NLP) facilitates communicating with intelligent systems using a
natural language.
• Virtual reality allows a user to look at, explore, and interact with the virtual surroundings, just like
one can do in the real world.
• The superimposition of computer-generated perceptual information over the existing physical
surroundings is called augmented reality.
• Robotics can be defined as the science primarily associated with the design, fabrication, theory, and
application of robots.
• Big data holds rich information and knowledge which can be of high business value. Five
characteristics of big data are: Volume, Velocity, Variety, Veracity, and Value.
• Data analytics is the process of examining data sets in order to draw conclusions about the information
PAGE 1
they contain.
• The Internet of Things (IoT) 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.
• A 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 processes data
before passing it on.

• Cloud computing allows resources located at remote locations to be made available to anyone
anywhere. Cloud services can be Infrastructure as a Service (IaaS), Platform as a Service (PaaS), and
Software as a Service (SaaS).
• Block chair technology uses a shared data base of chaired blocks where copies of data base exist on
multiple computers.

STUDY MATERIAL
CLASS XI SESSION2022-23
INFORMATICS PRACTICES
CHAPTER- DATABASE CONCEPT
Introduction- “Database is actually a collection of interrelated data so that it can be used by various applications.
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 enforce standards
Some of the Popular database softwares are-  MySQL (open Source)

✔ ORACLE Database

✔ MS SQL Server

✔ SQLite (open Source)

✔ MariaDB

✔ PostgreSQL (open Source

Relational Database
A database where data are organized in the form of tables (rows and columns)
Terminologies in RDBMS
PAGE 2
Relation
Tables in Relational Database
Eg:Employee

Columns in a Relation
Eg: No,Name,Salary,Zone,Age,Grade,Dept

Records/Rows in a relation
Eg:1,mukul,30000,west,28,A,10

No:of attributes in a relation


Degree of Employee:7

No:of Tuples/records in a relation


Eg: Cardinality of Employee:7

Set of values taken for an attribute


Eg: Domain of (dept)={10,20,30}

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: No in Employee table

Set of attributes have the ability to become primary key


Eg:candidate(employee)={no,name}

All the candidate keys except primary key


Eg:alternate key(employee)={name}

PAGE 3
Candidate key=primary key + alternate key
Alternate key=candidate key-primary key

A non-key attribute which is used to set relationship between 2 tables .The values of the
foreign key are derived from the primary key of another table
Foreign key is also known as Referential Integrity constraint

✔ Check yourself

1. Write the difference between candidate key and alternate key


2. What is the need of a database? Write 3 points
3. Write the difference between primary key and foreign key
4. Differentiate degree and cardinality with example.
STRUCTURED QUERY LANGUAGE (SQL)
Structured Query Language (SQL) as we all know is the database language by the use of
which we can perform certain operations on the existing database and also we can use this
language to create a database. SQL uses certain commands like Create, Drop, Insert, etc. to
carry out the required tasks.
These 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 actually consists of the SQL commands that can be used
to define the database schema.
Example-Create, alter and drop schema Objects ,Create table, create view, create database,
, Alter Table , Drop Table
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.
Examples- INSERT ,UPDATE, DELETE

PAGE 4
Data Types:
For Numbers – INT , INT(Value)
For Decimal Numbers – FLOAT(M,N)
For String/Text – CHAR(N), VARCHAR(N)
For Date – DATE
Differences between Char & Varchar
Char Varchar
It is an abbreviation for characters.
It accept fixed length text .

E.g. NAME CHAR(20) NAME VARCHAR(20)


If, data stored in NAME column is “RAM” If, data stored in NAME columnis “RAM” Then,
It will occupy space of 3
It will occupy memory space of 20
characters only
characters even if ,we are having less
number of characters in text.
Memory wastage is high. It does not waste of memory

CREATING DATABASE:
CREATE DATABASE [IF NOT EXISTS] DATABASENAME
Note: IF NO EXISTS will attempt to create database only if the given name database not
exists. If command is executed without it and database already exists, then error message
‘database already exists’ will come
Example:
Create Database mydata1;
Create Database if not exists mydata1;
OPENING DATABASE
To start working in any database it must be opened by USE command.
USE databasename;
Example: Use mydata1;
GETTING LIST OF ALL DATABSES
To get the list of all created database –
PAGE 5
Show databases;
REMOVING DATABSES
To remove already existing database
DROP DATABASE databasename
Example: Drop database mydata1
CREATING TABLE Create Table Tablename(colname datatype(size), colname2 datatype(size),…);
Example: Create table emp(empno int, name varchar(20), dept varchar(20), salary int)
VIEWING TABLE STRUCTURE
MySQL allows us to get the structure of table like list of columns, data type, size and key
information of table using DESC / DESCRIBE command
Example: DESC emp;
DDL Command- ALTER
ALTER TABLE command allows us to perform the following operations:
▪ Adding new column in existing table
▪ Dropping existing column from table
▪ Modifying column definition in table
▪ Changing the name of column
▪ Adding or dropping constraint after table creation.
ALTER TABLE - ADD Column
To add a column in a table, use the following syntax:
ALTER TABLE table_name ADD column_name datatype;
Example: ALTER TABLE Customers ADD Email varchar(255);
ALTER TABLE - DROP COLUMN
To delete a column in a table, use the following syntax
ALTER TABLE table_name DROP COLUMN column_name;
Example: ALTER TABLE Customers DROP COLUMN Email;
ALTER TABLE - ALTER/MODIFY COLUMN
To change the data type of a column in a table, use the following syntax:
ALTER TABLE table_name ALTER COLUMN column_name datatype;
Example: ALTER TABLE Emp modify Name Varchar(40);
ALTER TABLE Emp change Name EName varchar(40)
SQL PRIMARY KEY on CREATE TABLE
PAGE 6
The following SQL creates a PRIMARY KEY on the "ID" column when the "Persons" table is
created:
SQL PRIMARY KEY on ALTER TABLE
To create a PRIMARY KEY constraint on the "empno" column when the table is already
created, use the following SQL:
Create table emp(empno int primary key, name varchar(20), dept varchar(20), salary int)
ALTER TABLE- ADDING CONSTRAINT
ALTER TABLE Persons ADD PRIMARY KEY (ID);
ALTER TABLE Persons ADD CONSTRAINT PK_Person PRIMARY KEY (ID,LastName);
DROP a PRIMARY KEY Constraint
To drop a PRIMARY KEY constraint, use the following SQL:
ALTER TABLE Persons DROP PRIMARY KEY;
ALTER TABLE Persons DROP CONSTRAINT PK_Person;
DROPPING TABLE
DROP TABLE[IF EXISTS] tablename
Example:
▪ Drop Table emp;
▪ Drop table if exists emp;
DATA QUERY COMMANDS
SELECT COMMAND
Select statement allows to send queries to table and fetch the desired record. Select can be
used to select both horizontal and vertical subset.
Syntax:- Select * / columnnames FROM tablename [ where condition ]
Selecting all record and all columns
Select * from emp;
Selecting desired columns
Select empno, name from emp;
The SQL LIKE Operator
The LIKE operator is used in a WHERE clause to search for a specified pattern in a column.
There are two wildcards often used in conjunction with the LIKE operator:
● The percent sign (%) represents zero, one, or multiple characters
● The underscore sign (_) represents one, single character
PAGE 7
The percent sign and the underscore can also be used in combinations!
LIKE Syntax
SELECT column1, column2, ...FROM table_name WHERE columnN LIKE pattern;
Here are some examples showing different LIKE operators with '%' and '_' wildcards:
LIKE Operator Description
WHERE CustomerName LIKE 'a%' Finds any values that start with "a"
WHERE CustomerName LIKE '%a' Finds any values that end with "a"
WHERE CustomerName LIKE '%or%' Finds any values that have "or" in any position
WHERE CustomerName LIKE '_r%' Finds any values that have "r" in the second position
WHERE CustomerName LIKE 'a_%' Finds any values that start with "a" and are at least
2 characters in length
WHERE CustomerName LIKE 'a__%' Finds any values that start with "a" and are at least
3 characters in length
WHERE ContactName LIKE 'a%o' Finds any values that start with "a" and ends with"o"
The SQL BETWEEN Operator
The BETWEEN operator selects values within a given range. The values can be numbers,
text, or dates. The BETWEEN operator is inclusive: begin and end values are included.
BETWEEN Syntax
SELECT column_name(s)
FROM table_nameWHERE column_name BETWEEN value1 AND value2;
BETWEEN Example
The following SQL statement selects all products with a price between 10 and 20:
SELECT * FROM ProductsWHERE Price BETWEEN 10 AND 20;
NOT BETWEEN Example
To display the products outside the range of the previous example, use NOT BETWEEN:
SELECT * FROM Products WHERE Price NOT BETWEEN 10 AND 20;
SELECT * FROM Orders WHERE OrderDate NOT BETWEEN '1996-07-01' AND '1996-07-
31';
The SQL IN Operator
The IN operator allows you to specify multiple values in a WHERE clause.
The IN operator is a shorthand for multiple OR conditions.
IN Syntax
PAGE 8
SELECT column_name(s) FROM table_name WHERE column_name IN (value1, value2,
...);
IN Operator Examples
The following SQL statement selects all customers that are located in "Germany", "France" or
"UK":
SELECT * FROM Customers WHERE Country IN ('Germany', 'France', 'UK');
The following SQL statement selects all customers that are NOT located in "Germany",
"France" or "UK":
SELECT * FROM Customers WHERE Country NOT IN ('Germany', 'France', 'UK');
The SQL ORDER BY Keyword
The ORDER BY keyword is used to sort the result-set in ascending or descending order.
The ORDER BY keyword sorts the records in ascending order by default. To sort the records
in descending order, use the DESC keyword.
ORDER BY Syntax
SELECT column1, column2 FROM table_name ORDER BY column1[ ASC|DESC];
ORDER BY Example
The following SQL statement selects all customers from the "Customers" table, sorted by the
"Country" column:
SELECT * FROM Customers ORDER BY Country;
ORDER BY DESC Example
The following SQL statement selects all customers from the "Customers" table, sorted
DESCENDING by the "Country" column:
SELECT * FROM Customers ORDER BY Country DESC;
DISTINCT Clause: returns records without repetition (Distinct records)
mysql> SELECT DISTINCT DeptId FROM EMPLOYEE;
UPDATE Command: make changes in the value(s) of one or more columns of existing
records in a table.
SYNTAX:
UPDATE table_name SET attribute1 = value1, attribute2 = value2, ...
[WHERE condition];
NOTE: If we miss the where clause in the UPDATE statement then the Marks of all
the records will be changed to 65.
PAGE 9
DELETE Command:
DELETE statement is used to delete/remove one or more records from a table.
DELETE FROM table_name WHERE condition;

Question
1. Identify the DDL and DML command from the following.
CREATE TABLE, INSERT …INTO, DELETE FROM, ALTER TABLE
ANSWER DDL: CREATE TABLE, ALTER TABLE DML: INSERT ...INTO, DELETE FROM
CCT Based Question:
2. Tejasvi Sethi, a car dealer has stored the details of all cars in her showroom in a table called CARMARKET.
The table CARMARKET has attributes CARCODE which is aprimary key, CARNAME, COMPANY,
COLOR, COST (in lakh rupees) of the car and DOM which is the Date of Manufacture of the car.
Answer any four questions based on the table CARMARKET from the below mentioned questions.
Table: CARMARKET
CARCODE CARNAME COMPANY COLOR COST DOM
C01 BALENO SUZUKI BLUE 5.90 2019-11-07
CO2 INDIGO TATA SILVER 12.90 2020-10-15
C03 GLC MERCEDES WHITE 62.38 2020-01-20
C04 A6 AUDI RED 58.55 2018-12-29
C05 INNOVA TOYOTA BLACK 32.82 2017-11-10
C06 WAGON-R SUZUKI WHITE 12.11 2016-11-11
C07 BREZZA SUZUKI GOLDEN 9.80 2016-10-03
Choose the correct SQL query to do the following (for parts 1 to 4)
i. Display the carname along with the charges rounded off to 1 digit afterdecimal place.
a. Select carname,round(cost) from carmarket;
b. Select carname,round.cost(1) from carmarket;
c. Select carname,round.cost() from carmarket;
d. Select carname, round(cost,1) from carmarket;
CORRECT ANSWER – d

ii. Display the carname, color and position of the character ‘E’ in the color ofall the cars.
PAGE
10
a. select carname,color from carmarket where color like “%E%”;
b. select carname,color,instr(color,’E’) from carmarket;
c. select carname,color from carmarket where color = “%E%”;
d. select carname,color,substr(color,1,’E’) from carmarket;
CORRECT ANSWER – b

iii. Display the carname ,name of the company in lower case of all cars whoseyear (of dom) is 2020.
a. select carname,lcase(company) from carmarket where year(dom) = 2020;
b. select carname,lcase(company) from carmarket where yearof(dom) like’2020%’;
c. select carname,lower(company) from carmarket where dom from’2020-01-01′ to ‘2020-
12-31’;
d. select carname,lower(company) from carmarket where yearfrom(dom) =2020;
CORRECT ANSWER – a

iv. Display the number of cars manufactured each year.


a. select count(*),year(dom) from carmarket where year(dom) = distinct;
b. select count(*),year(dom) from carmarket group by year(dom);
c. select count(carmarket),year(dom) from carmarket group by year(dom);
d. select count(distinct *),year(dom) from carmarket group by year(dom);
CORRECT ANSWER – b

v. What is the cardinality and degree of the table CARMARKET?


a. Cardinality = 8 and Degree = 6
b. Cardinality = 6 and Degree = 7
c. Cardinality = 7 and Degree = 6
d. Cardinality = 7 and Degree = 8
CORRECT ANSWER – c
A School in Delhi uses database management system to store student details. The school maintains a
database ‘school_record’ under which there are two tables.
Student Table : Maintains general details about every student enrolled in school.
StuLibrary Table : To store details of issued books. BookID is the unique identification number issued to
each book. Minimum issue duration of a book is one Day.
PAGE
11
i. Identify the SQL Query which displays the data of StuLibrary table inascending order of StudentID.
i) Select * from StuLibrary Order By BookID
ii) Select * from StuLibrary Order By StuID
iii) Select * from StuLibrary Order By StuID ASC
iv) Select * from StuLibrary Order By StuID DESC
Choose the correct option:
a. Both Query i) and iv) will display the desired data.
b. Both Query i) and ii) will display the desired data.
c. Both Query iii) and iv) will display the desired data.
d. Both Query ii) and iii) will display the desired data.

ii. The Primary Key for StuLibrary Table is/are …….


a.BookID
b.BookID,StuID
c.BookID,Issued_date
d.Issued_date

iii. Which of the following SQL Query will fetch ID of those issued books whichhave not been
returned?
a.SELECT BookID from StuLibrary where BookID is NULL;
b.SELECT BookID from StuLibrary where StuID is NULL;
c.SELECT BookID from StuLibrary where Issued_date is NULL;
d. SELECT BookID from StuLibrary where Return_date is NULL;

iv. The Alternate Key for Student Table will be ……….


a.StuName
b.StuContact
c.StuAadhar
d. StuClass

v. Which of the following SQL Query will display dates on which number ofissued books is greater
than 5?
PAGE
12
a.SELECT Issued_date from StuLibrary GROUP BY Issued_datewhere COUNT(*)>5;
b.SELECT Issued_date from StuLibrary GROUP BY Return_datehaving count(*)>5
c.SELECT Issued_date from StuLibrary GROUP BY Issued_datehaving count(*)>5
d. SELECT Issued_date from StuLibrary GROUP BY Return_datewhere COUNT(*)>5
Solutions:
I. d) Both Query ii) and iii) will display the desired data.
II. c) BookID,Issued_date
III. d) SELECT BookID from StuLibrary where Return_date is NULL;
IV. c) StuAadhar
V. c) SELECT Issued_date from StuLibrary GROUP BY Issued_datehaving count(*)>5
3.What is the difference between cardinality and degree?.
Ans. Degree - The number of attributes or columns in a relation is called the Degree of the relation.
Cardinality - The number of tuples/ rows in a relation is called the Cardinality of the relation.
4. Differentiate between WHERE and HAVING clause.
Ans. WHERE clause is used to select particular rows that satisfy a condition whereas HAVING clause is used in
connection with the aggregate function, GROUP BY clause.
For ex. – select * from student where marks > 85;
This statement shall display the records for all the students who have scored more than 85 marks.
On the contrary, the statement – select * from student group by stream having marks > 85; shall display the records
of all the students grouped together on the basis of stream but only for those students who have scored marks more
than 85.
5. What do you mean by domain of an attribute in DBMS? Explain with an example.
Ans. Domain of an attribute is the set of values from which a value may come in a column. E.g. Domain of section
field may be (A,B,C,D).
6. Choose appropriate answer with respect to the following code snippet.

CREATE TABLE student (


name CHAR(30),
student_id INT,
gender CHAR(1),
PRIMARY KEY (student_id)
);
a) What will be the degree of student table?

PAGE
13
i) 30 ii) 1 iii) 3 iv) 4
Ans. iii) 3
7. Suppose your school management has decided to conduct cricket matches between students of class XI and Class
XII. Students of each class are asked to join any one of the four teams — Team Titan, Team Rockers, Team Magnet
and Team Hurricane. During summer vacations, various matches will be conducted between these teams. Help your
sports teacher to do the following:
a) Create a database “Sports”.
Ans.:create database sports;
use sports;
b) Create a table “TEAM” with following considerations:
i) It should have a column TeamID for storing an integer value between 1 to 9, which refers to unique identification
of a team.
ii) Each TeamID should have its associated name (TeamName), which should be a string of length not less than 10
characters.
Ans.:create table team
(teamid int(1),
teamname varchar(10));
c) Using table level constraint, make TeamID as primary key.
Ans.:alter table team add primary key (teamid);
d) Show the structure of the table TEAM using SQL command.
Ans.:desc team;
8. Differentiate between the following commands:
a) ALTER and UPDATE b) DELETE and DROP

Alter Update

This command is used to modify the table structure. This command is used to modify the table contents.

This is a DDL command. This is a DML command.

It will add, modify or drop any column or constraints. It will set new values to the already exists values in a tabl

Example: Example:
alter table emp add column remarks varchar(20); update emp set sal=5000 where empno=1256;

Delete Drop

PAGE
14
Delete is used to remove the rows from the table. Drop is used to deleting a table.

Delete is the DML command. Drop is DDL command.

Example: Example:
delete from emp where empno=1245; drop table emp;

9. What are the different divisions of SQL and commands? Give examples.
Ans: SQL commands can be divided into following categories –
(i) Data Definition Language (DDL) Commands. e.g. CREATE TABLE, ALTER TABLE, DROP TABLE etc.
(ii) Data Manipulation Language (DML) Commands. e.g. INSERT INTO, DELETE FROM, UPDATE, SELECT
etc.
(iii) Transaction Control Language (TCL) Commands.e.g. ROLLBACK, COMMIT, SAVEPOINT etc
10. How to view the structures of the table made by you?
Ans: By using DESC <TableName> command. e.g.
mysql>DESC Employee;
11. There is a column HOBBY in a Table CONTACTS. The following two statements are giving different outputs.
What may be the possible reason ?
a.SELECT COUNT(*) FROM CONTACTS;
b.SELECT COUNT(HOBBY)FROM CONTACTS;
Ans. The column hobby may have NULL values, when we give count(colname) it ignores null values while count(*)
will count all duplicate and NULL values. therefore two statements may give different values.
12. Kunal has entered the following SQL command on Table ‘STUDENT’ that has TotalMarks as one of the
columns.
SELECT COUNT (*) FROM STUDENT; The output displayed is 20.
Then, Kunal enters the following command :
SELECT COUNT (*) FROM STUDENT WHERE TotalMarks <100; The output displayed is 15.
Then, Kunal enters the following command :
SELECT COUNT (*) FROM STUDENT WHERE TotalMarks >= 100;
Ans. Yes , as no of records =20 , students scoring <100 = 15. ; hence the students scoring greater than equal to 100
will be 20-15 =5. As all the three statements mentioned use count(*) as the count function.He predicts the output of
the above query as 5. Do you agree with Kunal ? Give reason for your answer.
MCQ based on SQL
1. Which is/are correct statements about primary key of a table?
A. Primary keys can contain NULL values B. Primary keys cannot contain NULL values.
PAGE
15
C. A table can have only one primary key with single or multiple fields
D. A table can have multiple primary keys with single or multiple fields
Answer: B and C
2. In existing table, ALTER TABLE statement is used to
A. Add columns B. Add constraints C. Delete columns D. All of the above
Answer: D
3. In a table, a column contains duplicate value, if you want to list all different value only, then which
SQL clause is used?
A. SQL DISTINCT
B. SQL UNIQUE
C. SQL BETWEEN
D. SQL Exists
Answer: A
4. What does the abbreviation DBMS stand for?
A. Data Borrowing and Movement Software.
B. Database Management System.
C. Digital Base Mapping System.
D. Database Manipulation Software.
Answer: B
5. A row of relation generally referred to as .......................... and column of a relation is ...................
A. Domain & Attribute
B. Attribute & Domain
C. Tuple & Attribute
D. Attribute & Tuple
Answer: C
6. A relation has 45 tuples & 5 attributes, what will be the Degree & Cardinality of that relation?
A. Degree 5, Cardinality 45
B. Degree 45, Cardinality 5
C. Degree 50, Cardinality 45
D. Degree 50, Cardinality 225
Answer: A
7. Which of the following statement removes database including its related components?
PAGE
16
A. DROP DATABASE
B. DELETE DATABASE
C. REMOVE DATABASE
D. None of the mentioned

41

Answer: A
8. Which is a valid CREATE TABLE statement?
A. Create table emp add(id integer(3));
B. Create table emp (id integers(3));
C. Create table emp modified (id integer(3));
D. Create table emp (id integer(3));
Answer: D
9. Which operator defines a range of values that the column values must fall in?
A. In
B. Like
C. Between
D. Is
Answer: C
10. We use ............... operator with select for condition based on pattern matching.
A. In
B. Like
C. Between
D. Is
Answer: B
11. To display the detail of employee having “e” in their name in descending order of salary the correct
SQL statement is :
A. SELECT * FROM emp WHERE ename LIKE “e%” ORDER BY SAL ;
B. SELECT * FROM emp ORDER BY SAL DESCWHERE ename LIKE “%e%”;
C. SELECT * FROM emp WHERE ename LIKE “%e%” ORDER BY DESCSAL;
D. SELECT * FROM emp WHERE ename LIKE “%e%” ORDER BY SAL DESC;
PAGE
17
Answer: D
12. How can you insert a new row into the “STORE” table.
A. INSERT ROW (1,”RAM” )INTO STORE;
B. INSERT VALUES(1,”RAM”) INTO STORE;
C. INSERT INTO (1,”RAM” )STORE;
D. INSERT INTO STORE VALUES (1,”RAM”);
Answer: D
13. The statement in SQL which allows to change the definition of a table is:
(A) Alter
(B) Update
(C) Create
(D) Select
Answer: A
14. Which of the following SQL commands is used to retrieve data?
(A) Delete
(B) Select
(C) Join

42

(D) Insert
Answer: B
15. Which operator is used to compare a value to a specified list of values?
(A) ANY
(B) BETWEEN
(C) All
(D) IN
Answer: D

State True or False


16. In Relational data model, the data is organized into tables i.e. rows and columns.
Answer: True
PAGE
18
17. A column in a relation is also called an attribute or field.
Answer: True
18. Candidate keys other than the primary key of a relation are called as foreign Key.
Answer: False
19DDL handles operations such as entering rows into a table, changing data, deleting rows, and
extracting data from rows and tables.
Answer: False
20. A field without any value is a NULL Value.
Answer: True
CASE STUDY BASED QUESTIONS
1.A Stationary Store is considering to maintain their inventory using SQL to store the data. As a
database administer, Rajan has decided that:
• Name of the database – STATIONARY_STORE
• Name of the table - INVENTORY
• The attributes of INVENTORY are as follows:
ItemNo - numeric
ItemName - character of size 20
Scode - numeric
Quantity – numeric
Table : INVENTORY
ItemNo ItemName Scode Quantity
2005 Notebook Classic 23 60
2003 Ball Pen 0.25 22 50
2002 Get Pen Premium 21 150
2006 Get Pen Classic 21 250
2001 Eraser Small 22 220
2004 Eraser Big 22 110
2009 Ball Pen 0.5 21 180

1. Identify the attribute best suitable to be declared as a primary key.


A. ItemNo B. ItemName C. Scode D. Quantity
Answer: A
PAGE
19
2. Write the degree and cardinality of the table INVENTORY.
A. Degree: 4 Cardinality: 4 B. Degree: 4 Cardinality: 8 C. Degree: 4 Cardinality: 7D. Degree: 7 Cardinality: 7
Answer: C
What will be the correct option to insert the following data into the attributes ItemNo, ItemNameand
SCode respectively in the given table INVENTORY.
ItemNo = 2010, ItemName = "Sharpener" and Scode = 25
A. INSERT INTO inventory (ItemNo,ltemName.Scode) VALUES(25, “PracticalBook”,2010);
B. INSERT INTO inventory (ItemNo,ltemName.Scode) VALUES(2010, “Sharpener”,25);
C. INSERT TO inventory (ItemNo,ltemName.Scode) VALUE (2010, “Sharpener”,25);
D. INSERT INTO inventory (ItemNo,ltemName.Scode) VALUES;
Answer: B
4. Rajan want to remove the table INVENTORY from the database STATIONARY_STORE, Which
command will he use from the following:
A. DELETE FROM inventory; B. DROP TABLE inventory;
C. DROP DATABASE STATIONARY_STORE; D. DELETE inventory FROM STATIONARY_STORE;
Answer: B
2.A Sports Club MySports is considering to maintain their inventory using SQL to store the data. As a
database administer, Sahil has decided that:
• Name of the database – MySports
• Name of the table – Sports
• The attributes of SPORTS are as follows:
SCode – character
SportName – character of size 20
Noofplayers – numeric
CoachName – character of size 20

Table: SPORTS
SCode SportName Noofplayers CoachName
S001 Cricket 21 Rahul Dravid
S002 Football 25 Roshan Lal
S003 Hockey 40 Sardar Singh
S004 Cricket 19 Chetan Sharma
PAGE
20
S005 Archery 12 Limba Ram
S006 Shooting 17 Deepika Kumari
1. Identify the attribute best suitable to be declared as a primary key
A. CoachName B. Noofplayers C. SportName D. SCode
Answer: D
2. What will be the degree and cardinality of the SPORTS table.
A. Degree: 4 Cardinality: 4 B. Degree: 4 Cardinality: 6
C. Degree: 4 Cardinality: 7 D. Degree: 7 Cardinality: 7
Answer: B

3. Which of the following command will be used to describe the structure of the table.
A. DESC SPORTS B. DESCRIBE SPORTS C. Both A and B D. None of the
Above
Answer: C
4. Sahil wants to delete the column coachname.Which command will he use from the following:
A. DELETE Coachname FROM SPORTS; B. ALTER Coachname FROM SPORTS;
C. ALTER TABLE SPORTS DROP Coachname; D. DELETE Coachname FROM SPORTS;
Answer: C

MCQ
1.Single Line comments in Python begin with …… symbol.
a) #
b) %
c) ;
d) “
Ans)a) #
2.The extension of Python file is given as –
a) .ppt
b ) .py
c) .pdoc
d).ppp
Ans) b ) .py
3.Which of the following is an invalid statement ?

PAGE
21
a) I=J=K=50
b) I,J,K=50,60,70
c) I J K =50 60 70
d) I_J_K=70
Ans) c)I J K =50 60 70

4.What will be the output of the following code ?


x,y=2,6
x,y=y,x+2
print(x,y)
a) 66
b) 44
c) 46
d) 64
Ans) d) 6 4
5.What will be the output of the following expression
12 * ( 13%4 ) // 2 + 6
a) 55 b) 24 c ) 22 d) 12
Ans) d) 12

6.Shivi has written the following program but she is not getting the desired result .Why ? a=input(“enter a number”)
b=input(“enter 2nd Number”)
c=a+b
print(c)
a) wrong coding
b) type casting problem
c) formula of sum is incorrect
d) none
Ans) b) type casting problem
7.The given program has an error , find out the correct option with line number.
10=a #Line 1
b=45 #Line 2
a+b=c #Line 3
print( c ) #Line 4
PAGE
22
Error in line number …
a) 1 b) 2 c) 3 d) 1 & 3
Ans) d) 1 & 3
8.What will be the output of the following code
print( ‘H’ in ‘Hello’)
a) Hello
b ) hello
c ) true
d ) None
Ans) c ) true
9.Slicing is used to retrieve a …… of values .
a) Subset
b) 2 values
c) big values
d)All of these
Ans) a) Subset
10.An identifier must be a keyword of Python
a) True
b ) False
Ans) b ) False
11.What do we use to define a block of code in Python language?
a) Key
b) Brackets
c) Indentation
d) None of these
Ans) c) Indentation
12.What is the answer to this expression, 22 % 3 is?
a) 7
b) 1
c) 0
d) 5
Ans) b) 1
PAGE
23
13.What error occurs when you execute the following Python code snippet?
apple = mango
a)SyntaxError
b)NameError
c)ValueError
d) TypeError
Ans) b)NameError
Short Answer Type Questions
1.Python is an interpreted language‟. What does it mean to you?
Ans- It means that the Python installation interprets and executes the code line by line at a time.
2. What does a cross platform language mean?
Ans- it means a language can run equally on variety of platforms-Windows, Linux/UNIX, Macintosh,
Supercomputers, Smart phones etc.
3. Python is a Free and Open Source language. What do you understand by this feature?
Ans- It means Python is freely available without any cost. Its source code is also available. One can modify,
improve/extend an open source software.
4. In how many ways, can you work in Python?
Ans-In two ways we can work in Python- (i) Interactive mode (ii) Script Mode
5. What is the difference between Interactive mode and Script Mode in Python?
Ans- In interactive mode, one command can run at a time and commands are not saved. Whereas in Script mode, we
can save all the commands in the form of a program file and can see output of all lines together.
Competency Based Questions
1. Which of the following are not valid strings in Python?
(a)”Hello” (b) „Hello‟ (c)”Hello‟ (d) „Hello” (e) {Hello}
Ans- String (c) , (d) and (e ) are not valid strings.
PYTHON FUNDAMENTALS
Very Short answer Type Questions
1. What is None literal in Python?
Ans: Python has one special literal, which is None. The None literal is used to indicate absence of value. It is also
used to indicate the end of lists in Python. It means “There is nothing here”.
2. What is the error in following code: x, y =7 ?
Ans: The following error comes - 'int' object is not iterable. Which means an integer object i.e. cannot be repeated for
x and y. one more integer object is required after 7.

PAGE
24
3. what will the following code do: a=b=18 ?
Ans: This code will assign 18 to a and b both.
4. Following code is creating problem X = 0281, find reason.
Ans: 0281 is an invalid token.
5. Find the error in the following code:
(a) temp=90 (b) a=12 (c) print(“x=”x)
print temp b=a+b
print( a And b)
(d) a, b, c=2, 8, 4 (e) x = 23 (f) else = 21-4
print(a, b, c) 4=x
c, b, a = a, b, c
print(a; b; c)
Ans: (a) Missing parentheses in call to 'print'.
(b) Name „b‟ is not defined.
(c) Invalid Syntax.
(d) Invalid Syntax in second print statement.
(e) can't assign to literal in second line.
(f) Invalid Syntax.
6 Find the error in the following code:
(a) y = x +5 (b) a=input(“Value: “)
print(x,y) b = a/2
print( a, b)
Ans: (a) Name 'x' is not defined.
(b) Unsupported operand type(s) for /: 'str' and 'int'.
Short Answer Type Questions
1. What is the difference between a keyword and an identifier?
Ans: Difference between Keyword and Identifier: Every language has keywords and identifiers, which are only
understood by its compiler. Keywords are predefined reserved words, which possess special meaning. An identifier
is a unique name given to a particular variable, function or label of class in the program.
2. What are literals in Python? How many types of Literals allowed in Python?
Ans: Literals: Python comes with some built-in objects. Some are used so often that Python has a quick way to make
these objects, called literals. The literals include the string, Unicode string, integer, float, long, list, tuple and
dictionary types

PAGE
25
3. How many types of sequences are supported in Python?
Ans: Three Types of Sequences are supported in python: (i) String (ii) List (iii) Tuple
4. What factors guide the choice of identifiers in program?
Ans: (i) An identifier must start with a letter or underscore followed by any number of digits and/or letters.
(ii) No reserved word or standard identifier should be used.
(iii) No special character (Other than underscore) should be included in the identifier.
5. What is the difference between an expression and a statement in Python?
Ans: A statement is an instruction that the Python interpreter can execute. We have only seen the assignment
statement so far. Some other kinds of statements that we‟ll see shortly are while statements, forstatements, if
statements, and import statements. (There are other kinds too!)
An expression is a combination of values, variables, operators, and calls to functions. Expressions need to be
evaluated. If you ask Python to print an expression, the interpreter evaluates the expression and displays the result.
6. What is block/code block/suit in Python?
Ans: Sometimes a group of statements is part of another statement of function. Such a group of one or more
statements is called block or code-block or suit in python. e.g.

7. What is the role of indentation in Python?


Ans: Indentation plays a very important role in Python. Python uses indentation to create blocks of code. Statements
at same indentation level are part of same block/suit. You cannot unnecessarily indent a statement; python will raise
an error for that.
Skill Based Questions
1 What will be the sizes of following constants?
(a) „\a‟ (b) “\a” (c) “Kumar\‟s” (d) „\”‟ (e) “it‟s”
Ans: (a) 50 (b) 50 (c) 56 (d) 50 (e) 53
2 How can you create multi-line strings in Python?
Ans: We can create multi-line string by putting a backslash (\) at the end of line which allows you to continue typing
in next line in same string.
3 Which of the following are syntactically correct strings?
(a) ”Python is nice Language”
(b) „He called me “Friend!” when he came‟
(c) “Very Good‟
(d) „This is a good book‟

PAGE
26
(e) “Namaste
(f) “I liked „Harry Potter‟ very much”
Ans: (a) Correct
(b) Correct
(c) Incorrect
(d) Correct
(e) Incorrect
(f) Correct
4 What is the error in following Python program with one statement?
print(“My name is : “, name)
suggest a solution
Ans: Error is : “name 'name' is not defined”. And the solution is to declare the variable-name before this statement.

5. Predict the output of the following:


x, y=7, 2
x, y, x=x+1, y+3, x+10
print(x,y)
Ans: Output: 17 5
6. What will be the output of the following code:

Ans: Output: Hari , you are 18 now but You will be 19 next year.
7. Predict output:

Ans: Output: 4 6 8
8. WAP to print the area of circle when radius of the circle is given by user.
Ans:

PAGE
27
9. WAP to print the volume of a cylinder when radius and height of the cylinder is given by user.
Ans:

10. WAP to calculate simple interest.


Ans

DATA HANDLING
Very Short answer Type Questions
1. Identify the data types of the following values given bellow –
3, 3j, 13.0, “12‟,”14”, 2+0j,19, [1,2,3],(3,4,5)
Ans: 3 – int 3j – complex 13.0 – float “12‟ – string “14” – string 2+0j – complex 19 – int
[1,2,3] – list (3,4,5) – tuple
2. What will be the output of the following
(a)12/4 (b)14//14 (c)14%4 (d) 14.0/4 (e) 14.0//4 (f)14.0%4
Ans: (a) 3.0 (b) 1 (c) 2 (d) 3.5 (e) 3.0 (f) 2.0
3. What will be the output of the following ?

Ans:
4
4.25
1
4
4. What will be the output of the following ?
(a)87//5 (b)(87//5.0) == (87//5) (c) 87//5.0 (d) 17%5.0

PAGE
28
Ans: (a) 17 (b) True (c) 17.0 (d) 2.0
5. int(„a‟) produces error. Why?
Ans: This is because „a‟ is an invalid literal for int() with base 10.
6. Write following expressions in Python.

Ans:
(a) (b*b*h)/3
(b) d=math.sqrt(pow(x2-x1,2)+pow(y2-y1,2))
(c) x1=((-b) + math.sqrt((b*b)-(4*a*c)))/(2*a) x2=((-b) - math.sqrt((b*b)-(4*a*c)))/(2*a)
(d) pow(a,n) * pow(a,m) = pow(a,m+n)
Short Answer Type Questions
1. What are data types? What are Python‟s built-in core data types?
Ans: Every value in Python has a datatype. Since everything is an object in Python programming, data types are
actually classes and variables are instance (object) of these classes. There are various data types in Python. Some of
the important types are listed below.
(i) Numbers (ii) String (iii) List (iv) Tuple (v) Dictionary
2. Which data types of Python handle Numbers?
Ans: It is cleared by name that Number data types are used to store numeric value in Python. The Numbers in Python
have following core data types:
(i) Integers a. Integers (signed) b. Booleans (ii) Floating-Point Numbers (iii) Complex Numbers
3. Why is Boolean considered a subtype of Integers?
Ans: Because Boolean Values False and True behave like the values 0 and 1, respectively. So Boolean type is a
subtype of plain integers.
4. What do you understand by term „immutable‟?
Ans: Immutable types are those data types that can never change their value in place. In Python the following types
are immutable:
(i) integers (ii) floating-point numbers (iii) Booleans (iv) Strings (v) Tuples
5. What will be the output of the following code? Why?
(a) 13 or len(13) (b) len(13) or 13
Ans: (a) 13 (b) TypeError: object of type 'int' has no len().
6. What are mutable and immutable types in Python? List both of them.
Ans: Mutable types means those data types whose values can be changed at the time of execution. They are as
follows:

PAGE
29
 Lists  Dictionaries  Sets
Immutable types are those data types that can never change their value in place. In Python the following types are
immutable:
 integers  floating-point numbers  Booleans  Strings  Tuples
7. What are augmented assignment operators? How are they useful?
Ans: An augmented assignment is generally used to replace a statement where an operator takes a variable as one of
its arguments and then assigns the result back to the same variable. A simple example is x += 1 which is expanded to
x = x + (1). Similar constructions are often available for various binary operators. They are helpful in making the
source code small.
Skill Based Questions
1. WAP to calculate compound simple interest after taking the principle, rate and time.
Ans:

2. WAP to check the given year is leap year or not.


Ans:

3. WAP to take two numbers and check that the first number is fully divisible by second number or not.
Ans:

4. What will be the output of the following?

PAGE
30
Ans: -2
6561
5. What will be the output of the following?

Ans: 4.0
6. WAP to take value of x,y,z from the user and calculate the equation 4x4+3y3+9z2+6 π
Ans:

7. WAP to take the temperatures of all 7 days of the week and displays the average temperature of that week.
Ans:

CONDITIONAL AND ITERATIVE STATEMENTS


Short Answer Type Questions
1. What a range() function does? Give an example.
Ans: The range() function returns a sequence of numbers, starting from 0 by default, and increments by 1 (by
default), and ends at a specified number. its syntax is range(start, stop, step) e.g.

2. What are loops in Python? How many types of loop are there in Python?

PAGE
31
Ans: Loops are iteration constructs in Python. Iteration means repetition of a set of statements depending upon a
condition test. Loops has three basic elements within it to repeat the statements  Initialization (Start)
 Check Condition (Stop)
 Updation (Step)
Python provide two types of loop
(i) Conditional Loop while( (Condition based loop)
(ii) Counting loop for (loop for a given number of times).

EMERGING TRENDS
Question 1: List some of the cloud-based services that you are using at present.
Answer 1:
 Platform as a Service (PaaS) –
It is use for performing Online Coding.
 Infrastructure as a Service (IaaS) –
It is a web services. Ex. Amazon web service
 Software as a Service (SaaS) –
SaaS is web based software. Ex . Google map

Question 2: What do you understand by the Internet of Things? List some of its potential applications.
Answer 2:
Internet of things are related with the human, object, things, animals, car, door, etc. The all things, objects, or living
things are immerse with sensor, software, hardware or network for exchanging a data between other devices via
same network. With the help of IOT now we can convert our all daily appliances to smart appliances.
List some of its potential applications:
 Health care (patient monitoring system, hand sanitizations)
 Industry (Facility management, quality control)
 Domestic appliances (Automatic power off/on control , door locker)
 Agriculture (smart farm by using IOT sensor)
 Transportation (Vehicle tracking)

Question3. Write short notes on the following:


a) Cloud Computing
b) Big data and its Characteristics

PAGE
32
Answer 3:
a) Cloud computing:
Cloud computing is a service which is used to send data over the internet or cloud.
Simply, cloud is a service provider. There are so many Cloud Service Provider Companies are there. Some of them
provide free service and some are paid. We can also stored the the data in our cloud.
Basically, internet and cloud is somewhat same. There are three types of cloud services are there:
 SaaS: Software as a service provides services via internet for distribution. With the help of Saas an independent
one can interacts with the other clients for administrate the application.
 Paas: With the help of Platform as a service we can able to perform developing running, debugging like coding
operation. Paas is generally used for online coding.
 Iaas: Infrastructure as service provide a web service throughout the internet . Example: Amazon web service
b) Big data and its Characteristics:
As a name suggest it is about huge data manipulation including both structured and unstructured. By using big data
we can increase the quality of a data, optimize the data, and manipulate data easily. We know that, in todays, we are
all exchanging a data through mobile via internet. In result, the large volume of data is generated and it may be
critical also. This data is known as big data. The unstructured data like social media post, chat massages, images, etc.
with big volume are very fluently managed by the specialized tools of big data.
Following are the characteristics of big data:
1) Volume:
We know that the big data itself is huge in size. Volume of a big data is related with the size of data
2) Velocity:
The velocity of big data is directly related with how much data is created And getting structured in a stroke from
different sources.
3) Verity:
When we browsing, searching or do internet surfing. At that we are dealing with different types of data like music,
images, text, videos etc. Some of them are structured, semi structured or unstructured. Big data can daily with
different type of verities of data.
4) Veracity:
It is defined a correctness of data. The data which will be stored, it must be meaningful. Because interpreting
incorrect data may cause wrong result.

Question 4. Explain the following along with their applications.


a) Artificial Intelligence
b) Machine Learning
Answer 4:
a) Artificial Intelligence:
In general term, AI is defined as to make a machine smart as it can do the task better than human. AI means to put a
human intelligent into machine. Ai works like a human being. We have to trained our machine with information and
knowledge. And machine also learnt from them. As well as from its past experience. As named suggest, we have to
put intelligent artificially into the machine
Here are the some example of AI:
 Siri
PAGE
33
 Google voice
 Alexa,Etc
b) Machine Learning
Machine learning is a part or application of artificial intelligence. Machine learning provide ability to teach, learn,
expertise the machine without any human efforts. Four basic steps are there for building a machine learning
application:
1. Select and prepare :
Firstly, we have to prepare a training dataset with respective data for particular machine learning model.
2. Choose an algorithm:
Then we have to choose a appropriate algorithm. It tells as how our machine learning model processes our model
flow. There are two types of algorithms: Labeled and unlabeled
3. Training:
It is all about the checking, running, comparing and adjusting a result with the required output.
4. Improving the model:
The last step is improving quality, correctness, efficiency of a model with respect to time and size.

Question 5. Differentiate between cloud computing and grid computing with suitable examples.
Answer 5:

Cloud computing Grid computing

Cloud computing is client server Grid computing is distributed server


architecture architecture

In cloud computing, resources are used In grid computing, resources are used in
in centralized pattern collaborative pattern

Cloud service is a paid service grid service is a free service

It is more flexible It is less flexible

Example: Salesforce, hubspot Example: Bluegrid, DISCOM

Question 6. Justify the following statement: “Storage of data is cost-effective and time saving in cloud computing.”
Answer 6:

PAGE
34
While working on internet or any system, we create different types of files and folders, etc. This data is stored in
our local hard disk. But now a days the volume of data are increased day by day. At the time our local hard disks
and a primary storage is not sufficient for storage. And when you go for purchasing external memory or external disk
for storing a data, it requires lot of money. When this type of situation occurs, to overcome the situation we can use
cloud computing. In cloud computing we have to just purchase a service not storage. So it will be effective
than previous. In cloud computing we just need internet service and revenant data. Hence storage data is cost
effective and time saving in cloud computing.

Question 7. What is on-demand service? How it is provided in cloud computing?


Answer 7:
On-demand service is like a gate and drop service. Whenever the customer required cloud service for particular time
he or she can purchase it and whenever the task is completed, he or she can drop the service. On demand service
provides services to the customer or client according to their needs. Example: If a company XYZ want a service for a
particular project and for a particular time only. At that time they would be purchase this service and dropout after
the completion of project.

Question8. Write examples of the following:


1. a) Government provided cloud computing platform
2. b) Large scale private cloud service providers and the services they provide
Answer 8:
1. a) Government provided cloud computing platform : MeghRaj is cloud service which is provided by government.
2. b) Large scale private cloud service providers and the services they provide : the most commonly large scale
private cloud platform is AWS. Amazon Web Service is Iaas (Infrastructure as a service) cloud platform

Question9: 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 customized applications. What type of cloud computing model fits these requirements?
1. a) Platform as a Service
2. b) Software as a Service
3. c) Application as a Service
4. d) Infrastructure as a Service

Answer 9: “Infrastructure as a service” provides a platform for deploying and running customized application.

Question10. If the government plans to make a smart school by applying IoT concepts, how can each of the
following be implemented in order to transform a school into IoT-enabled smart school?
1. a) e-textbooks
2. b) Smart boards
3. c) Online Tests
PAGE
35
4. d) Wifi sensors on classrooms doors
5. e) Sensors in buses to monitor their location
6. f) Wearables (watches or smart belts) for attendance monitoring.

Answer 10:
e-textbooks : By using IOT we can available digital book to student for get access from anytime and anywhere.
Smart boards: With the help of IOT we can make a school board work like a tablet. Instead of chalk we can use
wireless pen and our hand as a duster.
Online Tests: We can take test virtually. And observe the student via camera and facial We can also check the
answer digitally.
Wifi sensors on classrooms doors: With the help of IOT we can make our door smart. For example, whenever the
student enters in classroom, automatically his/her attendance noted.
Sensors in buses to monitor their location: for the safety purpose of student w can track the student via GPS sensor
which is monitarized by their parents.
Wearables (watches or smart belts) for attendance monitoring: with the help of wireless sensor, we can track the
attendance of students through their watches. Whenever the student enters in classroom the attendance will get
marked.

Question 11. Five friends plan to try a startup. However, they have a limited budget and limited computer
infrastructure. How can they avail the benefits of cloud services to launch their startup?

Answer 11:
Cloud service applies charges only for service no for storage and resource. Once we purchase any service, it will be
for a lifetime. And we can store a large amount of data into it. Infrastructure as a service is a best service for a startup
plans
Question 12. Governments provide various scholarships to students of different classes. Prepare a report on how
blockchain technology can be used to promote accountability, transparency and efficiency in distribution of
scholarships?

Answer 12:
The blockchain technology works on the concept of decentralised and shared databases where each computer has a
copy of the database. So if the Government avails this technology then all the scholarship applicants will have a view
access to other applicants’ applications. So in this way there will be transparency in distribution of scholarships
because they can view on what basis the Government is giving scholarships.

Question 13. How are IoT and WoT related?

PAGE
36
Answer 13:
IOT is a internet of thing which is related with things like object which we will use daily. And WoT is web of things
which is responsible to connect those IOT things to the web and communicate with the help of various devices like
sensor.

Question 14. Match the columns:

Column A Column B

1. You got a reminder to take medication A. Smart Parking

2. You got an SMS alert that you forgot B. Smart wearable


to lock the door

3. You got an SMS alert that parking


space is available near your block C. Home Automation

4. You turned off your LED TV from D. Smart Health


your wrist watch

Answer 14:

1. You got a reminder to take medication D. Smart Health

2. You got an SMS alert that you forgot


to lock the door C. Home Automation

3. You got an SMS alert that parking A. Smart Parking


space is available near your block

4. You turned off your LED TV from B. Smart wearable


your wrist watch

KENDRIYA VIDYALAYA SANGATHAN, RAIPUR REGION


INFORMATICS PRACTICES (065)
MODEL SAMPLE PAPER 1
CLASS: XI
Time: 3 Hrs. Max Marks: 70
General Instructions:
1. This question paper contains two parts A and B. Each part is compulsory.
2. Part-A has Multiple choice Question/short answer questions.
3. Part - B is Descriptive Paper which have some internal options.
PART-A
PAGE
37
SECTION I (15 Marks)
Attempt any 15 questions from questions 1 to 21 (Each Question Carry 1 Mark)
Q1. _________________ is a type of system software that translates and executes instructions 1
written in a computer program in one go.
Q2. The key component of second generation computer was _____________ 1
a. Vacuum Tube b. Integrated Circuit c. Transistor d. VLSI

Q3. An Antivirus software is an example of 1


a) Application Software b) System software
c) Utility software d) None of these
Q4. First time, Integrated Circuits (ICs) are related to _________ generation of computers? 1
A) First generation B) Second generation
C) Third generation D) Fourth generation
Q5. In which term, you measure the memory? 1
Q6. Start with the list[10, 100, 200,300]. Do the following using list functions -Remove the first 1
entry from the list.
Q.7 What will the following code do? 1
p = q = r =3
Q.8 Harshwardhan wants to store True, Help him to choose the correct data type in Python. 1
Q.9 What will be the output of following code : print(“5” * 5) 1
a. 25 b. 55 c. 55555 d. error
Q.1 To store data of an employee into EMP table, we will use 1
0 a. Create table b. Select c. Insert into d. None of all

Q.1 Kripali is executing the following query but it is giving error, Help her to correct the same. 1
1 Select ecode ename sal from employee;

Q.1 To display list of all tables in a database we will use 1


2 a. Select tables b. Show Tables c. select databases d. show databases

Q.13 Name two DML commands. 1

Q.1 To get the following output we will use 1


4 10 SCIENCE BIKANER

a. Select * from ABC where dname=”SCIENCE”


b. Select * from ABC where dept=10
c. Select * from ABC where ADDRESS=’BIKANER”
d. All are correct
Q.1 Write the full form of SQL 1
5
Q.1 What does IoT stand for? 1
6
Q.1 “ab” in “Abcd” will return 1
PAGE
38
7 a. True b. False c. ab d. Ab

Q.1 Write the full form of AR and write in one sentence about AR? 1
8
Q.1 __________provides a platform or environment to develop, test and delivers software 1
9 application.
Q.2 Name the technology works on the concept of decentralized and shared database. 1
0
Q.21 Differentiate between CHAR and VARCHAR Datatypes. 1

PART A
SECTION II
Two case studies questions. Each case study has 4 case-based subparts.
Attempt any 4 out of the 5 subparts.
Answer question 22-23 based on the table EMPL given below

Q22 a) Display EmpNo and EName of all employees from the table empl. 1
b) Display employee name, salary, and department number who are not getting commission 1
from table empl.
c) Display employee number, name, sal*12 as Annual salary whose commission is NULL from 1
table empl.
d)Give degree and cardinality of the above table. 1
e)Display the details of all employee whose annual salary is between 25000 to 40000 1
Q23. a) Using SQL statements in MySQL, create the Database Name: Univ also write a query to 1
open the database Univ.
Answer parts b), c), d) on the basis of the structure table job.
Name of ColumnType
Job_ID Integer(4)
Job_des Varchar(30)
Alloc_on Date
Due_on Date
Emp_id Integer(4)
PAGE
39
b) Create a table Job with the specification given above. 1
c) Identify the primary and alternate key. 1
d) Insert 2 records into the table Job. 1
e) How will you enlist the name of database and the tables in a database? 1

PART B
SECTION-I
Short answer questions of 2 marks each in which two questions have internal options.
Q24. Explain Where and ORDER BY clause with proper examples. 2
Q.25 What are the different divisions of SQL commands? Give example 2

Q. What is the error in following code. Rewrite the correct code and underline the correction. 2
26. Weather = ’raining’
If weather = ’sunny’
print(‘wear sunblock’)
elif weather = ’snow’:
print(‘Going skiing’)
else:
print(“None of the above’)

Q 27. Write the corresponding Python assignment statement. 2


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.

Q28. What will be the output of the following? (Attempt any 2) 2


a) print(17//4)
b) print(17/4)
c) print(14%4)
d) 14.0//4

Q29. a) Identify the different types of following python literals and place them in correct type. 1
23.789 “TRUE” 1232 False
1
b) What are comments? Why do we use comments in Python Programming?
Explain with Example.
OR 2
Write a Python Program which input five numbers and display their average.
Q30. What do you mean by FOSS? Give two examples of any two FOSS. 2
OR
What do you mean by Proprietary Software? Give examples of any two Proprietary Software.
Q 31. Siyahas discarded old, broken and malfunctioning Hard Disk without taking care to delete 2
data. Is it harmful in respect of security concern ? Justify your answer.

PAGE
40
Q 32 Write the output of the following: 2
L=[10,20,30,40], L1=[500,600] , L2=[35,45]
L1.extend(L2)
L.insert(25,2)
print (L1+L2)
print(L1)
print(L.index(30))
print (L2*2)
Q 33. a) How is clear( ) function different from del Statement? 1
b) What is the output produced by the following code – d1={5:[6,7,8],”a”: 1
[1,2,3]} print(d1.keys())
print(d1.values( ))

PART B
SECTION II
Long answer questions of 3 marks each in which one question has question has internal
option.
Q 34. a) How Primary Memory is different from Secondary Memory? Explain at least 4 differences. 2
b) What is Big Data? Name its 3 characteristics.
1

Q 35. Find out the output: sampleList = [10, 20, 30, 40, 50] 3
print(sampleList[-2])
print(sampleList[-4:-1])
OR
L=["Hello",[6,7,8],3,"Riya"]
Consider the above list and answer the following
print(L[3:])
print(L[::2])
print(L[1:2])
print(L[1][1])
Q 36. Consider the “Sales” table in mysql: 3

Ecode Ename Address dojoin Amount Area


100 Amit Delhi 2017/09/29 5000.90 East
101 Sushant Gurgaon 2018/01/01 7000.75 East
102 Priya Noida 2018/04/25 3450.45 West
103 Mohit Delhi 2018/11/03 6000.50 North
104 Priyanshi Delhi 2019/12/15 8000.62 North
a) To display the employee name and amount for east area.

b) Which of the following command(s) will display all sales whose date of joining is after
31st March 2018.
i. Select * from Sales where dateofjoin>=”31-03-2018”;
ii. Select * from Sales where dojoin>=”2018-03-31”;
iii. Select * from Sales where dojoin>”2018-03-31”;

PAGE
41
iv. Select * from Sales where dojoin>”2018/03/31”;

c) Write a sql query to display the name of the oldest employee first then 2nd oldest and so
on.

Q 37. Give the output of the following queries based on the table mentioned in previous 3
question.
a) select Area, Ename as Employee, amount *0.01 as PF from Sales where
Area=”East” OR Area=”West;
b) select Ename, amount from sales where amount between 5000 and 7000;
c) select * from sales where dojoin>”2019-12-15” OR dojoin<”2017-09-29”;

PART B
SECTION III
Very long answer questions of 5 marks each in which one question has question has
internal option.

Q 38. WAP to create a dictionary named year whose keys are month names and values are their 5
corresponding number of days and display the dictionary (Use any iteration statement)

OR

WAP that repeatedly asks the user to enter product names and prices. Store all of them in a
dictionary whose keys are product names and values are prices. And also write a code to
search an item from the dictionary.

39. Suppose your school management has decided to conduct cricket matches between students of 5
class XI and Class XII. Students of each class are asked to join any one of the four teams —
Team Titan, Team Rockers, Team Magnet and Team Hurricane.
During summer vacations, various matches will be conducted between these teams.
Help your sports teacher to do the following(Using SQL)

a) Create a database “Sports”.


b) Create a table “TEAM” with following considerations:
• It should have a column TeamID for storing an integer value between 1 to 9, which
refers to unique identification of a team.
• Each TeamID should have its associated name (TeamName), which should be a string
of length not less than 10 characters.
c) Show the structure of the table TEAM using SQL command.
d) As per the preferences of the students four teams were formed as given below. Insert
these four rows in TEAM table:
Row 1: (1, Team Titan)
Row 2: (2, Team Rockers)
Row 3: (3, Team Magnet)
Row 4: (4, Team Hurricane)
e) Show the contents of the table TEAM.
PAGE
42
Q 40. Write a Python Program to print following Pattern using print statement (using loops) 5
A
AA
AAA
AAAA
AAAAA

OR
*****
****
***
**
*

= = = = = = = = = = = = All The Best = = = = = = = = = = =

KENDRIYA VIDYALAYA SANGATHAN RAIPUR REGION


INFORMATICS PRACTICES (065)
SAMPLE QUESTION PAPER 2
CLASS: XI
Time: 3 Hrs. Max Marks: 70
General Instructions:
4. This question paper contains two parts A and B. Each part is compulsory.
5. Part-A has Multiple choice Question/short answer questions.
6. Part - B is Descriptive Paper which have some internal options.
PART-A
SECTION I (15 Marks)
Attempt any 15 questions from questions 1 to 21 (Each Question Carry 1 Mark)
Q.1 _________________ is a type of system software that translates and executes 1
instructions written in a computer program line-by-line.

PAGE
43
Q.2 The Central Processing Unit (CPU) consists of: 1
a)input, output and processing
b) control unit, primary storage & secondary storage
c) control unit, arithmetic-logic unit, primary storage
d) control unit, processing, primary storage
Q.3 An Antivirus software is an example of 1
a) Application Software b) System software
c) Utility software d) None of these
Q.4 First time, Integrated Circuits (ICs) are related to ____________ generation of 1
computers?
A) First generation B) Second generation
C) Third generation D) Fourth generation
Q.5 RAM and ROM are the types of____ memory. 1
Q.6 Start with the list[8,9,10]. Do the following using list functions - 1
Remove the first entry from the list.
Q.7 What will the following code do? 1
a=b=18
Q.8 Shyam wants to store 75.5, Help him to choose the correct data type in Python. 1
Q.9 The mode of Python gives instant result of typed statement. 1
(a) Interactive mode (b) Script mode
(c) Combination of interactive and script modes (d) All of these
Q.10 The number of tuples in a relation are called____________. 1
Q.11 Riddhi is executing the following query but it is giving error, Help her to correct the 1
same.
Select id name from employee;
Q.12 ___________SQL command is used to open database. 1
Q.13 Name two DDL commands. 1
Q.14 Out of these, which of the following is not an advantage of SQL. 1
a) Easy to use
b) portable
c) slow speed
d) No coding required
Q.15 Out of the following which is not the naming rule of SQL table 1
a) should begin with a number
b) name can either be upper or lower case letters.
Q.16 What does IoT stand for? 1
Q.17 _________________comprises of algorithm that use data to learn on their own and 1
make predictions.
Q.18 Robotics can be defined as the science associated with the ___________,_________ , 1
theory and application of robots.
Q.19 __________provides a platform or environment to develop, test and delivers software 1
application.
Q.20 Name the technology works on the concept of decentralized and shared database. 1
PAGE
44
Q.21 Differentiate between CHAR and VARCHAR Datatypes. 1
PART A
SECTION II
Two case studies questions. Each case study has 4 case-based subparts.
Attempt any 4 out of the 5 subparts.

Answer question 22-23 based on the table given

Q22 a)Display EmpNo and EName of all employees from the table empl. 1
b)Display employee name, salary, and department number who are not getting 1
commission from table empl.
c)Display employee number, name, sal*12 as Annual salary whose commission is 1
NULL from table empl.
d)Give degree and cardinality of the above table. 1
e)Display the details of all employee whose annual salary is between 25000 to 40000 1
Q23. a)Using SQL statements in MySQL, create the Database Name: Univ also write a 1
query to open the database Univ.
Answer parts b), c), d) on the basis of the structure table job.
Name of ColumnType
Job_IDInteger(4)
Job_desVarchar(30)
Alloc_on Date
Due_on Date
Emp_idInteger(4)
b)Create a table Job with the specification given above. 1
c)Identify the primary and alternate key. 1
d)Insert 4 records into the table Job. 1
e)How will you enlist the name of database and the tables in a database? 1
PART B
SECTION-I
Short answer questions of 2 marks each in which two questions have internal
options.
Q24. Explain Where and ORDER BY clause with proper examples. 2
PAGE
45
Q.25 What are the different divisions of SQL commands? Give example 2

Q. What is the error in following code. Rewrite the correct code and underline the 2
26. correction.
Weather=’raining’
If weather=’sunny’
print(‘wear sunblock’) elif
weather=’snow’:
print(‘Going skiing’) else:
print(“None of the above’)
Q 27. Write the corresponding Python assignment statement. 2
c) Assign 10 to a variable height and 20 to a variable weight.
d) Assign the sum of height and weight to a variable total.
Q28. (Attempt any 2) 2
What will be the output of the following ?
e) print(17//4)
f) print(17/4)
g) print(14%4)
h) 14.0//4
Q29. c) Identify the different types of following python literals and place them in correct 1
type.
23.789 “TRUE”
1232
False 1
d) What are comments? Why do we use comments in Python Programming?
Explain with Example.
OR 2
Write a Python Program which input five numbers and display their average.
Q30. What do you mean by FOSS? Give two examples of any two FOSS. 2
OR
What do you mean by Proprietary Software? Give examples of any two Proprietary
Software.
Q 31. Siyahas discarded old, broken and malfunctioning Hard Disk without taking care to 2
delete data. Is it harmful in respect of security concern ? Justify your answer.
Q 32 Write the output of the following: 2
L=[10,20,30,40], L1=[500,600] , L2=[35,45]
L1.extend(L2)
L.insert(25,2)
print (L1+L2)
print (L1) print
(L.index(30))
print (L2*2)
Q 33. c) How is clear() function different from del Statement? 1
d) What is the output produced by the following code – d1={5: 1
[6,7,8],”a”:[1,2,3]} print(d1.keys())
print(d1.values())

PAGE
46
PART B
SECTION II
Long answer questions of 3 marks each in which one question has question has
internal option.
Q 34. c) How Primary Memory is different from Secondary Memory? Explain at least 4 2
differences.
d) What is Big Data? Name its 3 characteristics. 1

Q 35. Find out the output: sampleList = 3


[10, 20, 30, 40, 50]
print(sampleList[-2])
print(sampleList[-4:-1])

OR
L=["Hello",[6,7,8],3,"Riya"]
Consider the above list and answer the
following print(L[3:]) print(L[::2]) print(L[1:2])
print(L[1][1])
Q 36. Consider the “Sales” table in mysql: 3
Ecode Ename Address dojoin Amount Area
100 Amit Delhi 2017/09/29 5000.90 East
101 Sushant Gurgaon 2018/01/01 7000.75 East
102 Priya Noida 2018/04/25 3450.45 West
103 Mohit Delhi 2018/11/03 6000.50 North
104 Priyanshi Delhi 2019/12/15 8000.62 North
d) To display the employee name and amount for east area.
e) Which of the following command(s) will display all sales whose date of joining is
after 31st March 2018.
i. Select * from Sales where dateofjoin>=”31-03-2018”;
ii. Select * from Sales where dojoin>=”2018-03-31”;
iii. Select * from Sales where dojoin>”2018-03-31”;
iv. Select * from Sales where dojoin>”2018/03/31”;
f) Write a sql query to display the name of the oldest employee first then 2nd oldest
and so on.
Q 37. Give the output of the following queries based on the table mentioned in previous 3
question.
d) select Area, Ename as Employee, amount *0.01 as PF from Sales where
Area=”East” OR Area=”West;
e) select Ename, amount from sales where amount between 5000 and 7000;
f) select * from sales where dojoin>”2019-12-15” OR dojoin<”2017-09-29”;
PART B
SECTION III
Very long answer questions of 5 marks each in which one question has question has
internal option.
Q 38. WAP to create a dictionary named year whose keys are month names and values are their 5
corresponding number of days and display the dictionary (Use While loop)
PAGE
47
OR
WAP that repeatedly asks the user to enter product names and prices. Store all of them
in a dictionary whose keys are product names and values are prices. And also write a
code to search an item from the dictionary.
Q 39. Suppose your school management has decided to conduct cricket matches between 5
students of class XI and Class XII. Students of each class are asked to join any one of
the four teams — Team Titan, Team Rockers, Team Magnet and Team Hurricane.
During summer vacations, various matches will be conducted between these teams.
Help your sports teacher to do the following(Using SQL)
c) Create a database “Sports”.
d) Create a table “TEAM” with following considerations:
• It should have a column TeamID for storing an integer value between 1 to 9,
which refers to unique identification of a team.
• Each TeamID should have its associated name (TeamName), which should be a
string of length not less than 10 characters.
f) Show the structure of the table TEAM using SQL command.
g) As per the preferences of the students four teams were formed as given below.
Insert these four rows in TEAM table:
Row 1: (1, Team Titan)
Row 2: (2, Team Rockers)
Row 3: (3, Team Magnet)
Row 4: (4, Team Hurricane)
h) Show the contents of the table TEAM.
Q 40. Write a Python Program to print following Pattern using print statement (using loops) 5
*
**
***
****
*****

OR
55555
4444
333
22
1

KENDRIYA VIDYALAYA SANGATHAN, RAIPUR REGION


SESSION - 2022 – 23
CLASS XI : INFORMATICS PRACTICES(065)

MODEL TEST PAPER


PAGE
48
Marking Scheme

PART A
SECTION I
Attempt any 15 questions from 21 questions
1 What is the smallest unit of memory? 1
(a) bit (b) byte (c) Nibble (d) KB
Ans: (a) bit
2 Use of transistors started in ...................... 1
(a) First Generation
(b) Second Generation
(c) Third Generation
(d) Fourth Generation
Ans: (b) Second Generation
3 CPU is combination of ................ 1
(a) Input and CU
(b) ALU and CU
(c) Input and Output
(d) ALU and Input
Ans: ALU and CU
4 What is the correct order? 1
(a) Bytes>KB>MB>TB
(b) GB>MB>KB>Bytes
(c) MB>Bytes>KB>Bit
(d) KB>GB>Byts>MB

Ans: (b) GB>MB>KB>Bytes

PAGE
49
5 Washing Machine is example of 1
(a) Single User OS
(b) Multi User OS
(c) Real Time OS
(d) Embeded OS

Ans: (d) Embedded OS


6 Which of the following is a secondary memory device : 1
(a) Keyboard
(b) Hard disk
(c) ALU
(d) All of the above

Ans: (b) Hard Disk


7 …………….is known as father of computer. 1
Ans.: Charles Babbage
8 Does list in Python is mutable. (True/False) 1
Ans: True
9 Which of the following correct identifier name : 1
(a) 123name
(b) _simpleinterest
(c) My name
(d) 2312312

Ans: (b) _simpleinterest


10 Suppose List1 is [2,4,6,8,10]. What is List1[-1]? 1
Ans: 10
11 In dictionary key and values are: 1
(a) Mutable, mutable
(b) immutable, mutable
(c) Mutable, immutable
(d) immutable, immutable
Ans: (b) immutable, mutable
12 Which method is used to remove list elements? 1
Ans: pop() / remove()
13 Dictionary keys can be repeated. (True/False) 1
Ans: False

PAGE
50
14 Which function is used to print all the keys of dictionary? 1
(a) Values()
(b) Keys()
(c) Items()
(d) None of these

PAGE
51
Ans: (b) keys()
15 Which of the followings is DDL command : 1
(a) insert
(b) select
(c) create
(d) delete
Ans: (c) create
16 What is missing in following query: 1
Insert into employee ……….. (‘e01’, ‘Satya’, ‘Bombay’);
Ans: values
17 A table may contain more than one primary keys. (True/False) 1
Ans: False
18 The column of a table that points to the primary is : 1
(a) Primary Key
(b) Foreign Key
(c) Candidate Key
(d) Alternate Key
Ans: (b) Foreign key
19 MySQL is a ………… 1
(a) RDBMS
(b) DBMS
(c) Database
(d) Table
Ans: (a) RDBMS
20 In Like % and _ are : 1
(a) Clauses
(b) Commands
(c) Wild Cards
(d) All of these
Ans: (c) Wild Cards
21 Alphanumeric values are supported by which data type? 1
(a) CHAR
(b) DATE
(c) VARCHAR
(d) INTEGER

Ans: (c) VARCHAR

SECTION II
Both the case study based questions (22 & 23 ) are compulsory. Attempt any four sub parts from
each question. Each sub question carries 1 mark .

PAGE
52
22 Mrs. Vidya has created a list of marks of six students in her subject. List is as follows.
Consider the following list and give answer of any four questions from (i) to (v).
L = [45, 99, 80, 60, 86, 91]
(i) She wants to display marks in ascending order. Help her to write code to display marks in 1
ascending order.
Ans: print(L.sort())

(ii) Which output is correct for following code: 1


Print(L[2:6])
(a) [99,80,60,86,91]
(b) [45,99,80,60,86,91]
(c) [80,60,86,91]
(d) None of these
Ans: (c) [80,60,86,91]
(iii) She wants to delete 60 from list. What will be statement for this? 1
Ans: L.remove(60)
(iv) She wants to add a new element in list i.e. 100 at position 3. What is the correct statement for 1
this?
(a) L.append(3,100)
(b) L.extend(3,100)
(c) L.insert(3,100)
(d) None of these
Ans: (c) L.insert(3,100)
(v) What will output of 1
following: print(L*3)
Ans: [45, 99, 80, 60, 86, 91,45, 99, 80, 60, 86, 91,45, 99, 80, 60, 86, 91]
23 On the basis of table Travel as given below, answer any four questions out of (i) to (v).

NO NAME TDATE KM CODE NOP


101 Janish Kin 2015–11–13 200 101 32
103 Vedika Sahai 2016–04–21 100 103 45
105 Tarun Ram 2016–03–23 350 102 42
102 John Fen 2016–02–13 90 102 40
107 Ahmed Khan 2015–01–10 75 104 2
104 Raveena 2016–05–28 400 105 4
(i) Write sql query to create above table Travel. (Take data types according to values in columns). 1
Ans: create table Travel(NO int(3),Name char(15),TDATE date,KM int(3),CODE int(3),NOP

NO NAME TDATE KM
101 Janish Kin 2015–11–13 200
105 Tarun Ram 2016–03–23 350

PAGE
53
(ii) 1

Out of the following queries, which query will give the above output?

PAGE
54
(a) Select * from travel where km>200;
(b) Select * from travel where km>=200;
(c) Select no, name, tdate, km from travel where km>=200;
(d) Select no, name, tdate, km from travel where km between 200 and 350;
Ans: (d) Select no, name, tdate, km from travel where km between 200 and 350;
(iii) Neelima has given the following command to arrange the data in ascending order of date. 1
Select * from travel where order by tdate;
but she is not getting the desired result. Help her by choosing the correct command.
Select * from travel order by tdate;
(a) Select * from travel in ascending order;
(b) Select tdate from travel order by tdate;
Ans: (a) Select * from travel order by tdate;
(iv) Choose the correct command to display the name of the traveller whose travel date is after 1
2015?
(a) select name, tdate from travel where tdate > 2015;
(b) select name, tdate from travel where tdate < ‘2015-12-31’;
(c) select name, tdate from travel where tdate > ‘2015-12-31’;
(d) select * from travel where tdate < ‘2015-12-31’;
Ans: (c) select name, tdate from travel where tdate > ‘2015-12-31’;
(v) Which query is correct to display following output: 1
Janish Kin
John Fen
Ahmed
Khan

(a) Select * from Travel where name like ‘%n’;


(b) Select name from Travel where name like ‘_n’;
(c) Select name form Travel where name = ‘%n’;
(d) Select name from Travel where name like ‘%n’;
Ans: (d) Select name from Travel where name like ‘%n’;
PART B
SECTION I
24 What is Operating System? Write any one example of Operating System. 2
Ans: Operating system is an interface between computer and
user. Example: Winows, DOS, Linux etc.
1 mark for correct definition and 1 mark for correct example
25 What will be output of following code: 2
x = “I love
India” for i in x:
print(i,end=”,”)
Ans: i, ,l,o,v,e, ,i,n,d,i,a,
26 Evaluate the following expression: 2
a. 15//3 b. 12%4 c. 2**4 d. 6/3
PAGE
55
Ans.: a. 5 b. 0 c. 16 d. 2.0

PAGE
56
27 Write a program to print factorial of given number. 2
Ans: num = int(input("enter a number:
")) fact = 1.
for i in range(1, num +
1): fact = fact * i.
print("factorial of ", num, " is ", fact)

OR
Write a program to print largest number in given three numbers.
Ans: n1= int(input("Enter first number"))
n2 = int(input("Enter second
number")) n3 = int(input("Enter
third number")) if(n1 >= n2) and
(n1>=n3):
Max = n1
elif (n2 >=n1) and (n2>= n3):
Max = n2
else:
Max = n3
28 Find error in following code. Correct it and underline the corrections. 2
x= int(“enter value”))
For i in
range(0,11) if x
= i:
print(x+y
) else:
Ans: x= int(input(“enter value”))
for i in range(0,11):
if x ==
i: print(x+y)
else:
print(x-
29 y)
Suppose there is a table named student with 4 rows and 5 columns. 2 more rows added and one 2
column deleted from the table. What will be degree and cardinality of table student?
Ans: Degree: 4 Cardinality: 6
30 Write following query in alternate way that will give same result. 2
Select * from student where marks = 60 or marks = 80 or marks = 90 or marks = 100;
Ans: select * from student where marks in(60,80,90,100);
31 Write any two advantages of SQL. 2
Ans.: 2 Marks for any 2 correct advantages
OR
What is difference between DDL and DML?

PAGE
57
Ans: DDL DML

PAGE
58
1. Data definition language 1. Data manipulation language
2. These commands work on structure 2.These commands work on the
of table content of the table
3. Example: Create, drop 3.insert, select
32 Identify datatype of columns in following table: 2

Ans.: Name: char, Age : int/integer, Department: char, Dateofadm: date

33 Write any two limitations of Manual File system. 2

Ans.: (i) Data Redundancy: Redundancy means same data are duplicated in different places (files).
(ii) Data inconsistency: Data inconsistency occurs when same data maintained in
different places do not match.
SECTION II
34 Write brief note on followings: 3
a. Data capture b. Data Storage c. Data retrieval
Ans: a.Data capture: It Involves the process of gathering data from different sources in digital
form. b.Data Storage: It is the process of storing the captured data for processing.
c.Data Retrieval: It involves fetching the data from the storage devices for its processing as
per user requirement.
OR
Draw block diagram of Computer.

PAGE
59
Ans:

35 Write a Python program to find sum of all elements of a given list using for loop. 3
Ans.: L=[ ]
sum1=0
n = int(input(“Enter the number of elements”))
for i in range(n):
items = int(input(“Enter element”))
L.append(items)
Sum1 =
sum1+L[i]
print(L)
OR
Write a program that takes a list ‘L’ as an argument, adds 5 in all odd values and 10 in all even
values of the list L. Also display the list.
Ans.: L = [10,20,3,100,65,87,2]
for i in range(len(L)):
if L[i]%2==0:
L[i]=L[i]+10
else:
L[i]=L[i]+5
print(L)
36 Define below database concepts 3
a. Tuple
b. Data Redundancy
c. DML Commands
Ans: a. A tuple is simply a row in a table
b. Data redundancy occurs when the same piece of data exists in multiple places or Duplicate
entries of the customer name is considered redundant data
c. Data manipulation language (DML) statements add, change, and delete Database table
data eg insert,delete,insert etc.

PAGE
60
37 Consider the following tables product and sales, identify the primary keys of both tables and 3
foreign key.

PAGE
61
BILLNUMBER BILLDATETABLE : SALES
PRODUCTCODE QTY AMOUNT
79 03/03/2020 P1101 3 124
69 03/03/2020 K750 2 345
86 03/03/2020 K750 1 343
85 03/03/2020 P12 5 232
Ans: Primary Keys: PRODUCTCODE IN PRODUCTS TABLE
BILLNUMBER IN SALES
TABLE Foreign Keys: PRODUCTCODE IN
SALES TABLE SECTION III
38 Create a dictionary named cities with following details: 2
City names are keys: Indore, Khandwa, Bhopal, Agra, Umaria
Pincodes are values: 452001, 450001, 462001, 453115,453331
Ans.: cities = {‘Indore’:452001,’Khandwa’:450001,’Bhopal’:462001,’Agra’:453115, ’Umaria’:453331}
On the basis of above created dictionary cities, answer following questions:
(i) Remove Khandwa from dictionary Cities. 1
Ans.: cities.pop('Khandwa')
(ii) Write code to check whether Agra is present in dictionary or not. 1

Ans.: if 'Agra' in cities:


print("Agra is present in
dictionary") else:
print("Agra is not present in dictionary")
(iii) Write code to display keys from dictionary. 1
Ans.: print(cities.keys())
39 Write SQL queries for question from (i) to (iv) and output for SQL queries (v) and (vi), which 5
are based on the table: KV given below:
KVCode KVName StationCode Region Zone
1603 Bharatpur 331 Jaipur West
1595 Alwar 324 Jaipur West
1596 Alwar Itarana 324 Jaipur West
1019 Gandhidham IFFCO 11 Ahmedabad West
1020 Gandhidham Railway 11 Ahmedabad West
1769 Avadi AFS 584 Chennai South
1702 Uri 390 Jammu North
PAGE
62
1296 Barnala AFS 172 Chandigarh North

PAGE
63
(i) Display the details of KVs whose StationCode between 300 and 500. (300 and 500
exclusive)
Ans.: select * from KV where StationCode >300 and Statoncode<500;
(ii) Display the details of KVs whose name ends with AFS.
Ans: select * from KV where KVName like “%AFS”;
(iii) Print the details of KVs of Jaipur region.
Ans.: select * from KV where Region = ‘Jaipur’;
(iv) Print the Stationcode and Region of KVs which are not situated in Ahmedabad region.
Ans.: select Stationcode from KV where not Region = ‘Ahmedabad’;
(v) Display records of table in descending order of KVCode.
Ans.: select * from KV order by KVCode desc;
OR
On the basis of following table product answer question (i) to (v).

Table: PROUDCT
PID Productname Manufacturer Price
TP01 Talcum Powder LAK 40
FW05 Face Wash ABC 45
BS01 Bath Soap ABC 55
SH06 Shampoo XYZ 120
FW12 Face Wash XYZ 95

(i) Display details of those products whose manufacturere is “ABC”.


Ans.: select * from PRODUCT where manufacturer = ‘ABC’;
(ii) Display details of Products whose price is in range of 50 to 100.
Ans.: select * from PRODUCT where price between 50 and 100;
(iii) Display Product Name and Price from table Product where product name starts
with “B”.
Ans.: select Productname, Price from PRODUCT where Productname
like ‘B%’;
(iv) Display records in descending order of price.
Select * from PRODUCT order by price desc;
(v) Display manufacturer names only once.
40 Answer following questions:
(i) What is AI ? Give any one example of it. 2
Ans.: Artificial Intelligence refers to the stimulation of human intelligence in machines that
are programmed to think like humans and mimic their acitons.
Example: Siri, Google now etc.
(ii) What is Cloud Computing ? What are types of Cloud computing? 2

PAGE 10
Ans.: Cloud computing is the delivery of different services through the internet. These resources
include tools and applications like data storage, servers, databases, networking and
software. Types of Cloud Computing:
1. IAAS (Infrastructure as a Service),

PAGE 10
2. PAAS(Platform as a Service),
3. SAAS(Software as a service)
What is virtual reality? 1
s.: Virtual Reality (VR) is a three-dimensional, computer-generated situation that simulates the
real world.

KENDRIYA VIDYALAYA SANGATHAN, RAIPUR REGION


SESSION - 2022 – 23
CLASS XI : INFORMATICS PRACTICES(065)

MODEL TEST PAPER

Time Allowed: 3 Hours Maximum Marks: 70


General Instructions:
1. Question paper contains two parts A and B. Each part is compulsory.
2. Both Part A and Part B have choices.
3. Part-A has 2 sections:
a. Section – I is short answer questions.
b. Section – II has two case studies questions. Each case study has 4 case-based subparts.
An examinee is to attempt any 4 out of the 5 subparts.
4. Part – B is Descriptive Paper.
5. Part – B has three sections:
a. Section – I is short answer questions of 2 marks each in which two questions have internal
options.
b. Section – II is long answer questions of 3 marks each in which two questions have internal
options.
c. Section – III is very long answer questions of 5 marks each in which one question has internal
option.
PART – A
Section – I
Attempt any 15 questions from 1 to 21
1. What is the smallest unit of memory? 1
(a) bit (b) byte (c) Nibble (d) KB
2. Use of transistors started in ...................... 1
(a) First Generation (c) Third Generation
(b) Second Generation (d) Fourth Generation
3. CPU is combination of ................ 1
(a) Input and CU (c) Input and Output
(b) ALU and CU (d) ALU and Input
4. What is the correct order? 1
(a) Bytes>KB>MB>TB (c) MB>Bytes>KB>Bit
(b) GB>MB>KB>Bytes (d) KB>GB>Byts>MB
Page 1 of 5
5. Washing Machine is example of 1
(a) Single User OS (c) Real Time OS
(b) Multi User OS (d) Embeded OS
6. Which of the following is a secondary memory device? 1
(a) Keyboard (c) ALU
(b) Hard disk (d) All of the above
7. …………….is known as father of computer. 1
8. Does list in Python is mutable. (True/False) 1
9. Which of the following correct identifier name? 1
(a) 123name (c) My name
(b) _simpleinterest (d) 2312312
10. Suppose List1 is [2,4,6,8,10]. What is List1[-1]? 1
11. In dictionary key and values are: 1
(a) Mutable, mutable (c) Mutable, immutable

Page 2 of 5
(b) immutable, mutable (d) immutable, immutable
12. Which method is used to remove list elements? 1
13. Dictionary keys can be repeated. (True/False) 1
14. Which function is used to print all the keys of dictionary? 1
(a) Values() (c) Items()
(b) Keys() (d) None of these
15. Which of the followings is DDL command? 1
(a) Insert (c) create
(b) Select (d) delete
16. What is missing in following query: 1
Insert into employee ……….. (‘e01’, ‘Satya’, ‘Bombay’);
17. A table may contain more than one primary keys. (True/False) 1
18. The column of a table that points to the primary is: 1
(a) Primary Key (c) Candidate Key
(b) Foreign Key (d) Alternate Key
19. MySQL is a ………… 1
(a) RDBMS (c) Database
(b) DBMS (d) Table
20. In Like % and _ are: 1
(a) Clauses (c) Wild Cards
(b) Commands (d) All of these
21. Alphanumeric values are supported by which data type? 1
(a) CHAR (c) VARCHAR
(b) DATE (d) INTEGER
Section – II
Both the case study-based questions (22 and 23) are compulsory. Attempt any four sub parts
from each question. Each sub question carries 1 mark.

22. Mrs. Vidya has created a list of marks of six students in her subject. List is as follows.
Consider the following list and give answer of any four questions from (i) to (v).
L = [45, 99, 80, 60, 86, 91]
(i) She wants to display marks in ascending order. Help her to write code to display marks in 1
ascending order.
(ii) Which output is correct for following code: 1
Print(L[2:6])
(a) [99,80,60,86,91] (c) [80,60,86,91]
(b) [45,99,80,60,86,91] (d) None of these
(iii) She wants to delete 60 from list. What will be statement for this? 1
(iv) She wants to add a new element in list i.e. 100 at position 3. What is the correct statement 1
for this?
(a) L.append(3,100) (c) L.insert(3,100)
(b) L.extend(3,100) (d) None of these
(v) What will output of following: 1
Print(L*3)
23. On the basis of table Travel as given below, answer any four questions out of (i) to (v).
NO NAME TDATE KM CODE NOP
101 Janish Kin 2015–11–13 200 101 32
103 Vedika Sahai 2016–04–21 100 103 45
105 Tarun Ram 2016–03–23 350 102 42
102 John Fen 2016–02–13 90 102 40
107 Ahmed Khan 2015–01–10 75 104 2
104 Raveena 2016–05–28 400 105 4
Page 3 of 5
(i) Write sql query to create above table Travel. (Take data types according to values in 1
columns).
1

Page 4 of 5
(ii) NO NAME TDATE KM
101 Janish Kin 2015–11–13 200
105 Tarun Ram 2016–03–23 350

Out of the following queries, which query will give the above output?
(a) Select * from travel where km>200;
(b) Select * from travel where km>=200;
(c) Select no, name, tdate, km from travel where km>=200;
(d) Select no, name, tdate, km from travel where km between 200 and 350;
(iii) Neelima has given the following command to arrange the data in ascending order of date. 1
Select * from travel where order by tdate;
but he is not getting the desired result. Help her by choosing the correct command.

a. Select * from travel order by tdate;


b. Select * from travel in ascending order;
c. Select tdate from travel order by tdate;
(iv) Choose the correct command to display the name of the traveller whose travel date is in 1
year 2016?
a. Select name, tdate from travel where year(tdate)=2016;
b. Select name, tdate from travel where tdate=2016;
c. Select name, tdate from travel where year(tdate)= =2016;
d. Select name, max(tdate) from travel;
(v) Which query is correct to display following output: 1
Janish Kin John Fen
Ahmed Khan
(a) Select * from Travel where name like ‘%n’;
(b) Select name from Travel where name like ‘_n’;
(c) Select name from Travel where name like ‘%n’;
(d) Select name form Travel where name = ‘%n’;
PART B
SECTION
I
24. What is Operating System? Write any one example of Operating System. 2
25. What will be output of following code: 2
x = “I love India”
for i in x:
print(i,end=”,”)
26. Evaluate the following expression: 2
a. 15//3 b. 12%4 c. 2**4 d. 6/3
27. Write a program to print factorial of given number. 2
OR
Write a program to print largest number in given three numbers.
28. Find error in following code. Correct it and underline the corrections. 2
x= int(“enter value”))
For i in range(0,11) if
x = i:
print(x+y)
else:
print(x-y)
29. Suppose there is a table named student with 4 rows and 5 columns. 2 more rows added 2
and one column deleted from the table. What will be degree and cardinality of table student?

Page 5 of 5
30. Write following query in alternate way that will give same result. 2
Select * from student where marks = 60 or marks = 80 or marks = 90 or marks = 100;

Page 6 of 5
31. Write any two advantages of SQL. 2
OR
What is difference between DDL and DML?
32. Identify datatype of columns in following table: 2

33. Write any two limitations of Manual File system. 2


SECTION II
34. Write brief note on followings: 3
a. Data capture b. Data Storage c. Data retrieval
OR
Draw block diagram of Computer.
35. Write a Python program to find sum of all elements of a given list using for loop. 3
OR
Write a program that takes a list ‘L’ as an argument, adds 5 in all odd values and 10 in all
even values of the list L. Also display the list.
36. Define below database concepts 3
a. Tuple
b. Data Redundancy
c. DML Commands
37. Consider the following tables product and sales, identify the primary keys of both tables and 3
foreign key.

TABLE : SALES
BILLNUMBER BILLDATE PRODUCTCODE QTY AMOUNT
79 03/03/2020 P1101 3 124
69 03/03/2020 K750 2 345
86 03/03/2020 K750 1 343
85 03/03/2020 P12 5 232

SECTION III
38. Create a dictionary named cities with following details: 2
City names are keys: Indore, Khandwa, Bhopal, Agra, Umaria Pincodes are
values: 452001, 450001, 462001, 453115,453331
On the basis of above created dictionary cities, answer following questions:
(i) Remove Khandwa from dictionary Cities. 1
(ii) Write code to check whether Agra is present in dictionary or not. 1
Page 7 of 5
(iii) Write code to display keys from dictionary 1
39. Write SQL queries for question from (i) to (v) based on the table KV given below: 5
KVCode KVName StationCode Region Zone
1603 Bharatpur 331 Jaipur West

Page 8 of 5
1595 Alwar 324 Jaipur West
1596 Alwar Itarana 324 Jaipur West
1019 Gandhidham IFFCO 11 Ahmedabad West
1020 Gandhidham Railway 11 Ahmedabad West
1769 Avadi AFS 584 Chennai South
1702 Uri 390 Jammu North
1296 Barnala AFS 172 Chandigarh North
(i) Display the details of KVs whose StationCode between 300 and 500.
(ii) Display the details of KVs whose name ends with AFS.
(iii) Print the details of KVs of Jaipur region.
(iv) Print the Stationcode and Region of KVs which are not situated in
Ahmedabad region
(v) Display records of table in descending order of KVCode.
OR
On the basis of following table product answer question (i) to (v).
Table: PROUDCT
PID Productname Manufacturer Price

TP01 Talcum Powder LAK 40


FW05 Face Wash ABC 45
BS01 Bath Soap ABC 55
SH06 Shampoo XYZ 120
FW12 Face Wash XYZ 95
(i) Display details of those products whose manufacturer is “ABC”.
(ii) Display details of Products whose price is in range of 50 to 100.
(iii) Display Product Name and Price from table Product where product name
starts
with “B”.
(iv) Display records in descending order of price.
(v) Display manufacturer names only once.

40. Answer following questions:


(i) What is AI? Give any one example of it.
(ii) What is Cloud Computing? What are types of Cloud computing?
(iii) What is virtual reality?

Page 9 of 5

You might also like