Smart Contracts & Decentralized Applications Flashcards
7 cards from real CBSA 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 & Decentralized Applications flashcards as text
Which Solidity visibility modifier makes a function callable only from within the contract itself and not from derived contracts?
Answer: private
The `private` modifier restricts function access to the defining contract only, excluding derived contracts.
In Ethereum smart contracts, what is a 'reentrancy attack'?
Answer: An external contract recursively calling back into the victim contract before state updates complete
Reentrancy attacks occur when a malicious contract calls back into the victim before its state (like balance) is updated, draining funds.
What does the ERC-721 standard define?
Answer: A standard for non-fungible tokens (NFTs) on Ethereum
ERC-721 defines the standard interface for non-fungible tokens, where each token has a unique identifier.
Which design pattern separates a smart contract's logic from its data storage to enable upgradability?
Answer: Proxy pattern
The proxy pattern delegates calls to a logic contract while keeping state in the proxy, allowing the logic to be replaced without changing the storage address.
What is the purpose of the `require` statement in a Solidity smart contract?
Answer: To validate conditions and revert the transaction if the condition is false
`require` validates inputs or conditions and reverts the transaction with an optional error message if the condition fails.
In the context of dApps, what role does IPFS primarily serve?
Answer: Providing decentralized storage for large files and front-end assets
IPFS (InterPlanetary File System) provides content-addressed, decentralized storage commonly used for dApp front-ends and NFT metadata.
What is 'gas stipend' in the context of Ethereum smart contract calls?
Answer: The fixed amount of gas forwarded when a contract sends Ether using `transfer` or `send`
Solidity's `transfer` and `send` forward only 2,300 gas, preventing reentrancy but limiting what the recipient contract can do.