Sei sulla pagina 1di 42

SAMPLE PAPER–I

Class-XI Informatics Practices (065)


Time: 3 hours Max. Marks: 70

QUESTION 1
(a) What is the importance of cache memory in a Computer System? (2)
Ans. The cache memory acts as a buffer between the slower RAM and the faster CPU. It stores the frequently
used data/instructions to be used by the CPU.
(b) What are keywords in Python? (1)
Ans. Keywords are reserved words by python interpreter that cannot be used as variables.
(c) Which of the following are legitimate variable declarations: (2)
(i) My.var
(ii) _GLOBAL
(iii) for
(iv) While
Ans. (ii) _GLOBAL  
   (iv) While
(d) What will be the output of the following program? (2)
a, b, c = 10, 20, 30
a, b ,a = c+2, a+5, c+3
print(a, b)
Ans. 33 15
(e) Write a program to find simple interest using principal, rate and time. (3)
Accept data from user.
si = PxRxT/100
Ans. principal=float(input("Enter the principal amount:"))
time=int(input("Enter the time(years):"))
rate=float(input("Enter the rate:"))
simple_interest=(principal*time*rate)/100
print("The simple interest is:",simple_interest)

QUESTION 2
(a) What will be the output of the following Python code? (2)
a, b = 10, 50
if b % a == 0:
  print(b//4)
  print(a/2)
else:
  print(a**2)
  print(b%3)
Ans. 12
5.0

1
(b) Write a Python program to find the largest of the three numbers. (3)
Or
Write a Python program to find the area and perimeter of a rectangle based on user choice. (If user types
1, area is displayed and if 2 is typed, perimeter is displayed.)
Ans. a = int(input("Enter 1st number:"))
b = int(input("Enter 2nd number:"))
c = int(input("Enter 3rd number:"))
if a>b and a>c:
  print(a, 'is the largest number')
elif b>c:
  print(b, 'is largest number')
else:
  print(c, 'is largest number')
Or
l = int(input('Enter the length:'))
b = int(input('Enter the breadth:'))
choice = int(input('Enter your choice as 1 for area or 2 for perimeter:'))
if choice==1:
  print('Area:', l*b)
elif choice==2:
  print('Perimeter:',2*(l+b))
else:
  print('Wrong choice')
(c) Convert the following Python program using for loop. (2)
i = 0
sum = 0
while i<=10:
  sum = sum + i
  i = i + 1
print(sum)
Ans. sum = 0
for i in range(1,11):
  sum = sum + i
print(sum)
(d) Write a Python program to print the series 1 3 5 7 9 11 up to a given limit. (3)
Or
Write a Python program to find the product of numbers up to a given limit.
Ans. limit = int(input('Enter the limit:'))
for i in range(1,limit+1,2):
  print(i,end=' ')
Or
prod = 1
limit = int(input('Enter the limit:'))
for i in range(1,limit+1):
  prod = prod * i
print(prod)

2
QUESTION 3
(a) Draw a flow chart to check whether a given number is odd or even. (3)
Or
Draw the decision tree to check if a person is eligible for voting (above 18 years of age).
Ans.
Start

Input Number

If
Number % 2 = = 0
Yes No

Display Display
“Even Number” Start “Odd Number”

End

Or

Whether attained
age of 18

Yes No

Not eligible for


Eligible for voting
          voting

(b) Write a Python program to find the largest and smallest sum of the elements and mean of the contents
of a list of numbers. (4)
Or
Write a Python program to find the frequency of elements in a list using a dictionary.
E.g.: For the list
['apple','banana','apple','grapes','banana','guava']
the output should be
{'apple': 2, 'banana': 2, 'grapes': 1, 'guava': 1}
Ans. lst= [2,3,4,5]
large = max(lst)
small = min(lst)
total = sum(lst)
mean = sum(lst)/len(lst)
print(large, small, total, mean)
Or
fruits =['apple','banana','apple','grapes','banana','guava']
d = {x:fruits.count(x) for x in fruits}
print(d)
3
(c) What will be the output of the following: (2)
s = 'PYTHON'
s1= s[::-1]
print(s1)
Ans. NOHTYP
(d) Anurag wants to use the function sqrt() from the module math. Write a statement to help Anurag to
include only the sqrt() function in his program. (2)
Ans. from math import sqrt

QUESTION 4
(a) Give the output of the following NumPy code: (2)
import numpy as np
data = np.array([5,2,7,3,9])
print (data[:])
print(data[1:3])
print(data[:2])
print(data[-2:])
Ans. [5 2 7 3 9]
[2 7]
[5 2]
[3 9]
(b) Write a NumPy code for creating and displaying subset of a given array A below: (4)
If A {1, 3, 5}, then all the possible/proper subsets of A are { }, {1}, {3}, {5}, {1, 3}, {3, 5}
Ans. import numpy as np
def sub_lists(list1):
   # store all the sublists
   sublist = [[]]
   for i in range(len(list1) + 1): # first loop
     for j in range(i + 1, len(list1) + 1): # second loop
       sub = list1[i:j] # slice the subarray
      sublist.append(sub)
    return sublist
x = np.array([1, 2, 3, 4]) # driver code
print(sub_lists(x))
(c) Differentiate between a NumPy array and list? (3)
Ans.
NUMPY ARRAY LIST
numpy.Array works on homogeneous Python list is made up for heterogeneous
(same) types. (different) types.
Python list supports adding and removing numpy.Array does not support addition
elements. and removal of elements.
Can’t contain elements of different types Can contain elements of different types
Less memory consumption More memory consumption
Faster runtime execution Runtime execution is comparatively slower
than Arrays.

4
(d) What will be the output of the following code shown below: (2)
import numpy as np
a = np.array([[3, 2, 1],[1, 2, 3]])
print(type(a))
print(a.shape)
print(a[0][1])
a[0][1] = 150
print(a)
Ans. "<class 'numpy.ndarray'>"
(2, 3)
2
[[ 3 150 1]
 [ 1   2  3]]

QUESTION 5
(a) The output of the following snippet of code is either 1 or 2. State whether this statement is true or
false. (2)
import random
random.randint(1,2)
Ans. The above statement is true. The function random.randint(a,b) helps us to generate an integer between
‘a’ and ‘b’, including ‘a’ and ‘b’. In this case, since there are no integers between 1 and 2, the output
will necessarily be either 1 or 2.
(b) What will be the output of the following code for generating NumPy arrays using zeroes: (3)
(i) np.zeros(10)
(ii) np.zeros((3, 6))
(iii) np.zeros((2, 3, 2))
Ans. (i) [0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
(ii) [[0. 0. 0. 0. 0. 0.]
  [0. 0. 0. 0. 0. 0.]
  [0. 0. 0. 0. 0. 0.]]
(iii) [[[0. 0.]
    [0. 0.]
    [0. 0.]]
  [[0. 0.]
    [0. 0.]
    [0. 0.]]]
(c) Write a Python program for performing linear search in an inputted list. (3)
Ans. #Linear Search
list1= [10,20,30,40,10,50,10]
num=eval(input("Enter a number : "))
found = False
position = 0
while position < len(list1) and not found:
  if list1[position] == num:
   found = True
  position = position + 1
if found:
  print(num, "is present at position", position)
else:
  print(num, "is not present")

5
QUESTION 6
(a) What is a primary key? (1)
Ans. A key attribute that uniquely identifies each row of a relation.
(b) Write SQL query to create the following table. (2)
Table: STUDENT
Column name Data type size Constraint
ROLLNO Integer 4 Primary Key
SNAME Varchar 25 Not Null
GENDER Char 1 Not Null
DOB Date Not Null
FEES Integer 4 Not Null
HOBBY Varchar 15 Null
Ans. CREATE TABLE student(
       rollno INT(4) PRIMARY KEY,
       sname VARCHAR(25) NOT NULL,
       gender CHAR(1) NOT NULL,
       dob DATE NOT NULL,
       fees INT(4) NOT NULL,
       hobby VARCHAR(15)
       NULL);
(c) Write SQL queries based on the following tables:
PRODUCT:
P_ID ProductName Manufacturer Price Discount
TP01 Talcum Powder LAK 40
FW05 Face Wash ABC 45 5
BS01 Bath Soap ABC 55
SH06 Shampoo XYZ 120 10
FW12 Face Wash XYZ 95
CLIENT:
C_ID ClientName City P_ID
01 Cosmetic Shop Delhi TP01
02 Total Health Mumbai FW05
03 Live Life Delhi BS01
04 Pretty Woman Delhi SH06
05 Dreams Delhi TP01
(i) Write SQL query to display ProductName and Price for all products whose Price is in the range
of 50 to 150. (1)
(ii) Write SQL query to display details of product whose manufacturer is either XYZ or ABC (1)
(iii) Write SQL query to display ProductName, Manufacturer and Price for all products that are not given
any discount. (1)
(iv) Write SQL query to display ClientName, City, and P_ID for all clients whose city is Delhi. (2)
(v) Which column is used as Foreign Key and name the table where it has been used as Foreign Key. (2)

6
Ans. (i) SELECT ProductName, Price FROM PRODUCT WHERE
Price BETWEEN 50 AND 100;
or
SELECT ProductName, Price FROM PRODUCT WHERE
Price>=50 AND Price<=100;
(ii) SELECT * FROM PRODUCT WHERE Manufacturer IN(‘XYZ’,‘ABC’);
SELECT * FROM PRODUCT WHERE Manufacturer=’XYZ’
OR Manufacturer=’ABC’;
(iii) SELECT ProductName, Manufacturer, Price WHERE Discount IS NULL;
(iv) SELECT ClientName, City, CLIENT.P_ID, FROM CLIENT, WHERE
city=‘Delhi’;
(v) P_ID is the Foreign Key which is used in CLIENT Table as Foreign Key.

QUESTION 7
(a) What do you understand by online identity theft? Mention one measure that can be used to avoid online
identity thefts. (2)
Ans. Online identity theft is a kind of online fraud that involves using someone else’s online credentials to
cause harm to the actual person financially or socially. Any of the following measures can help prevent
online frauds: Private browsing, Anonymous browsing, incognito, proxy, VPN.
(b) What will you do if you receive an email from an unknown source containing a lucrative financial offer
and a link to activate that? (1)
Ans. Delete the mail or mark it as spam.
(c) Give one word for the following: (3)
(i) A system of hardware and software that monitors all communication over a network and allows only
legitimate communication to propagate.
(ii) A microblogging social network website that allows 280-character messages.
(iii) A passive attack on a network that gains access to communication medium and listens to the
communication to fetch content.
Ans. (i) Firewall
(ii) Twitter
(ii) Eavesdropping
(d) What is the difference between a virus and a worm? (2)
Ans. Viruses are malicious programs that need a host file to attack a computer system.
Worms are self-replicating programs that eat up memory.
(e) What are cookies for a website? What is their use? (2)
Ans. Cookies are small pieces of data sent from a website and stored in user’s browser in the form of a text file.
Cookies help the website to store user’s browsing preferences and session data for user’s benefit.

7
SAMPLE PAPER–II
Class-XI Informatics Practices (065)
Time: 3 hours Max. Marks: 70

QUESTION 1
(a) What is the role of CPU in mobile system? (1)
Ans. A processor or CPU is the brain of a smartphone. It receives commands and makes instant calculations
and sends signals throughout your device (like human brain).
(b) Write the full form of MU and CPU in the context of COMPUTER system organization. (1)
Ans. MU – Memory Unit
CPU – Central Processing Unit
(c) Expand the terms ‘EB’ and ‘ZB’ in reference to memory unit. (1)
Ans. EB: Exa Byte, ZB: Zetta Byte
(d) Differentiate between Static and Dynamic RAM. (2)
Ans.
Dynamic RAM Static RAM
DRAM uses a separate capacitor to store each bit SRAM uses transistor to store a single bit of data.
of data.
DRAM needs periodic refreshment to maintain SRAM does not need periodic refreshment to
the charge in the capacitors for data. maintain data.
DRAM’s structure is simpler than SRAM. SRAM’s structure is more complex than DRAM.
DRAMs are less expensive as compared to SRAMs. SRAMs are more expensive as compared to DRAMs.
DRAMs are slower than SRAMs. SRAMs are faster than DRAMs.
DRAMs are used in main memory. SRAMs are used in cache memory.
(e) What is the difference between interpreter and compiler? (any two) (2)
Ans.
Interpreter Compiler
Translates one program statement at a time. Scans the entire program and translates it as a
whole into machine code.
It takes less amount of time to analyze the source It takes large amount of time to analyze the
code but the overall execution time is slower. source code but the overall execution time is
comparatively faster.
Continues translating the program until the It generates the error message only after
first error is met, in which case it stops. Hence, scanning the whole program. Hence, debugging is
debugging is easy. comparatively hard.
Programming languages like Python, Ruby use Programming languages like C, C++ use compilers.
interpreters.
(f) What is SoC? How is it different from CPU? Why is it considered a better development? (3)
Ans. SoC refers to system on a chip widely used in smartphones.
It is better than CPU because it consists of CPU, GPU, modem, multimedia processor, security device and
signal processor.
It offers better performance while power consumption is comparatively less.

QUESTION 2
(a) Who developed Python programming language? (1)
Ans. Guido van Rossum developed Python programming language in 1990.

1
(b) Write any two names of IDE for Python language. (1)
Ans. PyScripter, Spyder
(c) Identify the valid identifiers from the following—
f@name, as, _tax, roll_no, 12class, totalmarks, addr1 (2)
Ans. Valid identifiers: _tax, roll_no, totalmarks, addr1
(d) Explain the various merits of Python programming language. (3)
Ans. Merits of Python language are:
(i) Platform-independent: It is platform-independent and can run across different platforms like
Windows, Linux/Unix, Mac OS X and other operating systems. Thus, we can say that Python is a
portable language.
(ii) Readability: Python programs use clear, simple, concise and English-like instructions that are easy
to read and understand even by non-programmers or people with no substantial programming
background.
(iii) Object-Oriented Language: It is an interactive, interpreted and Object-Oriented Programming
Language.
(iv) Higher Productivity: Since Python is a simple language with small codes and extensive libraries, it
offers higher productivity to programmers than languages like C++ and Java. So, we write less and
get more done.
(v) Less Learning Time: Because of a simple and shorter code, lesser time is required to understand and
learn Python programming.
(vi) GUI Programming: Python supports GUI applications that can be created and ported to many system
calls, libraries and Windows systems such as Windows MFC (Microsoft Foundation Class Library),
Macintosh and the X Window system of UNIX.
(vii) Ample Availability of Libraries: It provides large standard libraries to solve a task.
(viii) Syntax Highlighting: It allows to distinguish between input, output and error messages by different
colour codes.
(e) What do you mean by data types? What are Python’s built-in core data types? Write one example of
each. (3)
Ans. Data type: In Python, each value is an object and has a data type associated with it. Data type of a value
refers to the value it is and the allowable operations on those values. Built-in core/fundamental data
types available in Python are:
Number: Number data type stores numerical values, such as 123, –78, 45, 2000.87, etc.
Strings: A string is a sequence of characters that can be a combination of letters, numbers and special
symbols, enclosed within quotation marks, single or double or triple (‘ ‘ or “ “ or ‘’’ ‘’’).
>>>str = "India"
>>>print(str) #Output: India
bool (Boolean): Boolean data type represents one of the two possible values, True or False. Any expression
which can be True or False has the data type bool.

QUESTION 3
(a) What is difference between equality (==) and identity (is) operator? (1)
Ans. Equality (==) compares values while identity (is) compares memory address of variables/objects.
(b) Reema is confused between 3*2 and 3**2. Help her to know the difference between the two
expressions. (1)
Ans. The statement 3*2 multiplies 3 by 2 and produces the result 6 while 3**2 calculates 3 raised to the power
2 and produces the result 9.
( 12 mark for each expression)

2
(c) What is difference between implicit and explicit type conversion? (1)
Ans.
Implicit Conversion Explicit Conversion
Implicit Conversion is done automatically. Explicit Conversion is done by programmer.
In implicit conversion, no data loss takes place In explicit conversion, data loss may or may not
during data conversion. take place during data conversion. Hence, there
is a risk of information loss.
Implicit conversion does not require any special Explicit conversion requires cast operator to
syntax. perform conversion.
(d) What will be the output produced by the following code? (2)
  A, B, C, D = 9.2, 2.0, 4, 21
  print(A/4)
  print(A//4)
  print(B**C)
  print(A%C)
Ans. Output:
  2.3
  2.0
  16.0
  1.1999999999999993
(e) Write the following arithmetic expressions using operators in Python: (2)
a+b
(i) c = (ii) x = a3 + b3 + c3
2a
-b ± b2 - 4ac
(iii) A = pr(r+h)2 (iv) x =
2a
Ans. (i) c = (a + b) / (2*a)
(ii) x = a**3 + b**3 + c**3
(iii) A = math.pi *r* (r + h)**2 or A = 3.14*r*(r +h)**2
(iv) x = (–b + math.sqrt(b*b – 4*a*c))/ (2*a)
(f) Write a program to get input from the user to calculate EMI as per the formula: (3)
E=PR(1+R)n / ((1+R)n –1)
Where
E=EMI, P=Principal amount, R=Rate of interest, n=tenure of loan in months.
Ans. import math
p=float(input("Enter principal amount-"))
r=float(input("Enter rate of interest-"))
n=float(input("Enter tenure of loan in months-"))
e=(p*r*math.pow(1+r,n))/(math.pow(1+r,n)-1)
print("EMI :",e)

QUESTION 4
(a) What is empty statement? What is the role of empty statement? Which Python statement can be termed
as empty statement? (2)
Ans. A statement that does nothing is called an empty statement. It is used where the syntax of the language
requires the presence of statement but the logic of the program does not.
pass statement is an empty statement.

3
(b) Predict the output of the following code fragment– (2)
x = 1
if x>3:
  if x>4:
   print("A", end=' ')
  else:
   print("B", end=' ')
elif x<2:
  if (x!=0):
   print("C", end=' ')
print("D")
Ans. Output:
C D
(c) A year is a leap year if it is divisible by 4, except that years divisible by 100 are not leap years unless they
are also divisible by 400. Write a program that asks the user for a year and print out whether it is a leap
year or not. (3)
Ans. year=int(input("Enter year to be checked:"))
if(year%4==0 and year%100!=0 or year%400==0):
   print("The year is a leap year!")
else:
   print("The year isn't a leap year!")
(d) ABC shop deals in footwear and apparel. Write a program to calculate the total selling price after levying
GST. Do calculate Central Govt. GST and State Govt. GST. GST rates are applicable as under: (3)
Item GST Rate
Footwear <= 500 (per pair) 5%
Footwear > 500 (per pair) 18%
Apparel <= 1000 (per piece) 5%
Apparel > 1000 (per piece) 12%
Ans. itc=input("Enter item code (A)Apparel (F)Footwear-")
sp=float(input("Enter selling price-"))
if itc=='A':
  if sp<=1000:
    gstRate=5
  else:
    gstRate=12
elif itc=='F':
   if sp<=500:
    gstRate=5
  else:
    gstRate=18
cgst=sp*(gstRate/2)/100
sgst=cgst
amount=sp+cgst+sgst
print("Total selling price-",amount)

4
QUESTION 5
(a) What is pseudo code? How is it useful in developing logic for the solution of a problem? (1)
Ans. Pseudo code is an informal way of describing the steps of a program’s solution without using any strict
programming language syntax.
It gives an idea as to how algorithm works and how control flows from one step to another.
(b) Write four elements of “while” loop in Python. (1)
Ans. (i) Initialization expression
(ii) Test expression
(iii) Body of the loop
(iv) Update expression
(c) Identify and correct the problem with the following code– (1)
countdown=10
while countdown > 0:
   print(countdown, end=' ')
   countdown = 1
print("Finally.")
Ans. It is an infinite loop due to non-updation of the variable countdown.
(d) Draw a flow chart for displaying the first 100 odd numbers. (2)
Ans.
Start

Assign i=0

Whether i=100 Yes


reached?
No
False
if i%2!=0

True
Print i

Compute i=i+1

Stop
(e) Write a Python script to print the first 20 elements of the ‘Fibonacci series’. Some initial elements of the
series are: 0 1 1 2 3 5 8 . . . (2)
Ans. nterms = int(input("How many terms?"))
n1 = 0
n2 = 1
count = 0
print("Fibonacci sequence upto",nterms,":")
while count < nterms:
  print(n1,end=',')
   nth = n1 + n2
   n1 = n2
   n2 = nth
   count += 1
5
(f) Write a Python script to read an integer > 1000 and reverse the number. (3)
Ans. n=int(input("Enter number: "))
rev=0
while(n>0):
  dig=n%10
  rev=rev*10+dig
  n=n//10
print("Reverse of the number:",rev)

QUESTION 6
(a) What are list slices? What can we use them for? (1)
Ans. Slice is a part of a list containing some contiguous elements from the list or sub-part of a list extracted out.
It is used to extract some contiguous parts or elements of list (sub-part) from main list.
(b) What will the following code result in– (1)
L1=[1,3,5,7,9]
print(L1==L1.reverse())
print(L1)
Ans. Output:
False
[9, 7, 5, 3, 1]
(c) How is clear() function different from del<dict> statement? (1)
Ans. The clear() function removes all items from the dictionary and the dictionary becomes empty while
del<dict> statement deletes a dictionary element or dictionary entry, i.e., a key:value pair.
(d) Predict the output of the following code— (2)
d1={5:"number","a":"string",(1,2):"tuple"}
print("Dictionary contents")
for x in d1.keys():
  print(x,':',d1[x],end=' ')
  print(d1[x]*3)
  print()
Ans. Output:
Dictionary contents
5 : number numbernumbernumber
a : string stringstringstring
(1, 2) : tuple tupletupletuple
(e) Write a Python script to search an element in a given list of numbers. (2)
Ans. lst=eval(input("Enter list:"))
length=len(lst)
element=int(input("Enter element to be searched for :"))
for i in range(0,length-1):
  if element==lst[i]:
    print(element,"found at index", i)
    break
else:
   print(element,"not found in given list")

6
(f) Explain the following List methods with examples— (3)
Ans. (i) count ()
(ii) pop ()
(iii) extend ()

QUESTION 7
(a) What is argument? Give an example. (1)
Ans. List of variables/objects passed to functions or variables/objects that carry values from function call
statement to function definition.
Example:
def greet(name,msg):
   """This function greets to
   the person with the provided message"""
   print("Hello",name + ', ' + msg)
greet("Rinku","Good morning!")
(b) Rewrite the following code after removing errors, if any, and underline each correction— (1)
def func1()
  input("input numbers:")
  return number
Ans. def func1():
   number = input("input numbers:")
  return number
(c) Write any four Python’s built-in string manipulation methods with examples. (2)
Ans. string.capitalize(), string.isalnum(), string.isalpha(),
string.isdigit(), string.isspace(), string.islower(),
string.isupper(), string.lower(), string.upper() or any other
function with example
(d) Write a program that reads a string and then prints a string that capitalizes every other letter in the string,
e.g., passion becomes pAsSiOn. (3)
Ans. string=input("Enter a string:")
length=len(string)
print("Original String:",string)
string2=""
for a in range(0,length,2):
  string2+=string[a]
  if a<(length-1):
    string2+=string[a+1].upper()
print("Alternatively capitalized string:", string2)
(e) Explain the following terms— (3)
Ans. (i) Module – Named block of statements within a program.
(ii) Function – Named independent grouping of code and data.
(iii) Namespace – Named logical environment holding logical grouping of related objects.

7
MODEL TEST PAPER–I
Class-XI Informatics Practices (065)
Time: 3 hours Max. Marks: 70

QUESTION 1
1. Find and write the output. (2)
A = [1,3,5,7,8,9]
print(A[3:0:-1])
2. Find the output of the following Python code: (2)
a,b,c=10,12,15
b%=a
a**=b
X=a//b+c%b+b**2
print(a,b,c,sep=':')
print(X)
3. Find the output of the following Python code: (3)
x,x = 4,7
y,y = x+7,x-7
x,y=y-x,x+y
print(x,y)
4. Rewrite the output after removing all the errors: (3)
S='hello python'
S1=S[:5]
S2=S[5:]
S3=S1*S2
S4=S2+'3'
S5=S1+3
5. Predict and write the output: (3)
L=['p','r','o','b','l','e','m']
L[2:3]=[]
print(L)
L[2:5]=[]
print(L)
6. Which of the following are valid identifiers? (3)
(a) File.dat
(b) for
(c) _if
(d) elif
7. Find the errors and write the output of the following code: (4)
X=["F",66,"QE",15,"S",34]
Y=0
Z=""
A=0
for c in range(1,6,2)
  Y+=c
  Z=Z+X[c-1]+'$'
  A+=X[c]
    print(x,y,z)
1
8. Write down the program in Python to sort a 3-item list. (4)
9. Write a Python script to print the following: (4)
****
***
**
*
10. Write a program that inputs two tuples and creates a third that contains all elements of the first,
followed by all elements of the second. (4)
11. Write a program that rotates a list so that the 1st element moves to the 2nd index and so on. The item at
the last index comes at the first index. (4)
12. Write a program to count the number of elements in a list using dictionary. (4)
13. Explain computer organization with the help of a block diagram. (6)
14. Explain various data types with suitable examples. (6)
15. Write a program to read a line and print the following statistics: (6)
• No. of upper case characters
• No. of lower case characters
• No. of alphabets
• No. of digits
16. Write down a Python script to find the sum of the following: (6)
x-x^2/2!+x^3/3!-x^4/4!+x^5/5! ……….
17. Write a program to read a string with multiple words and then capitalize the first letter of each word.
(6)

2
MODEL TEST PAPER–II
Class-XI Informatics Practices (065)
Time: 3 hours Max. Marks: 70

SECTION–A
1. Compare the calculator and computer in your own words. (1)
2. What are the two main types of cache memory? (1)
3. Write the names of two input and two output devices. (2)
4. What are the different parts of a CPU? Explain each part in brief. (2)
5. Which of the following are hardware and software? (1)
(a) Capacitor
(b) Internet Explorer
(c) Hard disk
(d) UNIX
6. (a) Who developed Python? (1)
(b) Is Python case-sensitive or not? (1)
(c) Python is an Open Source Software. What do you understand by open source? (1)
7. What are the supported data types of Python? (2)
8. (a) Predict the output of – print(str[2:5]) if str = ‘hello world’ (2)
(b) Predict the output of – print(str*2) if str = ‘Kendriya’ (1)
9. Write a Python program to display the first and last colours from the following list: (2)
List1 = [“violet”, “indigo”, “blue”, “green”, “yellow”, “orange”, “red”]
10. What is the purpose of ** and *? (2)
11. What is the purpose of pass statement? (1)
12. What is the difference between lists and tuples? Give an example of their usage. (2)
13. Explain the purpose of loop structures in a programming language. Describe the syntax and semantics of
one loop structure provided by Python. (3)
14. What is a string? How do you create a string in Python? (2)
15. Area of a triangle is given by the formula:- (s a)(s – b)(s – c) where a, b and c are the sides of the triangle
and s=(a+b+c)/2. Write a program in Python to compute the area of the triangle. (3)
16. Write a program to check whether the entered string is a palindrome or not. (3)
17. Write a line of code to execute infinite loop in Python. (1)
18. Write a Python program to convert temperature from Fahrenheit to Celsius. (2)
19. Write a Python program to print multiplication tables from 2 to 10. (2)

SECTION–B
20. Is series a one-dimensional labelled array capable of holding any data type? (1)
21. Write the output of the following Python code— (2)
def calc():
   return[lambda x : i * x for i in range(4)]
print([m(2) for m in calc()])
22. Write the code to sort an array in NumPy by the (n-1)th column. (2)
23. Write two features of dictionary. (2)
24. What are the three types of import statements in Python? Explain. (3)

1
25. Differentiate between a NumPy Array and Lists. (2)
26. Write a program to convert a Panda module series to Python list and its types. (2)
27. What will be the output of the following code: (2)
def foo(i=[]):
  i.append(1)
  return i
print(foo())

SECTION–C
28. What are the common MySQL functions? (1)
29. What is the difference between primary key and candidate key? (2)
30. What do DDL, DML and DCL stand for? (2)
31. Create a table for the following structure— (2)
Field | Type | Null | Key | Default | Extra |
+---------- +---------------- +------ +----- +--------- + ------- +
| name  | varchar(20) | YES | | NULL  |  |
| owner | varchar(20) | YES |  | NULL  |  |
| species  | varchar(20) | YES |  | NULL  |  |
| sex  | char(1) | YES |  | NULL  |  |
| birth  | date | YES |  | NULL  |  |
| death | date | YES | | NULL  |  |
32. What is the difference between update and alter command? (2)
33. Define projection in terms of mysql. (1)
34. Write the appropriate usage of social networks. (1)
35. Define eavesdropping and phishing. (2)
36. What is the difference between virus and Trojan horse? (2)
37. What is cyberbullying? (1)

2
PRACTICAL FILE
Informatics Practices
(Class XI)
INDEX
No. Name of Practical Date Page Sign of the
no. Teacher
1. WAP to compute xn of two given integers x and n.
2. WAP for calculating the simple interest.
3. WAP to accept a number from the user and display whether it is
an even number or an odd number.
4. WAP to accept percentage of a student and display the grade
accordingly.
5. WAP to print the Fibonacci series up to a certain limit.
6. WAP to display prime numbers up to a certain limit.
7. WAP to accept a number, find and display whether it’s an
Armstrong number or not.
8. WAP to accept a number and find out whether it is a perfect
number or not.
9. WAP to print the sum of the exponential series 1+x1/1!+x2/2!+…….
xn/(n)!-
10. WAP to print the following pattern:
1
12
123
11. WAP to accept a string and display whether it is a palindrome.
12. WAP that counts the number of alphabets and digits, upper case
letters, lower case letters, spaces and other characters in the
string entered.
13. WAP to accept a string (a sentence) and return a string with the
first letter of each word in capital letter.
14. WAP to remove all odd numbers from the given list.
15. WAP to display the second largest element of a given list.
16. WAP to display the cumulative elements of a given list.
17. WAP to display the frequencies of all the elements of a list.
18. WAP in Python to display those strings which are starting with
‘A’ in the given list.
19. WAP in Python to find and display the sum of all the values which
are ending with 3 from a list.
20. WAP to shift the positive numbers to the left and the negative
numbers to the right.
21. WAP to swap the content with the next value divisible by 7.
22. WAP to accept values from the user and create a tuple.
23. Write a program to input the total number of sections and stream
names in 11th class and display all information on the output
screen.
24. Write a Python program to input names of ‘n’ countries along
with their capitals and currencies, store them in a dictionary and
display them in a tabular form. Also search for and display a
particular country.
25. Write a program to create an array from range 0 to 9.
26. Write a method to create subsets from a 1D array.
SQL
21 Queries

2
Program 1: WAP to compute xn of two given integers x and n.
Code:



Output:


Program 2: WAP for calculating the simple interest.
Code:



Output:

3
rogram 3: WAP to accept a number from the user and display whether whether it is an even number or
P
an odd number.
Code:



Output:


Program 4: WAP to accept percentage of a student and display the grade accordingly.
Code:



Output:

4
Program 5: WAP to print the Fibonacci series up to a certain limit.
Code:



Output:


Program 6: WAP to display prime numbers up to a certain limit.
Code:



Output:

5
Program 7: WAP to accept a number, find and display whether it’s an Armstrong number or not.
Code:



Output:


Program 8: WAP to accept a number and find out whether it is a perfect number or not.
Code:



Output:

6
Program 9: WAP to print the sum of the exponential series 1+x1/1!+x2/2!+…….xn/(n)!-
Code:



Output:


Program 10: WAP to print the following pattern:
1
12
123
Code:



Output:

7
Program 11: WAP to accept a string and display whether it is a palindrome.
Code:



Output:


Program 12: WAP that counts the number of alphabets and digits, upper case letters, lower case letters,
spaces and other characters in the string entered.
Code:



Output:

8
Program 13: WAP to accept a string (a sentence) and return a string with the first letter of each word in
capital letter.
Code:



Output:


Program 14: WAP to remove all odd numbers from the given list.
Code:



Output:

9
Program 15: WAP to display the second largest element of a given list.
Code:



Output:


Program 16: WAP to display the cumulative elements of a given list.
For example, List is [10,20,30,40]
Output should be [10, 30, 60, 100]
Code:



Output:

10
Program 17: WAP to display the frequencies of all the elements of a list.
Code:



Output:


Program 18: WAP in Python to display those strings which are starting with ‘A’ in the given list.
Code:



Output:

11
Program 19: WAP in Python to find and display the sum of all the values which are ending with 3 from a list.
Code:



Output:


Program 20: WAP to shift the positive numbers to the left and the negative numbers to the right so that
the resultant list will look like—
Original list: [-12, 11, -13, -5, 6, -7, 5, -3, -6]
Output should be: [11, 6, 5, -6, -3, -7, -5, -13, -12]
Code:



Output:

12
Program 21: A list Num contains the following elements:
3, 21, 5, 6, 14, 8, 14, 3
WAP to swap the content with the next value divisible by 7 so that the resultant array will look like:
3, 5, 21, 6, 8, 14, 3, 14
Code:



Output:


Program 22: WAP to accept values from the user and create a tuple.
Code:



Output:

13
Program 23: Write a program to input the total number of sections and stream names in 11th class and
display all information on the output screen.
Code:



Output:


Program 24: Write a Python program to input names of ‘n’ countries along with their capitals and
currencies, store them in a dictionary and display them in a tabular form. Also search for and display a
particular country.
Code:


14

Output:


Country Capital Currency
Austria Vienna Euro
India New Delhi Indian Rupee
France Paris Euro


Country Capital Currency
India New Delhi Indian Rupee
Program 25: Write a program to create an array from range 0 to 9.
Code:



Output:

15
Program 26: Write a method to create subsets from a 1D array.
Code:



Output:

16
MY SQL
QUERIES

17
1. Command for creating a database.


2. Command for using the database.


3. Command for creating a table.


4. Command for showing the structure of table.


5. Command to show tables present in database.


6. Command for inserting data into a table.


7. Command to view the contents of the table.

18
8. Command to retrieve data.


9. Command for using the keyword DISTINCT.


10. Command for using the WHERE clause.


11. Command for using the ORDER BY clause.


12. Command for using UPDATE.


13. Command for using ALTER (to modify structure of table).


14. Command for using the LIKE operator.

19
15. Command for using aggregate functions.


16. Command for adding primary key.


17. Command to delete a column.


18. Command to remove primary key.


19. Command to increase marks.


20. Command to change data type of an existing column.


21. Command to delete a table.

20
VIVA VOCE
1. What is Python?
Ans. Python is an easy-to-learn, general-purpose, dynamic, interpreted, high-level, multi-platform, powerful
programming language. It has efficient high-level data structures and a simple but effective approach to
object-oriented programming.
2. How can you start Python through Windows command prompt?
Ans. If you set the Python path for Windows, then you can start Python with the following:
C :> python
3. What is IDLE?
Ans. IDLE (Interactive Development and Learning Environment) is an environment for developing Python
programs (“scripts”) under Windows and other operating systems.
4. What are the two modes of working in Python?
Ans. Python provides two modes of working:
(a) Interactive mode
(b) Script mode
5. What is a variable?
Ans. A variable is an identifier/placeholder that holds a value. In other words, a variable is a reference to a
computer memory location where the value is stored.
6. What can a variable hold in Python?
Ans. In Python language, a variable can hold a string, a number or several other objects such as a function or
a class. Variables can be assigned different values during execution.
7. Name the three key attributes of an object in Python.
Ans. Each object in Python has three key attributes: a type, a value and an id.
8. Define a keyword.
Ans. A keyword is a reserved word in the Python programming language. Keywords are used to perform a
specific task in a computer program.
9. Why is the given statement invalid in Python?
     x + 1 = x
Ans. The statement is invalid because an expression cannot be placed on the left of the equal ‘=’ sign. Therefore,
the correct statement should be:
     x = x + 1
10. What is NumPy?
Ans. NumPy is a Python extension module that provides efficient operation on arrays of homogeneous data.
It allows Python to serve as a high-level language for manipulating numerical data. It is mainly used to
apply functions on arrays. Major array functions are handled by NumPy. It is written in C and Python. It
supports cross-platform.
11. What is a NumPy Array?
Ans. A NumPy array is a multidimensional array of objects of the same type. In memory, it is an object
which points to a block of memory, keeps track of the type of data stored in that memory, how many
dimensions there are, and how large each one is.
12. How is NumPy installed?
Ans. NumPy is installed by using the pip, a Python package installer as follows:
   pip install numpy

1
13. What is the Ndarray object of NumPy?
Ans. The object that is defined in the N-dimensional array type is known as ndarray. The collection of items of
the same type is described by ndarray and index starting with 0 (zero) is used for accessing the collection
of items.
14. What are the different array attributes of NumPy?
Ans. The different array attributes of NumPy are shape, reshape, itemsize, ndim, etc.
15. What are the different array creation routines of NumPy?
Ans. The array creation routine is used for constructing a new ndarray object. Some of the array creation
routines are empty(), zeros(), and ones().
16. What is the following statement termed as?
     a, b, c, d = 1, 2, 3, 4
Ans. Multiple Assignment Statement.
17. Name five primitive data types in Python.
Ans. Five primitive data types in Python are: Numbers, String, List, Tuple and Dictionary.
18. Differentiate between single quotes, double quotes and triple quotes.
Ans. The differences are:
• If you use single quotes, you do not have to escape double quotes and vice versa.
• If you use triple quotes, your string can span multiple lines.
19. Is string a sequence data type?
Ans. Yes.
20. Define input() method.
Ans. The purpose of an input() method is to fetch some information from the user of a program and store it
into a variable.
21. What is the role of a print() function?
Ans. A print() method prints an expression which may be a variable’s value or string or a blank line.
22. What does a print statement add to the end of the string?
Ans. By default, the print() function adds a new line to the end of the string being printed.
23. If you don’t use the sep option with print() function, what will it print?
Ans. If sep is not defined, a space is printed between the values received by the print statement.
24. What is the default value printed by giving end argument to print() method?
Ans. A new line (‘\n’).
25. What is an operator in Python?
Ans. An operator works on data items and performs some mathematical operations or changes the data.
For example, +, -, *, /, %, >, <, >=, <=, <<, >>, &, |, ^, ==, etc.
26. When does a logical and operator produce true result?
Ans. The logical and operator evaluates to True only if both conditions/operands are true.
27. What is an expression? What does it constitute?
Ans. An operand or a combination of operands and operators, when evaluated, yields a single value called
an expression. The expression consists of variables, constants and functions.
28. What is modulo operator? Give an example.
Ans. The % operator is termed as modulo operator. It calculates the remainder of division of one number by
another. For example, 5%2 shall return the result as 1—the remainder obtained when we are dividing
5 by 2.
29. Which operator is used to compare the values of operands?
Ans. Relational operator.

2
30. How can we change the order of evaluation of operator?
Ans. We can use parentheses to alter the order of evaluation of an operator.
31. What is a unary operator? Give examples.
Ans. The operator which requires only one operand to operate upon is called unary operator. The + and –
operators in Python can be used in both binary and unary forms.
32. Which functions are available for creating an array from the numerical ranges in NumPy?
Ans. arange() and linspace().
33. Which function is used to join a sequence of arrays along an existing axis?
Ans. concatenate().
34. Differentiate between binary and ternary operator.
Ans. The operators which require only two operands to work upon are binary operators and those which
require three operands are ternary operators.
35. Differentiate between division operator (/) and floor division operator (//).
Ans. In Python, the division operator (/) performs integer division on two operands. We get exact division
output. For example,
>>> 5/2
2.5
The floor division operator (//) performs an integer division and, as a result, an integer is obtained.
For example,
>>> 8//3
2
>>>
the fraction part gets truncated.
36. Which function can be used to know the data type of a variable?
Ans. type() method in Python allows us to know the data type of a variable.
37. Name the sequence surrounded by either single quotes or double quotes.
Ans. String
38. How can we convert a string into a number in Python?
Ans. A string which contains a number will be converted into numeric type using int() function.
39. Define a sequence construct.
Ans. A sequence construct constitutes all the statements which are executed sequentially.
40. What is selection construct?
Ans. A selection construct involves execution on the basis of certain test conditions.
41. What is a flow chart?
Ans. A flow chart is a pictorial/graphical representation of a task. Flow charts are drawn using certain special-
purpose symbols such as rectangles, diamonds, ovals and circles. These symbols are connected using
arrows termed as flow lines.
42. Give an advantage of using a flow chart.
Ans. Flow chart provides a unique feature of breaking down of a complex problem into parts in order to obtain
the solution to a given problem.
43. Define an infinite loop.
Ans. An infinite loop is a loop where a condition never becomes false and keeps on executing. It is a never-
ending loop, such as a while loop in case the situation never resolves to a false value.
44. What is iteration construct?
Ans. Iteration means repetition of a set of statements until the test condition remains true depending upon
the loop.

3
45. Define the body of the loop.
Ans. The sets of statements which get executed on the test condition becoming true are defined as the body
of the loop.
46. What is an exit control loop? Give an example.
Ans. An exit control loop is a loop which checks for a condition to be true or false at the time of exit from the
loop. For example, do...while.
47. What is the purpose of using a for loop?
Ans. The for loop is used for definite/fixed number of iterations.
48. What are the supported data types in Python?
Ans. Python has five standard data types—
(i) Numbers
(ii) String
(iii) List
(iv) Tuple
(v) Dictionary
49. Is Python object-oriented?
Ans. Yes, Python is an Object-oriented Programming language.
50. What is the purpose of break statement?
Ans. The break statement is used to forcefully terminate the loop execution where it has been given.
51. What is an exception in Python?
Ans. An error that happens during the execution of the code/program is termed as an exception. For example,
Syntax errors, runtime errors, like division by zero, are examples of exceptions in Python.
52. Name the method that works reverse of split() method in strings.
Ans. join() method
53. Define a string.
Ans. A string is a sequence of characters. Strings are immutable in Python, i.e., they cannot be modified once
created.
54. Define a list in Python. Why is it mutable and dynamic in nature?
Ans. A list in Python is an ordered collection of items which may belong to any data type. A list is dynamic,
mutable type as you can add or delete elements from the list any time.
55. What happens when an element gets deleted from a list?
Ans. When we remove an element from a list, the size or length of the list decreases by 1 position.
56. What does append() function do?
Ans. It simply adds/appends an element to the end of the list.
57. What is a dictionary?
Ans. A Python dictionary is a collection of key-value pairs. The elements in a dictionary are indexed by keys
which must be unique.
58. What does the item() method of dictionary return?
Ans. The item() method returns a list of dictionary (key:value) pairs as tuples.
59. Why are Python dictionaries also termed as mappings?
Ans. Python dictionaries are called mappings because these are like a collection that allows us to look up for
information associated with arbitrary keys.
60. Differentiate between hstack and vstack?
Ans. hstack is used to stack (join) arrays in sequence horizontally (column-wise). On the other hand, vstack is
used to stack arrays in sequence vertically (row-wise).
4

Potrebbero piacerti anche