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
Which Solidity keyword is used to declare a function that cannot modify contract state?
Answer: view
The `view` keyword declares a function that can read but not modify state variables.
What is the purpose of the `payable` keyword in a Solidity function?
Answer: It allows the function to receive Ether
The `payable` keyword allows a function to receive Ether as part of a transaction.
Which Solidity data type is used to store Ethereum addresses?
Answer: address
The `address` type is a 20-byte value specifically designed to hold Ethereum addresses.
What does the `require` statement do in Solidity when its condition is false?
Answer: Reverts the transaction and refunds unused gas
When `require` fails, it reverts all state changes and refunds the remaining gas to the caller.
In Solidity, what is a `mapping`?
Answer: A hash table that maps keys to values
A `mapping` in Solidity is a hash table that maps keys of one type to values of another type.
Which visibility specifier restricts a function to be called only within the contract itself?
Answer: private
The `private` visibility means the function can only be called from within the same contract, not from derived contracts.