← Back to Course

Lesson 20: Upcasting with time and ether suffixes

Practice Questions

Question 1: What is the largest number the following code can return?

function f(uint16 x) public pure returns (uint64) {
    return 1 weeks * x;
}

Question 2: What is the largest number the following code can return?

function f(uint48 x) public pure returns (uint64) {
    return 1 weeks * x;
}

Question 3: What is the largest number the following code can return?

function f(uint32 x) public pure returns (uint64) {
    return 1 days * x;
}

Question 4: What is the largest number the following code can return?

function f(uint32 x) public pure returns (uint40) {
    return 1 gwei * x;
}

Question 5: What is the largest number the following code can return?

function f(uint16 x) public pure returns (uint64) {
    return 100 seconds * x;
}