1. What is the result of the expression:
int(1011)?
2. To find the decimal value of 1111, that is 15, we can use the function:
Correct Answer is : int(‘1111’,2)
3. What is the result of the expression if x=15 and y=12:
x & y
4. Which of the following expressions results in an error?
Correct Answer is : int(1011,2)
5. Which of the following represents the bitwise XOR operator?
6. What is the value of this expression?
bin(0x8)
Correct Answer is : ‘0b1000’
7. What is the result of the expression:
0x35 | 0x75
8. The output of the snippet of code shown below?
bool(‘False’)
bool()
9. What is the output of the snippet of code shown below?
['hello', 'morning'][bool('')]
Correct Answer is : hello
10. What is the output of the code shown below?
not(3>4)
not(1&1)
11. What is the output of the code shown?
['f', 't'][bool('spam')]
12. What is the output of the code shown below?
l=[1, 0, 2, 0, 'hello', '', []]
list(filter(bool, l))
Correct Answer is : [1, 2, ‘hello’]
13. What is the output of the following code if the system date is 21st June, 2017 (Wednesday)?
[ ] or {}
{} or [ ]
14. What is the output of the code shown below?
class Truth:
pass
x=Truth()
bool(x)
15. What is the output of the code shown below?
if (9 < 0) and (0 < -9):
print("hello")
elif (9 > 0) or False:
print("good")
else:
print("bad")
16. Which of the following Boolean expressions is not logically equivalent to the other three?
Correct Answer is : not(-6>10 or-6==10)
17. The output of the line of code shown below is:
not(10<20) and not(10>30)
Correct Answer is : FALSE
18. Which of the following functions is a built-in function in python?
Correct Answer is : print()
19. What is the output of the expression:
round(4.576)
20. The function pow(x,y,z) is evaluated as:
Correct Answer is : (x**y) % z