Question 1: What is the binary number 0111 0011 in decimal?
To convert the binary number 0111 0011 to decimal:
- 0 × 2^7 = 0
- 1 × 2^6 = 64
- 1 × 2^5 = 32
- 1 × 2^4 = 16
- 0 × 2^3 = 0
- 0 × 2^2 = 0
- 1 × 2^1 = 2
- 1 × 2^0 = 1
Adding these values together: 0 + 64 + 32 + 16 + 0 + 0 + 2 + 1 = 115
So, the answer is 115.
Question 2: What will be printed in the following code?
import math
num = math.pow(4, 3)
print(num % 9)
Calculating math.pow(4, 3)
gives:
4^3 = 64.
Now, calculating 64 % 9
:
64 divided by 9 gives a remainder of 1.
So the output will be 1.0.
Question 3: True or false: a list is mutable and ordered
This statement is True. Lists in Python are mutable (they can be changed) and ordered (the order of elements is preserved).
Summary of Answers
- 115
- 1.0
- True