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

Xii Cs Worksheet - Find Output1 1m

The document contains a worksheet for Grade XII students at Bharathi Vidyalaya Senior Secondary School, featuring various Python programming exercises and questions. It includes tasks related to data structures, control flow, and built-in functions, along with expected outputs for each code snippet. The worksheet aims to assess students' understanding of Python programming concepts.

Uploaded by

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

Xii Cs Worksheet - Find Output1 1m

The document contains a worksheet for Grade XII students at Bharathi Vidyalaya Senior Secondary School, featuring various Python programming exercises and questions. It includes tasks related to data structures, control flow, and built-in functions, along with expected outputs for each code snippet. The worksheet aims to assess students' understanding of Python programming concepts.

Uploaded by

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

BHARATHI VIDHYALAYA SENIOR SECONDARY SCHOOL

GRADE XII – FIND OUTPUT WORK SHEET


d={'amit':19,'vishal':20} print("Welcome To My Blog"[2:6] + "Welcome To My
1. 1.
print(d.keys()) Blog"[5:9])
A tuple is declared as T = (20,5,16,29,83) What will be
2. What will be the output of: print (10>20)? 2.
the problem with the code T[1]=100
Write the steps to perform an Insert query in L1=[11,23,16,28,55,37,61,89]
3. database connectivity application. Table ‘student’ 3. write the output of the code given below :
values are rollno, name, age (1,’AMIT’,22) print(L1[-3:8])
x=10.0
4. print([x+y for x in 'ball' for y in 'boy'] ) 4.
y=(x<100.0) and x>=10
d={1:100,2:200} tp1=(10,15,20,60)
5. for x,y in d: 5. tp1=tp1+(3)
print(x*y, end=’’#”) print(tp1)
l=[1,2,5,6,7,9,10,22,38] T=(10,20,[30,40,50],60,70)
6. k=[e1*r for e1 in l if (e1-4)>1 for r in l[:4]] 6. T[2][1]=100
print(k) print(T)
Given the lists L=[1,3,6,82,5,7,11,92],the output of list= [10, 20, 30, 40, 50, 60, 70, 80]
7. 7.
print(L[2:5])is print(list[ : : 2])
marks = {"Ashok":98.6, "Ramesh":95.5} squares = {1: 1, 2: 4, 3: 9, 4: 16, 5: 25}
8. 8.
print(list(marks.keys())) print(squares.pop(4))
9. print(75.0 / 4 + (2** 3)) 9. print(20//3*2+(35//7.0))
data = [20,19,19,17,20,19,17,20]
L=[4,3,6,8,2]
d = {}
Lst=[]
for x in data:
for i in range(len(L)):
if x in d:
10. if L[i]%2==0: 10.
d[x]=d[x]+1
t=(L[i],L[i]**2)
else:
Lst.append(t)
d[x]=1
print(Lst)
print(d)
a = [0, 1, 2, 3] L=[1,4,9,16,35,27]
11. del a[:] 11. l=[num/3 for num in L if num%3==0]
print(a) print(l)
a=[1,2,3,4]
Tup1=(10,15,20,25,30)
12. b=[sum(a[0:x+1]) for x in range(0,len(a))] 12.
print(Tup1[-1:0:-2])
print (b)
data = [1,2,4,5] lst1=[10,15,20,25,30]
for x in data: lst1.insert(3,4)
13. 13.
x = x + 10 lst1.insert(2,3)
print(data) print(lis[-5])
a=[1,2,3,4,5]
mylist = [2,14,54,22,17]
for i in range(1,5):
tup = tuple(mylist)
14. a[i-1]=a[i] 14.
for i in tup:
for i in range(0,5):
print(i%3, end=",")
print(a[i],end=" ")
l=[1,2,3,4,5]
List1=[10,[20,30,40],50,60,70,80,90]
15. l[1:2]=[7,8] 15.
What will be the output of print (List1[1:3:2])?
print(l)
Given tp = (1,2,3,4,5,6). Which of the following two test_list = [5, 6, 7]
statements will give the same output? test_tup = (9, 10)
16. 16.
1. print(tp[:-1]) 2. print(tp[0:5]) 3. print(tp[0:4]) res = tuple(list(test_tup) + test_list)
4. print(tp[-4:]) print(str(res))
tup1=(10,20,30,40,50,60,70,80,90). Suppose a tuple T is declared as T = (10, 20, 30, 40),
17. 17.
What will be the output of print(tup1[3:7:2])? what will be the output of print(T*2)
Given an object L=[[1,2,3],4,5, [6,7,8]] What will be tuple1 = (10,12,14,16,18,20,22,24,30)
18. 18.
the output of print (L[3][1]])? print( tuple1[5:7] )
tuple1 = (11,22,33,44,55,66)
What is the minimum, maximum value that can be
list1 =list(tuple1)
obtained by the variable
new_list = []
lottery when the following code is executed?
for i in list1:
19. import random 19.
if i%2==0 :
seed = random.random()
new_list.append(i)
lottery = seed + random.randint(1,3)
new_tuple = tuple(new_list)
a) 1, 3.9999 b) 1, 4 c) 0, 3.9999 d) 0, 2.9999
print(new_tuple)
lst=[2,4,6,8,10]
L1, L2 = [10, 23, 36, 45, 78], [ ]
for i in range(1,5):
for i in range :
20. lst[i-1]=lst[i] 20.
L2.insert(i, L1.pop( ) )
for i in range(0,5):
print( L1, L2, sep=’@’)
print(lst[i],end=' ')
21. print (5+2**6<9+2-16//8) 21. print(51+4-3**3//19-3)
22. print(4 + 3**3/2) 22. print (10*1*2**4-4//4 )
LST= [[22.0, 51.6, 22.8],[23.0, 44.0, 15.0]]
text = “This is a string literal”
23. L = LST[-2][2] 23.
print(text[-2:3:-2])
print(L)
for i in range(1,3): k= 7 + 3 **2 * 5 // 8 – 3
24. 24.
print('answer ',i,'is', i**2) print(k)
25. print( float(5+int(4.39+2.1)%2)) 25. print(4+2**3**2-55//11%3)
Write the python statement for each of the following
s = “Bring it on”
tasks using BUILT-IN functions/methods only:
l = s.split()
26. (i) To remove an element at index 2 in a list L 26.
s_new = “#”.join([l[0].lower(), l[1], l[2].title()])
(ii) To check whether a string named text has ‘th’ in
print(s_new)
the beginning.
27. print ((30.0 // 4 + (8 + 3.0)) 27. Evaluate 6 * 3 + 4 ** 2 // 5 – 8
L= [1,3,5,4,8,9]
28. print(15.0/4+(8*3.0)) 28.
print(L[-1:-5])
L=[ x**2 for x in range(3,5)]
29. 29. print(15.0 / 4 + (8 + 3.0))
print(L)
Write the python statement to import the required
d1={1:2,3:4,5:6} module and (using built-in function) to perform
30. d2=d1.popitem() 30. following tasks
print(d2) (i) To calculate the cosine of variable angle
(ii) To calculate the absolute value of variable num

***************************

You might also like