KEMBAR78
Class 12 Python Revision Tour 2 Worksheet | PDF | Computer Science | Software Development
0% found this document useful (0 votes)
49 views5 pages

Class 12 Python Revision Tour 2 Worksheet

The document contains a series of Python programming questions and exercises designed for students studying Computer Science. It covers various topics such as string manipulation, tuples, dictionaries, and list operations, along with multiple-choice answers for each question. The document serves as a revision tool for students preparing for exams in Python programming.

Uploaded by

spiderparker270
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)
49 views5 pages

Class 12 Python Revision Tour 2 Worksheet

The document contains a series of Python programming questions and exercises designed for students studying Computer Science. It covers various topics such as string manipulation, tuples, dictionaries, and list operations, along with multiple-choice answers for each question. The document serves as a revision tool for students preparing for exams in Python programming.

Uploaded by

spiderparker270
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/ 5

VELAMMAL VIDYALAYA – SHOLINGANALLUR.

XII - COMPUTER SCIENCE (083)


Python Revision Tour 2
1. For a given declaration in Python as s=”WELCOME”
Which of the following will be the correct output of print (s[1:2])?
a. WEL b. COME c. E d. ECM
2. Given a Tuple tup1= (10, 20, 30, 40, 50, 60, 70, 80, 90).
What will be the output of print (tup1 [3:7:2])?
a. (40,50,60,70,80) b. (40,50,60,70) c. [40,60] d. (40,60)
3. Consider a tuple tup1 = (10, 15, 25, and 30). Identify the statement that will result in
an error.
a. print(tup1[2]) b. tup1[2] = 20 c. print(min(tup1)) d. print(len(tup1))
4. Which of these about a dictionary is false?
a. The values of a dictionary can be accessed using keys
b. The keys of a dictionary can be accessed using values
c. Dictionaries aren’t ordered
d. Dictionaries are mutable
5. What is the output of following code?
T=(100) print(T*2)
a. Syntax error b. (200,) c. 200 d. (100,100)
6. Identify the output of the following Python statements.
x = [[10.0, 11.0, 12.0],[13.0, 14.0, 15.0]]
y = x[1][2] print(y)
a. 12.0 b. 13.0 c. 14.0 d. 15.0
7. Given the lists L=[1,3,6,82,5,7,11,92] , write the output of print(L[2:5])
Ans:-

1
13. Write a statement in Python to declare a dictionary whose keys are 1, 2, 3 and values
are Monday, Tuesday and Wednesday respectively.
14. What is the output of the expression? STR=”trip@split” print(STR.rstrip(“t”))
a. rip@spli b. trip@spli c. rip@split d. rip@spli
15. What will be the output of the following code snippet?
gist=”Old is Gold”
X=gist.partition(“s”) print(X[-1:-3])
a. () b. (' Gold') c. (' Gold', 'is') d. None of the above
16. What will be the output of the following code?
MainList = ["One", ["2", "3"], "4"]
CheckList = [ MainList[1] ] print(CheckList)
a. [“2”] b. [“2”, ”3”] c. [ [“2”,”3”] ] d. Syntax Error
17. If “dict” is a dictionary as defined below, then which of the following statements
will raise an exception?
dict = {'Rose': 10, 'Lily': 20, 'Sunflower': 30}
a. dict.get('Sunflower') b. print(dict['Rose', 'Lily']) c. dict['Rose']=40 d. print(str(dict))
18. Identify the invalid python statement from the following:
a. t=(100) b. t=tuple() c. t=(100,) d. None of the above
19. Write the output:-
myTuple =("Ajay", "Siva", "Vicky")
x = "#".join(myTuple) print(x)
a. #Ajay#Siva#Vicky b. Ajay#Siva#Vicky
c. Ajay#Siva#Vicky# d. #Ajay#Siva#Vicky#

2
27. Identify the invalid statement for list L= [1,2,3,4]
a. L.remove(3) b. L.pop(3) c. L.del(3) d. del L[3]
28. What will be the output of the following Python statements?
D={‘BHUSHAN’:90, ‘SAKSHI’:96,’RANJIT’:85} print(‘RANJIT’ in D,
96 in D, sep=’@’)
a. True@True b. False@True c. True@False d. False@False
29. What will be the output of the following code?
s = [3,0,[2,1,2,3],1] print(s[s[len(s[2])-2][1]])
a.0 b. 1 c. [2,1,2,3] d. 2
30. Which of the following statement(s) will raise an exception? Sales
= {"Printer":25000,"Mouse":750 } # Statement 1
print (Sales[750]) # Statement 2
Sales ["Printer"]=12500 # Statement 3 print
(Sales.pop()) # Statement 4 print
(Sales) # Statement 5
a. Statement 2 b. Statement 3 c. Statement 4 d. Statements 2 and 4
31. Which of the following will delete key-value pair for key = “Red” from a dictionary
COLOR?
a. delete COLOR("Red") b. del COLOR["Red"]
c. del.COLOR["Red"] d. COLOR.del["Red"]
32. What will be the output of the following code?
L1 = [1, 2, 3]
L2 = L1 L1 +=
[4,] print(L1 =
= L2)
a. True b. False c. tuple1 d. Error

3
a. 'DATA=Science=DataScience=And' b. 'DATA=DataScience=And'
c. 'DATA=Science=And' d. 'DATA=Science==DataScience=And'
39. What will be the output of the following code?
tuple1 = (1, 2, 3) tuple2
= tuple1 + (4,) tuple1
+= (5,) print(tuple1,
tuple2)
a. (1, 2, 3) (1, 2, 3, 4) b. (1, 2, 3, 5) (1, 2, 3) c. (1, 2, 3, 5) (1, 2, 3, 4) d. Error
40. Identify the output of the following code snippet:
str = "KENDRIYA VIDYALAYA"
str=str.replace('YA','*') print(str)
a. KENDRIYA VIDYALAYA b. KENDRI*A VID*ALAYA
c. KENDRI* VID*LA* d. * KENDRI* VID*LA*
41. State the correct output of the following code-
S1= “India is on the Moon”
A=S1.split("o",3) print(A)
a. ['India is ', 'n the M', ' ', 'n'] b. 'India is ', 'n the M', ' ', 'n'
c. ['India is n ', 'the ', ' ', 'Mn'] d. [„India is‟, „the‟, „n‟]
42. State the correct output of the following code- str1="
Programming " str2=" is My Junoon"
str3=str1.strip()+str2.replace("J", "j").lstrip() print(str3.partition("My"))
a. ('Programmingis ', 'My', ' junoon') b. ['Programmingis ', 'My', ' junoon']
c. ['Programming is ', 'My', ' Junoon'] d. (('Programmingis ', 'My', ' Junoon')

4
49. What will be the output of following code if a = “abcde”
A [1:1 ] == a [1:2]
Type (a[1:1]) == type (a[1:2])

50. Identify the output of the following python code:


D={1:”one”,2:”two”, 3:”three”}
L=[]
For k,v in D.items():
If ‘o’ in v:
L.append(k)
Print(L)

(a) [1,2] (b) [1,3] (c)[2,3] (d)[3,1]

You might also like