ASSIGNMENT
1.What is the output of 9//2
Ans:4
Integer division returns the quotient and removed the
decimal point.
2. What is the maximum possible length of an identifier?
Identifiers can be any length.
3. Which of the following is an invalid variable?a
a.m my_string_1 b) 1st_string c) foo d) _
Ans : b)1st_string
Variable name should not start with a number.
4. How to write x^y?
The operator does a binary XOR a^b will return a value with
only a bits set in x or y but not both.
5. What is floor division?
//-> floor division It will give the integer value.
6. What is the order of precedence in python?
i) Parentheses ii) Exponential iii) Multiplication iv) Division
v) Addition vi) Subtraction
a) i,ii,iii,iv,v,vi b) ii,i,iii,iv,v,vi c) ii,i,iv,iii,v,vi d) i,ii,iii,iv,vi,v
Ans: a) i,ii,iii,iv,v,vi
we use only "PEMDAS" method so we arrange the format.
7. What is the answer to this expression, 22 % 3 is?
Ans:2
modulus operator gives the remainder.
8. Operators with the same precedence are evaluated in which
manner?
Ans: operators are usually associated from left to right
manner with the same precedence.
9. What is the output of the expression 5*2*4?
Ans:40
multiplication operator is used.
10. The expression Int(x) implies ___
__The variable is converted to integers.
11. What is the output when following statement is executed ?
>>>”a"+"bc"
Ans: abc
Explanation: + is operator is a concatenation operator.
12. What arithmetic operators cannot be used with strings ?
a) + b) * c) – d) All of the mentioned.
Ans: c)
+ is used for concatenate, * used to multiply.