The document contains questions and answers related to Python programming concepts like operators, data types, bitwise operations, etc. Some key points:
- Questions cover topics like operator precedence, type conversion, binary representations, bitwise operators &, |, ^, bit shifting, and evaluating expressions.
- Answer options provided for each question, with one option marked with asterisk as the correct answer.
- Questions have varying difficulty levels, testing basic to advanced Python concepts.
Download as DOC, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
108 views
Python Test 11am
The document contains questions and answers related to Python programming concepts like operators, data types, bitwise operations, etc. Some key points:
- Questions cover topics like operator precedence, type conversion, binary representations, bitwise operators &, |, ^, bit shifting, and evaluating expressions.
- Answer options provided for each question, with one option marked with asterisk as the correct answer.
- Questions have varying difficulty levels, testing basic to advanced Python concepts.
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2
Naresh i Technologies, HYDERABAD
1. What is the output of the following 4+2**5//10
expression: print(4.00/(2.0+2.0)) a) 3 a) Error b) 7 * b) 1.0* c) 77 c) 1.00 d) 0 d) 1 9. The expression 2**2**3 is evaluates as: 2. Consider the expression given below. (2**2)**3. State whether this statement The value of X is: X = 2+9*((3*12)-8)/10 is true or false. a) 30.0 a) True b) 30.8 b) False * c) 28.4 10. What is the result of the snippet of d) 27.2 * code shown below if x=1? x<<2 3. What is the value of the following a) 8 expression: 24//6%3, 24//4//2 b) 1 a) (1,3)* c) 2 b) (0,3) d) 4 * c) (1,0) 11. The output of the expression is: bin(29) d) (3,1) a) ‘0b10111’ 4. Which among the following list of b) ‘0b11101’ * operators has the highest precedence? c) ‘0b11111’ +, -, **, %, /, <<, >>, | d) ‘0b11011’ a) <<, >> 12. What is the value of x if: b) ** * x>>2=2 c) | a) 8 * d) % b) 4 5. What is the value of the expression: c) 2 float(4+int(2.39)%2) d) 1 a) 5.0 13. What is the result of the expression: b) 5 int(1011)? c) 4.0 * a) 1011 * d) 4 b) 11 6. Which of the following expressions is c) 13 an example of type conversion? c) 1101 a) 4.0 + float(3) * 14. To find the decimal value of 1111, that is b) 5.3 + 6.3 15, we can use the function: c) 5.0 + 3 a) int(1111,10) d) 3 + 7 b) int(‘1111’,10) 7. Which of the following expressions c) int(1111,2) results in an error? d) int(‘1111’,2) * a) float(‘10’) 15. What is the result of the expression if b) int(‘10’) x=15 and y=12: x & y c) float(’10.8’) a) b1101 d) int(’10.8’)* b) 0b1101 8. What is the value of the expression: c) 12 *
Preapred By Subba Raju Data Scientist
Naresh i Technologies, HYDERABAD d) 1101 bin(10-2)+bin(12^4) 16. Which of the following expressions a) 0b10000 results in an error? b) 0b10001000 a) int(1011) c) 0b1000b1000 b) int(‘1011’,23) d) 0b10000b1000 * c) int(1011,2)* 24. Which of the following expressions d) int(‘1011’) can be used to multiply a given number ‘a’ 17. Which of the following represents the by 4? bitwise XOR operator? a) a<<2 * a) & b) a<<4 b) ^ * c) a>>2 c) | d) a>>4 d) ! 25. What is the output of the code show 18. What is the value of this expression? below if a=10 and b =20? bin(0x8) a=10 a) ‘0bx1000’ b=20 b) 8 a=a^b c) 1000 b=a^b d) ‘0b1000’ * a=a^b 19. What is the result of the expression: print(a,b) 0x35 | 0x75 a) 10 20 a) 115 b) 10 10 b) 116 c) 20 10 * c) 117 * d) 20 20 d) 118 20. The one’s complement of 110010101 is: a) 001101010 * b) 110010101 c) 001101011 d) 110010100 21. Bitwise _________ gives 1 if either of the bits is 1 and 0 when both of the bits are 1. a) OR b) AND c) XOR * d) NOT 22. The result of the expression shown below is: 4^12 a) 2 b) 4 c) 8 * d) 12 23. What is the value of this expression: