0
0
Blockchain / Solidityprogramming~10 mins

Smart contract concept in Blockchain / Solidity - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to declare a smart contract named MyContract.

Blockchain / Solidity
contract [1] {
    // contract code here
}
Drag options to blanks, or click blank then click option'
ASmartContract
Bmycontract
CContract
DMyContract
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase or different contract names.
2fill in blank
medium

Complete the code to define a public state variable named count of type uint.

Blockchain / Solidity
uint public [1];
Drag options to blanks, or click blank then click option'
Acount
Bcounter
Cnumber
Dvalue
Attempts:
3 left
💡 Hint
Common Mistakes
Using other variable names like 'counter' or 'number'.
3fill in blank
hard

Fix the error in the function declaration to make it a public function named increment.

Blockchain / Solidity
function [1]() public {
    count += 1;
}
Drag options to blanks, or click blank then click option'
Aincrement
Badd
Cincrease
DIncrement
Attempts:
3 left
💡 Hint
Common Mistakes
Using uppercase 'Increment' or other names.
4fill in blank
hard

Fill both blanks to complete the function that returns the current count.

Blockchain / Solidity
function [1]() public view returns ([2]) {
    return count;
}
Drag options to blanks, or click blank then click option'
AgetCount
Buint
Cint
Dcount
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong function names or return types like 'int'.
5fill in blank
hard

Fill both blanks to complete the constructor that sets count to zero.

Blockchain / Solidity
constructor() {
    count [1] [2];
}
Drag options to blanks, or click blank then click option'
Apublic
B=
C0
Dprivate
Attempts:
3 left
💡 Hint
Common Mistakes
Adding visibility like 'public' or 'private', or wrong assignment.