Complete the code to declare a fixed-size array of 5 integers.
int[[1]] numbers;The fixed-size array must specify the size inside square brackets. Here, 5 means the array holds 5 integers.
Complete the code to declare a dynamic array of addresses.
address[] public [1];Dynamic arrays are declared with empty square brackets []. The name 'users' is a common choice for an array of addresses.
Fix the error in the code to add an element to a dynamic array.
users.[1](msg.sender);In Solidity, the correct method to add an element to a dynamic array is 'push'.
Fill both blanks to declare a fixed-size array and assign a value to its first element.
uint256[[1]] scores; scores[[2]] = 100;
The array size is 3, and the first element index is 0. So, scores[0] = 100 assigns 100 to the first element.
Fill all three blanks to create a dynamic array, add an element, and get its length.
address[] public [1]; function addUser(address user) public { [1].[2](user); } function getUserCount() public view returns (uint) { return [1].[3]; }
The dynamic array is named 'users'. We add elements with 'push' and get the number of elements with 'length'.