AI 11 U-3 Python Worksheet 2
AI 11 U-3 Python Worksheet 2
EXTENSION
(Under the aegis of the Delhi Public School Society, New Delhi)
WORKSHEET – 2 MCQ XI AI 0843 PYTHON
BASIC IOP & OPERATORS
1. Which of the following is a valid identifier: i. >>>not -5 ii. >>>not 5 iii. >>>not 0
i. 9type ii. _type iii. Same-type iv. True iv. >>>not(5- 1)
2. Which of the following is a relational operator: 13. Give the output of the following code:
i. > ii. // iii. or iv. ** >>>7*(8/(5//2))
3. Which of the following is a logical operator: i. 28 ii. 28.0 iii. 20 iv. 60
i. + ii. /= iii. and iv.in 14. Give the output of the following code: >>>import
4. Identify the membership operator from the math
following: >>> math.ceil(1.03)+math.floor(1.03)
i. in ii. not in iii. both i & ii iv. Only i i. 3 ii. -3.0 iii. 3.0 iv. None of the
5. Which one is a arithmetic operator: above
i. not ii. ** iii. both i & ii iv. Only ii 15. What will be the output of the following code:
6. What will be the correct output of the statement : >>>import math ;>>>math.fabs(-5.03)
>>>4//3.0 i. 5.0 ii. 5.03 iii. -5.03 iv . None of the
i. 1 ii. 1.0 iii 1.3333 iv. None of the above
above 16. Single line comments in python begin with……..
7. What will be the correct output of the statement : symbol.
>>> 4+2**2*10 i. # ii. “ iii. % iv. _
i. 18 ii. 80 iii. 44 iv. None of the 17. Which of the following are the fundamental building
above block of a python program.
8. Give the output of the following code: i. Identifier ii. Constant iii. Punctuators iv.
>>> a,b=4,2 ;>>> a+b**2*10 Tokens
i. 44 ii. 48 iii. 40 iv. 88 18. The input() function always returns a value of
9. Give the output of the following code: …..type.
>>> a,b = 4,2.5 ; >>> a-b//2**2 i. Integer ii. float iii. string
i. 4.0 ii. 4 iii. 0 iv. None of the above iv. Complex
10. Give the output of the following code: 19. .......... function is used to determine the data type of
>>>a,b,c=1,2,3 ;>>> a//b**c+a-c*a a variable.
i. -2 ii. -2.0 iii. 2.0 iv. None of the above i. type( ) ii. id( ) iii. print( ) iv. str( )
11. If a=1,b=2 and c= 3 then which statement will give 20. The smallest individual unit in a program is known as
the output as : 2.0 from the following: a..
i. a%b%c+1 ii. a%b%c+1.0 iii. a%b%c iv. a%b%c-1 i. Token ii. keyword iii. punctuator iv. identifier
12. Which statement will give the output as : True from
the following :
FLOW OF EXECUTION
21.Which of the following is not a decision making while a>0: print(a)
statement print(“Bye”)
i. if..else statement ii. for statement iii. if-elif i. times ii. Once iii. Infinite iv. None of these
statement iv. if statement 24.What abandons the current iteration of the loop
22. .......... loop is the best choice when the number of i. continue ii. stop iii. infinite iv. Break
iterations are known. 25.Find the output of the following python program
ii. while ii. do-while iii. for iv. None of for i in range(1,15,4): print(i, end=’,’)
these i. 1,20,3 ii. 2,3,4 iii. 1,5,10,14 iv. 1,5,9,13
23. How many times will the following code be 26. .......... loop is the best when the number of iterations
executed. are not known.
Page 1 of 2 PYTHON
a=5
i. while ii. do-while iii. for iv. None of 29. How many times will the following code be executed
these for i in range(1,15,5):
27. In the nested loop............... loop must be terminated print(i,end=’,’)
before the outer loop. i. 3 ii. 4 iii. 1 iv. infinite
i. Outer ii. enclosing iii. inner iv. None of 30. Symbol used to end the if statement:
these i. Semicolon(;) ii.Hyphen(-) iii. Underscore( _ ) iv.
28. .........statement is an empty statement in python. colon(:)
i. pass ii. break iii. continue iv. if
Page 2 of 2 PYTHON