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
In Solidity, what does `msg.sender` refer to?
Answer: The address that called the current function
`msg.sender` is a global variable representing the address of the entity that directly called the current function.
What is the purpose of the `SafeMath` library in older Solidity contracts?
Answer: To prevent integer overflow and underflow vulnerabilities
`SafeMath` adds checked arithmetic operations that revert on overflow/underflow, a risk that was automatic only from Solidity 0.8.0 onward.
What does the `abstract` keyword indicate about a Solidity contract?
Answer: It has at least one unimplemented function and cannot be deployed directly
An `abstract` contract contains at least one function without implementation and must be inherited and completed before deployment.
How does Solidity handle integer division by default?
Answer: It truncates toward zero with no remainder
Solidity integer division truncates the result toward zero, discarding any fractional part.
What is the maximum number of indexed parameters allowed in a Solidity event?
Answer: 3
Solidity allows up to 3 indexed event parameters, which are stored as topics in the transaction log for efficient filtering.
Which opcode does Solidity use when making an external function call that preserves the calling contract's context?
Answer: DELEGATECALL
`DELEGATECALL` executes the target contract's code in the context of the calling contract, reusing its storage and `msg.sender`.