0% found this document useful (0 votes)
24 views2 pages

Ut 4

The document contains a practice test for Class 11 Computer Science students with 12 multiple choice and numerical questions covering topics like lists, dictionaries, functions and more. The test has a maximum score of 40 marks and all questions are compulsory.

Uploaded by

Achal Srivastva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views2 pages

Ut 4

The document contains a practice test for Class 11 Computer Science students with 12 multiple choice and numerical questions covering topics like lists, dictionaries, functions and more. The test has a maximum score of 40 marks and all questions are compulsory.

Uploaded by

Achal Srivastva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

JAWAHAR NAVODAYA VIDYALAYA, AWAN

Class: XI Computer Science


Unit Test-4
Duration: 90 mts Max. Marks: 40

Note:-All questions are compulsory.

1. What will be the output of the following statements? 4


i. list1 = [12,32,65,26,80,10]
list1.sort()
print(list1)
ii. list1 = [12,32,65,26,80,10]
sorted(list1)
print(list1)
iii. list1 = [1,2,3,4,5,6,7,8,9,10]
list1[::-2]
iv. list1 = [1,2,3,4,5]
list1[len(list1)-1]
2. Consider the following dictionary stateCapital: 4
stateCapital = {"AndhraPradesh":"Hyderabad", "Bihar":"Patna","Maharashtra":"Mumbai",
"Rajasthan":"Jaipur"}
Find the output of the following statements:
i. print(stateCapital.get("Bihar"))
ii. print(stateCapital.keys())
iii. print(stateCapital.values())
iv. print(stateCapital.items())
3. Differentiate between append() and extend() functions of list with the help of suitable example. 2
4. Consider a list: list1 = [6,7,8,9] 2
What is the difference between the following operations on list1:
a. list1 * 2 b. list1 *= 2
5. The record of a student (Name, Roll No., Marks in five subjects and percentage of marks) 2
is stored in the following list:
stRecord = ['Raman','A-36',[56,98,99,72,69], 78.8]
Write Python statements to retrieve the following information from the list stRecord.
a) Percentage of the student
b) Marks in the fifth subject
c) Maximum marks of the student
d) Change the name of the student from ‘Raman’ to ‘Raghav’
5. TypeError occurs while statement 2 is running. Give reason. How can it be corrected? 2
>>> tuple1 = (5) #statement 1
>>> len(tuple1) #statement 2
6. Dhruv has created a list. Now he wants to perform the following tasks: 2
L=[99,77,66]
i) Insert a value 88 at index 1
ii) Remove element 66 using backward indexing
6. “Lists and Tuples are ordered”. Explain with example. 2
7. Write a program to input your friends’ names and their Phone Numbers and store them in the 3
dictionary as the key-value pair. Perform the following operations on the dictionary:
a) Display the name and phone number of all your friends
b) Add a new key-value pair in this dictionary and display the modified dictionary
c) Delete a particular friend from the dictionary
d) Modify the phone number of an existing friend
e) Check if a friend is present in the dictionary or not
f) Display the dictionary in sorted order of names
7. Write a function that returns the largest element of the list passed as parameter. 3
8. Write a program to read a list of n integers (positive as well as negative). Create two new lists, 3
one having all +ve numbers and the other having all -ve numbers from the given list.
Print all three lists.
9. With the help of an example show how can you return more than one value from a function. 3
10. Write a Python program to create a dictionary from a string. Note: Track the count of the 4
letters from the string.
Sample string : 'w3resource'
Expected output : {'3': 1, 's': 1, 'r': 2, 'u': 1, 'w': 1, 'c': 1, 'e': 2, 'o': 1}

11. ASSERTION AND REASONING based question. Mark the correct choice as 1
(A) Both (A) and (R) are true and (R) is the correct explanation (A)
(B) Both (A) and (R) are true and R is not the correct explanation (A)
(C) (A) is True but (R) is False
(D) (A) is false but (R) is True

Assertion(A): List elements can be also access via negative indexes.


Reasoning(R): Python lists follows positional indexes.

12. Predict the output of the following code: 3


items={'Pens':250,'Pencils':300,'Colors':120,'Erasors':75}
amt=1
s=0
for i in items:
if i=='Pens' or i=='Colors':
amt=items[i]*2
print(i,”:”,amt)
s=s+amt
print(‘-----------------------’)
print(‘Total Order:’,s)

You might also like