Complete the code to declare a state variable named count of type uint.
contract Counter {
[1] count;
}function instead of a data type.The keyword uint declares an unsigned integer state variable named count.
Complete the code to initialize the state variable owner with the address of the contract creator.
contract Ownership {
address public owner = [1];
}this which refers to the contract itself, not the creator.address(0) which is the zero address.msg.sender is the address that called the contract, usually the creator during deployment.
Fix the error in the code by completing the declaration of the state variable balance as a private unsigned integer.
contract Wallet {
[1] uint balance;
}external which is invalid for state variables.public when privacy is needed.The keyword private restricts access to the balance variable to inside the contract only.
Fill both blanks to declare a state variable data as a public string and initialize it with "Hello".
contract Example {
[1] public data = [2];
}bytes instead of string for text.string declares the variable type, and "Hello" initializes it with the text.
Fill all three blanks to declare a private unsigned integer totalSupply, initialize it to 1000, and make it accessible via a public function getSupply.
contract Token {
[1] uint totalSupply = [2];
function getSupply() public view returns (uint) {
return [3];
}
}public instead of private for the variable.private hides the variable, 1000 sets its initial value, and totalSupply returns it in the function.