Practice Questions
Question 1: What is the value of z in the following code?
uint16 x = 3;
uint256 y = 21;
uint256 z;
unchecked {
z = x - y;
}
Question 2: What is the value of z in the following code?
uint32 x = 9_000;
uint40 y = 10_000;
uint256 z;
unchecked {
z = x - y;
}
Question 3: What is the value of z in the following code?
uint32 x = 9_000;
uint24 y = 10_000;
uint256 z;
unchecked {
z = x - y;
}
Question 4: What is the value of z in the following code?
uint32 x = 26;
uint24 y = 25;
uint256 z;
unchecked {
z = x - y;
}
Question 5: What is the value of z in the following code?
uint8 x = 25;
uint8 y = 26;
uint256 z;
unchecked {
z = x - y;
}