Smart Contracts and dApps Flashcards
7 cards from real CBCP 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 dApps flashcards as text
What is the purpose of the 'require' statement in Solidity?
Answer: To validate conditions and revert the transaction with a message if the condition is false
The require statement checks a condition at runtime; if it fails, it reverts the transaction and optionally provides an error message, refunding remaining gas.
Which design pattern is used in DApps to separate concerns by having a frontend interact with multiple specialized smart contracts rather than one monolithic contract?
Answer: Diamond (EIP-2535) or modular contract pattern
Modular contract patterns like the Diamond standard (EIP-2535) split logic into facets or separate contracts, improving maintainability and enabling upgrades without size limits.
What is 'slippage' in the context of decentralized exchange transactions?
Answer: The difference between the expected token price at order submission and the actual execution price
Slippage occurs because AMM prices shift continuously; a large trade or high volatility can cause the execution price to differ significantly from the quoted price.
In a DAO (Decentralized Autonomous Organization), what mechanism is most commonly used to prevent token holders from voting with borrowed tokens?
Answer: Snapshot-based voting where token balances are recorded at a specific block before the proposal
Snapshot voting records token balances at a specific block height before a proposal is created, preventing vote manipulation through flash loans or late token acquisition.
What is the EVM (Ethereum Virtual Machine) stack-based architecture's maximum stack depth?
Answer: 1024 elements
The EVM has a maximum stack depth of 1024 items; exceeding this limit causes a stack overflow and reverts the transaction.
What problem does the 'commit-reveal' scheme solve in smart contract-based applications?
Answer: It prevents front-running by hiding a user's intent until after the commitment phase
In a commit-reveal scheme, users first submit a hash of their action (commit), then later reveal the actual action, preventing others from copying or front-running the intent.
Which Ethereum Improvement Proposal introduced the concept of 'meta-transactions' to allow users to interact with DApps without holding ETH for gas?
Answer: EIP-4337 (Account Abstraction)
EIP-4337 (Account Abstraction) enables smart contract wallets and paymasters so users can pay gas in tokens or have a relayer sponsor fees, eliminating the need to hold ETH.