Complete the code to declare a storage variable for an unsigned integer.
uint256 [1];The variable name should be count. memory and storage are data location keywords, not variable names.
Complete the code to declare a fixed-size array in storage.
uint256[[1]] numbers;The array size must be a number literal like 5. Variable names like size or length are not valid here.
Fix the error in the function to reduce gas by using a local variable for storage reads.
function getSum() public view returns (uint256) {
uint256 [1] = a + b + c;
return sum;
}The local variable should be named sum to match the return statement and reduce repeated storage reads.
Fill both blanks to optimize storage writes by caching in a local variable.
function increment() public {
uint256 [1] = [2];
[2] = [1] + 1;
}Cache the storage variable counter in a local variable temp, then update counter after incrementing.
Fill all three blanks to create a mapping and update it efficiently.
mapping(address => uint256) public [1]; function updateBalance(address user, uint256 amount) public { uint256 [2] = [3][user]; [3][user] = [2] + amount; }
The mapping is named balances. Cache the user's balance in currentBalance and update balances[user] after adding amount.