Solidity Cheat Sheet 2026
The 30 highest-yield Solidity facts, distilled from real exam questions. Print it, save it as a PDF, or study it here — free, no sign-up.
80 questions
120 min time limit
78.00% to pass
- In Solidity 0.8.x, what happens when an arithmetic overflow occurs by default? → The transaction reverts automatically
- What can the deployer use to run code on the blockchain? → Solidity language
- What is the default visibility of state variables in Solidity? → internal
- What does a Solidity mapping return for a key that has never been set? → The default zero value for the value type
- What does the reducing length property do? → Delete elements from the array
- What is the default value of an uninitialized bool state variable in Solidity? → false
- What does the 'payable' modifier on a function allow in Solidity? → The function can receive Ether
- Which of the following is the correct way to declare a mapping from address to uint in Solidity? → mapping(address => uint) balances;
- What is the risk of using `delegatecall` to an untrusted contract? → The callee can overwrite the caller's storage with malicious data
- What is the purpose of the `receive()` function in Solidity? → It handles plain ETH transfers sent to the contract without calldata
- Which Solidity type correctly declares a fixed-size byte array of exactly 32 bytes? → bytes32
- What does 'assert()' do differently from 'require()' in Solidity? → assert() consumes all remaining gas on failure; require() refunds unused gas
- Which attack exploits a contract that calls an external contract before updating its state? → Reentrancy attack
- What Solidity modifier from OpenZeppelin prevents reentrancy by locking the function? → nonReentrant
- What vulnerability arises when Solidity arithmetic operations exceed the maximum or minimum value of the data type? → Integer overflow/underflow
- What are state variables in Solidity stored in? → Slots
- Who created Ethereum? → Gavin James Wood
- What happens when `abi.decode` receives data that does not match the specified types? → The transaction reverts with a decoding error
- What is the name of the property that you can use to delete elements from an array? → Reducing length
- What do Solidity arrays hold, depending on their size? → Elements
- What is 'gas griefing' in the context of forwarding gas with `call` in Solidity? → A malicious callee can consume all forwarded gas, causing the caller to run out and revert
- What happens to variables stored in the memory data location after a Solidity function call ends? → They are erased and the memory is freed
- What happens when you call 'require(false)' in a Solidity function? → The transaction reverts and remaining gas is refunded
- What is the gas cost implication of using 'storage' vs 'memory' for arrays in Solidity? → Storage reads/writes cost significantly more gas than memory operations
- Which function selector is called when Ether is sent to a contract with no calldata and no fallback? → The receive() function
- What is the 'fallback' function used for in Solidity? → To execute when a contract receives a call with no matching function selector
- What is the purpose of the 'constructor' function in a Solidity contract? → It runs once when the contract is deployed
- Which modifier prevents a function from being re-entered before it finishes execution? → nonReentrant
- What storage slot number is assigned to the first state variable declared in a Solidity contract? → Slot 0
- Which of the following correctly uses a struct in Solidity? → struct Person { string name; uint age; }
Turn these facts into recall:
Was this helpful?