DAV_CS_ANNUAL_21_22Ms
DAV_CS_ANNUAL_21_22Ms
Class : XI Time :
2Hrs
Date : 08-03-22 Max. : 35
Marks
General Instructions
The question paper is divided into 3 sections – A, B and C
Section A, consists of 7 questions (1-7). Each question carries 2 marks.
Section B, consists of 3 questions (8-10). Each question carries 3 marks.
Section C, consists of 3 questions (11-13). Each question carries 4 marks.
Internal choices have been given for question numbers 7, 8 and 12.
SECTION – A
1.
i.
Which is NOT the possible output of following program from given options:
import random
instr = ['Guitar', 'Keyboard', 'Piano', 'Violin','Veena']
X=random.randint(0,3)
for i in range(X):
print(instr[i+1],'*',end=" ")
2.i)
49,[4, -5, 32, 56, -9, 38, 9, -7, 11, -7, 19, 2] 1 each line
16.333333333333332 11.916666666666666
3. identify Errors in the following code ,rewrite the corrected code.Underlining the
corrections made.
dic={} ½ *4
x=dict{}
x[1]='annual'
x[2]='exam'
x[1.0]='xic'
dic[(-1,2,3)]='Aa'
dic[(4,-3,1)]='Bb'
dic[(5,4,-6)]='Cc'
dic[(1,2,3)]='ABC'
dic[['X']]=x
x.fromkeys([1,8],4)
print(dic, dic.len(dic))
x.setdefault((10,6))
print(x, dict.fromkeys((3,4,5),(4,2,1)))
: PAGE 2 :
7. i. Write the differences between append() method and extend() method with suitable
example.
Ans:: The key difference between append and extend in Python is that,
append adds its arguments as a single element to the end of the list while the
extend iterates over its arguments by adding each element to the list and
extending it.
Valid example.(1/2 EACH)
OR
ii. Illustrate with suitable example of keys() ,fromkeys() and setdefault() methods
used in dictionary .
ans:
The setdefault() method returns the value of a key (if the key is in dictionary).
If not, it inserts key with a value to the dictionary.
The keys() method returns a view object that displays a list of all the keys in
the dictionary
The fromkeys() method creates a new dictionary from the given sequence of
elements with a value provided by the user.
dictionary.fromkeys(sequence[, value])
any two correct answer:
SECTION B
The practice of taking someone else's work or ideas and passing them off as
one's own.
"there were accusations of plagiarism" infringement of copyright ·
OR
II. Name any 2 software features / voice assistants that visually impaired students can
use.
9. Write a python program to input n numbers in a list , data to be deleted .The program
should delete all the occurrences of the data from the given list without using
parallel ,built in methods.
i+=1
print("New list is:")
for i in range(n):
print(l[i])
10. Write a python program to create a dictionary of n items with item number ,name
and price.
(item number as key and name and price as values in a tuple) Display the details of
the items with price >8500 and also the sum of all item prices.
SECTION C
11. i. Write a program to read n number of countries and store them in a list .Sort the
: PAGE 4 :
elements in descending order implementing Bubble sort technique also print the
sorted list,
ii. Using Dictionary Comprehension write a statement to print the cube of first 5
multiple of 3 .
d={3:27,6:216,9:729,12:1728,15:3375}
12.i) Write a Python code to create a dictionary of ‘n’ movies (mov_Id as the key and
value to be a nested dictionary having title, director, cost) and do the following:(3)
a) display all movie titles directed by Mani Rathnam.
b) read a title and director. Search through the dictionary and if found , display the
the details
Write a python code to read details of ‘n’ salesmen as a nested dictionary, Sales
where the key is the id of the salesman and the value has name of month and the
sales amount, as shown in the sample. The program should display the id of the
salesman who has scored the highest sales in the month of DECEM.
(eg) If the input is:
SALES= { 1: {“JAN” : 10290, “JUL”:31410,
DECEM”:44330},
2: {“JAN” : 4950, “JUL”: 460, “DECEM”:46345 },
3: {“JAN” : 3099, “JUL”: 4420, “DECEM”:89205 } }
Output should be ID:3,89205.
Input,
nested loop,
To check the highest
Display the appropriate value EACH ONE MARK
13 I.Find the Boolean algebra expression for the following system. (2)
: PAGE 5 :
II.Write a program to input a matrix of m*n and print the row and column sum for the
matrix elements. (2)
INPUT
LOOP TO TRAVERSE
SUM ACCUMULATE
ROW AND COLUMN
½ EACH
############