Question 1: What is the binary number 0111 0011 in decimal?
To convert the binary number 0111 0011 to decimal, we can break it down:
- 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 up: 64 + 32 + 16 + 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)
First, calculate math.pow(4, 3)
, which is \( 64 \) (since \( 4^3 = 64 \)). Now, calculate \( 64 % 9 \):
- \( 64 / 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. In Python, lists are mutable (meaning they can be changed) and are ordered (meaning they maintain the order of elements).
Final Responses:
- 115
- 1.0
- True