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
Which consensus-related attack involves a miner reordering transactions in a block to profit from price movements in a DeFi protocol?
Answer: Maximal Extractable Value (MEV)
MEV refers to the profit miners or validators can extract by including, excluding, or reordering transactions within the blocks they produce.
What does the term 'gas limit' represent in an Ethereum transaction?
Answer: The maximum amount of computational work the sender is willing to pay for
Gas limit is the maximum units of gas a sender authorizes for a transaction; if execution requires more gas, it reverts but the gas is still consumed.
Which Solidity function visibility modifier makes a function accessible only within the contract that defines it and not by derived contracts?
Answer: private
Private functions are only accessible within the contract they are defined in, unlike internal functions which are also accessible in derived (child) contracts.
What is the main advantage of using the ERC-1155 multi-token standard over separate ERC-20 and ERC-721 contracts?
Answer: It allows a single contract to manage multiple fungible and non-fungible token types, reducing deployment costs
ERC-1155 lets a single contract manage any combination of fungible and non-fungible tokens, enabling batch transfers and significantly lower gas costs.
In the context of DApps, what is the purpose of the Web3.js or Ethers.js library?
Answer: To provide a JavaScript interface for interacting with Ethereum nodes and smart contracts
Web3.js and Ethers.js are JavaScript libraries that enable frontend DApp code to communicate with Ethereum nodes via JSON-RPC, call contract functions, and listen for events.
What is 'flash loan' in DeFi smart contracts?
Answer: An uncollateralized loan that must be borrowed and repaid within a single transaction
Flash loans are atomic, uncollateralized loans where borrowing and repayment occur in one transaction; if repayment fails, the entire transaction reverts.
Which tool is most commonly used to test and deploy Ethereum smart contracts in a local development environment?
Answer: Hardhat or Truffle
Hardhat and Truffle provide local Ethereum node emulation, automated testing frameworks, and deployment scripts for smart contract development.