Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to define a struct named Person with a string name.
Blockchain / Solidity
struct Person {
string [1];
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong field name like 'age' or 'address' when the task asks for 'name'.
Forgetting to specify the field name.
✗ Incorrect
The struct Person should have a field called name of type string.
2fill in blank
mediumComplete the code to declare a variable of type Person named user.
Blockchain / Solidity
Person [1]; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different variable name like 'person' or 'account'.
Forgetting the semicolon at the end (not part of the blank but common error).
✗ Incorrect
The variable should be named user as requested.
3fill in blank
hardFix the error in the struct definition by completing the missing type for the field age.
Blockchain / Solidity
struct Person {
string name;
[1] age;
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using
string or bool for age.Using
address which is for blockchain addresses.✗ Incorrect
The field age should be an unsigned integer (uint) to represent a person's age.
4fill in blank
hardFill both blanks to create a struct named Car with a string model and a uint year.
Blockchain / Solidity
struct [1] { [2] model; uint year; }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong struct name like 'Person'.
Using wrong type for model like 'uint'.
✗ Incorrect
The struct should be named Car and the model field should be of type string.
5fill in blank
hardFill all three blanks to create a struct named Book with a string title, string author, and uint pages.
Blockchain / Solidity
struct [1] { [2] title; [3] author; uint pages; }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using different struct name.
Using wrong types for title or author.
✗ Incorrect
The struct is named Book. Both title and author fields are of type string.