0
0
Blockchain / Solidityprogramming~10 mins

Data types (uint, int, bool, address, string) 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 variable of type unsigned integer (uint).

Blockchain / Solidity
uint public myNumber = [1];
Drag options to blanks, or click blank then click option'
A100
B-100
Ctrue
D"hello"
Attempts:
3 left
💡 Hint
Common Mistakes
Using a negative number for uint
Using quotes around numbers
2fill in blank
medium

Complete the code to declare a boolean variable set to false.

Blockchain / Solidity
bool public isActive = [1];
Drag options to blanks, or click blank then click option'
A0
Bfalse
C"false"
Dnull
Attempts:
3 left
💡 Hint
Common Mistakes
Using quotes around false
Using 0 instead of false
3fill in blank
hard

Fix the error in the code by choosing the correct value for the variable holding an Ethereum address.

Blockchain / Solidity
address public owner = [1];
Drag options to blanks, or click blank then click option'
A12345
B"0x1234567890abcdef1234567890abcdef12345678"
Ctrue
D0x1234567890abcdef1234567890abcdef12345678
Attempts:
3 left
💡 Hint
Common Mistakes
Putting quotes around the address
Using a number instead of an address
4fill in blank
hard

Fill both blanks to declare a signed integer and assign it a negative value.

Blockchain / Solidity
int public temperature [1] [2];
Drag options to blanks, or click blank then click option'
A-25
B25
C;
D=
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong assignment operator
Putting the minus sign after the number
5fill in blank
hard

Fill all three blanks to declare a string variable and assign it a greeting message.

Blockchain / Solidity
string [1] greeting [2] [3];
Drag options to blanks, or click blank then click option'
A;
B=
C"Hello, world!"
Dpublic
Attempts:
3 left
💡 Hint
Common Mistakes
Missing visibility keyword
Forgetting quotes around the string