Page 29 - AI
P. 29
12. Which symbol is used for multiple statements on a single line given that neither statement starts
a new code block?
(i) : (ii) ; (iii) ? (iv) #
13. A group of individual statements which make a single code block is called:
(i) Suite (ii) String (iii) Function (iv) Generator
14. Python variables do not need explicit declaration to reserve memory space.
(i) True (ii) False
15. You can assign single value to multiple variables simultaneously in Python.
(i) True (ii) False
16. Which numerical type is not included in Python?
(i) Int (ii) Rational (iii) Long (iv) Float
17. All items belonging to a list can be of different data types.
(i) True (ii) False
18. Tuples are enclosed within:
(i) ( ( ) ) (ii) <> (iii) { } (iv) [ ]
19. Dictionaries are enclosed by which brackets?
(i) {} (ii) () (iii) [] (iv) <>
20. What does float(x) do?
(i) Convert x to an integer (ii) Convert x to a floating point number
(iii) Convert x to a decimal (iv) Convert x to a complex number
21. c -= a is equivalent to:
(i) c=a-c (ii) c=c-a (iii) c=1-a (iv) c=c-a-1
22. *^= operator performs:
(i) Exponential calculation on operators and assigns value to the left operand
(ii) Multiplication calculation on operators and assigns value to the left operand
(iii) Log calculation on operators and assigns value to the left operand
(iv) Weighted mean calculation on operators and assigns value to the left operand
23. What does Logical AND mean?
(i) If either of the operands are true, then the condition becomes true
(ii) If both the operands are true, then the condition becomes true
(iii) If any of the operands is true, then the condition becomes true
(iv) If both the operands are false, then the condition becomes true
24. IN operator means to:
(i) Evaluate to true if variable is not declared
(ii) Evaluate to true if variable is not in the list
(iii) Evaluate to true if it finds a variable in the specified sequence and false otherwise.
(iv) Evaluate to true if variable in the specified sequence is not part of the list
25. Which operators among these have the highest precedence?
(i) a)^ (ii) +- (iii) is / is not (iv) in / not in
26. Which operator means to evaluate to false if the variables on either side of the operator point
to the same object and is true otherwise?
(i) is (ii) in (iii) not in (iv) is not
27. #!/usr/bin/python
var1 = 'Hello Kartik!'
print "Updated String :- ", var1[:6] + 'Python'
When you execute the above command, the following result is produced:
(i) Kartik Python (ii) Updated Strong - Hello Python
(iii) Hello Kartik (iv) Hello Python
28 Bonus leArning