0% found this document useful (0 votes)
60 views

Assignment: Integer Division Returns The Quotient and Removed The Decimal Point

1) Integer division of 9//2 returns 4. 2) Identifiers in Python can be any length. 3) The variable name "1st_string" is invalid as it starts with a number. 4) The ^ operator performs a binary XOR operation on bits of the operands. 5) Floor division // returns the integer portion of a division. 6) In Python, operations with the same precedence are evaluated from left to right.

Uploaded by

Shalni
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views

Assignment: Integer Division Returns The Quotient and Removed The Decimal Point

1) Integer division of 9//2 returns 4. 2) Identifiers in Python can be any length. 3) The variable name "1st_string" is invalid as it starts with a number. 4) The ^ operator performs a binary XOR operation on bits of the operands. 5) Floor division // returns the integer portion of a division. 6) In Python, operations with the same precedence are evaluated from left to right.

Uploaded by

Shalni
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

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.

You might also like