Solidity Smart Contract Development Flashcards
6 cards from real Ethereum Developer practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 6 Solidity Smart Contract Development flashcards as text
What is the Solidity `constructor` function used for?
Answer: Initializing contract state when it is deployed
The `constructor` runs once during contract deployment and is used to set initial state variables.
What does the `emit` keyword do in Solidity?
Answer: Fires an event that gets logged on the blockchain
The `emit` keyword triggers an event, recording a log entry in the transaction receipt on the blockchain.
Which Solidity keyword marks a state variable as unchangeable after deployment?
Answer: immutable
The `immutable` keyword allows a variable to be set in the constructor but never changed afterward.
What is a Solidity `modifier` used for?
Answer: Reusing pre- and post-condition logic across multiple functions
Modifiers wrap function execution with reusable guard logic, like access control checks, using `_;` as a placeholder.
What is the difference between `memory` and `storage` in Solidity?
Answer: memory is temporary and wiped after execution; storage persists on-chain
`memory` variables exist only during function execution while `storage` variables persist permanently on the blockchain.
Which Solidity function is called when Ether is sent to a contract with no calldata?
Answer: receive()
The `receive()` function handles plain Ether transfers with empty calldata, and must be marked `payable`.