0
0
Blockchain / Solidityprogramming~5 mins

Contract structure and syntax in Blockchain / Solidity - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a contract in blockchain programming?
A contract is a set of rules and code that runs on the blockchain to manage digital agreements automatically.
Click to reveal answer
beginner
Name the basic parts of a smart contract structure.
A smart contract usually has: 1) Contract declaration, 2) State variables, 3) Functions, 4) Events, and 5) Constructor.
Click to reveal answer
beginner
What is the purpose of the constructor in a contract?
The constructor runs once when the contract is created. It sets initial values or settings for the contract.
Click to reveal answer
beginner
How do you define a function in a smart contract?
A function is defined with the keyword function, followed by its name, parameters, and code block inside curly braces.
Click to reveal answer
beginner
What is the role of state variables in a contract?
State variables store data permanently on the blockchain and keep the contract's state between function calls.
Click to reveal answer
Which keyword starts the definition of a smart contract?
Acontract
Bfunction
Cclass
Dvar
What does the constructor in a contract do?
ARuns once to initialize the contract
BDefines a reusable function
CStores data permanently
DTriggers an event
Where are state variables stored?
AIn temporary memory
BOnly during function execution
COn the blockchain permanently
DIn the user's device
Which symbol is used to group code inside functions?
A() (parentheses)
B{} (curly braces)
C[] (square brackets)
D<> (angle brackets)
What is the main purpose of events in a contract?
ATo declare variables
BTo store data permanently
CTo define functions
DTo log information for external apps
Describe the main parts of a smart contract and their roles.
Think about what each part does in managing data and actions.
You got /5 concepts.
    Explain how a constructor differs from other functions in a contract.
    Focus on when and how often it runs.
    You got /4 concepts.