← Back to Course

Lesson 7: Solidity Upcasting Rule

Practice Questions

Question 1: What is the maximum value z can return?

function f(uint16 x, uint24 y) public pure returns (uint256 z) {
    z = x * y;
}

Question 2: What is the maximum value z can return?

function f(uint104 x, uint24 y) public pure returns (uint256 z) {
    z = x * y;
}

Question 3: What is the maximum value z can return?

function f(uint56 x, uint40 y) public pure returns (uint256 z) {
    z = x - y;
}

Question 4: What is the maximum value z can return?

function f(uint128 x, uint96 y) public pure returns (uint256 z) {
    z = x + y;
}

Question 5: What is the maximum value z can return?

function f(uint16 x, uint48 y) public pure returns (uint256 z) {
     z = x + y;
}