Recall & Review
beginner
What is the purpose of emitting events in blockchain smart contracts?
Emitting events allows smart contracts to log information that external applications can listen to and react upon. It helps track contract activity without storing data on-chain.
Click to reveal answer
beginner
How do you declare an event in Solidity?
You declare an event using the
event keyword followed by the event name and parameters, for example: event Transfer(address indexed from, address indexed to, uint256 amount);Click to reveal answer
intermediate
What does the
indexed keyword do in event parameters?The
indexed keyword marks parameters that can be used as filters when searching for events. Up to 3 parameters can be indexed to make event queries efficient.Click to reveal answer
beginner
How do you emit an event inside a Solidity function?
You use the
emit keyword followed by the event name and arguments, like: emit Transfer(msg.sender, recipient, amount);Click to reveal answer
intermediate
Why are events cheaper than storing data on the blockchain?
Events store data in transaction logs, which are cheaper to write and do not consume as much gas as storing data in contract storage. However, event data is not accessible by contracts, only by external listeners.
Click to reveal answer
Which keyword is used to declare an event in Solidity?
✗ Incorrect
The
event keyword declares an event. The emit keyword is used to trigger it.What does the
emit keyword do in Solidity?✗ Incorrect
The
emit keyword triggers an event so it is recorded in the transaction logs.How many parameters can be indexed in a Solidity event for filtering?
✗ Incorrect
Up to 3 parameters can be marked
indexed to allow efficient filtering.Where is event data stored in the blockchain?
✗ Incorrect
Event data is stored in transaction logs, which are cheaper and accessible off-chain.
Can smart contracts read event data after it is emitted?
✗ Incorrect
Contracts cannot access event data; only external applications can listen and read events.
Explain how emitting events helps external applications interact with smart contracts.
Think about how apps watch for changes without reading contract storage.
You got /4 concepts.
Describe the syntax and usage of declaring and emitting an event in Solidity.
Focus on how to define and then trigger an event.
You got /4 concepts.