← Back to Course

Lesson 9: Uint Sizes of Constants

Practice Questions

Question 1: What is the maximum value that can go into x before an overflow happens?

function f(uint8 x) public pure returns (uint256) {
    return x * 255;
}

Question 2: What is the maximum value that can go into x before an overflow happens?

function f(uint16 x) public pure returns (uint256) {
    return 777 + x;
}

Question 3: What is the maximum value that can go into x before an overflow happens?

function f(uint64 x) public pure returns (uint256) {
    return 10**18 * x;
}

Question 4: What is the maximum value that can go into x before an overflow happens?

function f(uint64 x) public pure returns (uint256) {
    return 10**27 * x;
}

Question 5: What is the maximum value that can go into x before an overflow happens?

function f(uint256 x) public pure returns (uint256) {
    return 10**27 * x;
}