Practice Questions
Question 1: What is the maximum value that can be returned by the following code?
function f(uint32 x, uint16 y) public pure returns (uint256 z) {
z = x * uint256(y);
}
Question 2: What is the maximum value that can be returned by the following code?
function f(uint104 x, uint16 y) public pure returns (uint128 z) {
z = x * uint128(y);
}
Question 3: What is the maximum value that can be returned by the following code?
function f(uint40 x, uint16 y) public pure returns (uint48 z) {
z = x * uint48(y);
}
Question 4: What is the maximum value that can be returned by the following code?
function f(uint32 x, uint32 y) public pure returns (uint40 z) {
z = x + uint40(y);
}
Question 5: What is the maximum value that can be returned by the following code?
function f(uint32 x, uint32 y) public pure returns (uint64 z) {
z = uint64(x) * y;
}