Smart Contracts and Ethereum Flashcards
7 cards from real CCE practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 Smart Contracts and Ethereum flashcards as text
What is the purpose of the 'fallback' function in a Solidity smart contract?
Answer: To execute when no other function matches the call or when Ether is sent without data
The fallback function executes when a call to the contract doesn't match any function signature or when plain Ether is sent without accompanying call data.
Which Ethereum Improvement Proposal introduced the ERC-20 token standard?
Answer: EIP-20
EIP-20 formally codified the ERC-20 fungible token standard, defining the interface functions like transfer, approve, and allowance.
What does 'reentrancy' mean in the context of smart contract vulnerabilities?
Answer: An external contract calling back into the vulnerable contract before its first execution completes
Reentrancy occurs when an external malicious contract calls back into the victim contract before its state is updated, enabling repeated fund withdrawals.
What is the role of an 'oracle' in Ethereum smart contracts?
Answer: A bridge that supplies real-world off-chain data to on-chain contracts
Oracles act as trusted data feeds that bring external information (prices, weather, sports results) onto the blockchain where smart contracts can consume it.
In Solidity, what is the difference between 'memory' and 'storage' data locations?
Answer: Storage persists on the blockchain permanently; memory exists only during a function call
Storage variables are written to the blockchain and persist between transactions, while memory variables are temporary and cleared after each function execution.
What is an Ethereum 'event' used for in smart contracts?
Answer: Logging data to the blockchain that off-chain applications can listen to
Events emit indexed logs stored in transaction receipts that DApps and external services can efficiently subscribe to and filter.
Which design pattern is commonly used to make Ethereum smart contracts upgradeable?
Answer: Proxy pattern
The proxy pattern separates storage from logic; the proxy contract holds state and delegates calls to an implementation contract that can be swapped out.