Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3
M.E.S.
INDIAN SCHOOL, DOHA - QATAR
WORKSHEET-I : 2024- 2025
Section: Girls’ & Boys’ Date : 16-03-2024
Class & Div.: XII(All) Subject : Computer Science
Lesson / Topic : Python Revision Tour-I
I.Choose the correct answer
1. Which of the following is a valid identifier: i. 9type ii. _type iii. Same-type iv. True 2. Give the output of the following code: >>> a,b = 4,2.5 >>> a-b//2**2 i. 4.0 ii. 4 iii. 0 iv. None of the above 3. Give the output of the following code: >>>a,b,c=1,2,3 >>> a//b**c+a-c*a i. -2 ii. -2.0 iii. 2.0 iv. None of the above 4. Give the output of the following code: >>>7*(8/(5//2)) i. 28 ii. 28.0 iii. 20 iv. 60 5. Which of the following are the fundamental building block of a python program. i. Identifier ii. Constant iii. Punctuators iv. Tokens 6. The input() function always returns a value of......................type. i. Integer ii. Float iii. string iv. Complex 7. What will be the correct output of the statement : >>>4//3.0 i. 1 ii. 1.0 iii 1.3333 iv. None of the above
F 061, Rev 01, dtd10th March 2020
8...................function is used to determine the data type of a variable. i. type( ) ii. id( ) iii. print( ) iv. str( ) 9. loop is the best choice when the number of iterations are known. i. while ii. do-while iii. for iv. None of these 10. How many times will the following code be executed for i in range(1,15,5): print(i,end=’,’) i. 3 ii. 4 iii. 1 iv. infinite
II Find the output
a) b) a,b,c=10,20,30 a=(2+3)**3-6/2 p,q,r=c-5,a+3,b-4 b=(2+3)*5//4+(4+6)/2 print(‘p ,q and r: ‘,p,q,r) c=12+(3*4-6)/3 d=12%5*3+(2*6)//4 print(a,b,c,d) c) p=5/2 d) q=p*4 p=10 r=p+q q=20 p+=p+q+r p*=q//3 q-=p+q*r q+=p+q**2 print(p,q,r) print(p,q)
III Write the most appropriate list method to perform the following tasks.
(a) Delete a given element from the list.
(b) Delete 3rd element from the list. (c)Add an element in the end of the list. F 061, Rev 01, dtd10th March 2020 (d) Add an element in the beginning of the list. (e) Add elements of a list in the end of a list. IV Write output of the following: a=’Mummy?Papa?Brother?Sister?Uncle’ print(a.split()) print(a.split(‘?’) print(a.split(‘?’,1) print(a.split(‘?’,3) print(a.split(‘?’,10) print(a.split(‘?’,-1) V Rewrite the following code in Python after removing all the syntax errors. Underline each correction done in the code. num1, num2 = 10, 45 While num1 % num2 == 0 num1+= 20 num2+= 30 Else: print('hello')
VI Write a program for the following
(i)A Dudeney number is a positive integer that is a perfect cube such that the sum of its digits is equal to the cube root of the number. Write a program to input a number and check and print whether it is a Dudeney number or not.