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
  1. In Solidity 0.8.x, what happens when an arithmetic overflow occurs by default? The transaction reverts automatically
  2. What can the deployer use to run code on the blockchain? Solidity language
  3. What is the default visibility of state variables in Solidity? internal
  4. What does a Solidity mapping return for a key that has never been set? The default zero value for the value type
  5. What does the reducing length property do? Delete elements from the array
  6. What is the default value of an uninitialized bool state variable in Solidity? false
  7. What does the 'payable' modifier on a function allow in Solidity? The function can receive Ether
  8. Which of the following is the correct way to declare a mapping from address to uint in Solidity? mapping(address => uint) balances;
  9. What is the risk of using `delegatecall` to an untrusted contract? The callee can overwrite the caller's storage with malicious data
  10. What is the purpose of the `receive()` function in Solidity? It handles plain ETH transfers sent to the contract without calldata
  11. Which Solidity type correctly declares a fixed-size byte array of exactly 32 bytes? bytes32
  12. What does 'assert()' do differently from 'require()' in Solidity? assert() consumes all remaining gas on failure; require() refunds unused gas
  13. Which attack exploits a contract that calls an external contract before updating its state? Reentrancy attack
  14. What Solidity modifier from OpenZeppelin prevents reentrancy by locking the function? nonReentrant
  15. What vulnerability arises when Solidity arithmetic operations exceed the maximum or minimum value of the data type? Integer overflow/underflow
  16. What are state variables in Solidity stored in? Slots
  17. Who created Ethereum? Gavin James Wood
  18. What happens when `abi.decode` receives data that does not match the specified types? The transaction reverts with a decoding error
  19. What is the name of the property that you can use to delete elements from an array? Reducing length
  20. What do Solidity arrays hold, depending on their size? Elements
  21. 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
  22. What happens to variables stored in the memory data location after a Solidity function call ends? They are erased and the memory is freed
  23. What happens when you call 'require(false)' in a Solidity function? The transaction reverts and remaining gas is refunded
  24. 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
  25. Which function selector is called when Ether is sent to a contract with no calldata and no fallback? The receive() function
  26. What is the 'fallback' function used for in Solidity? To execute when a contract receives a call with no matching function selector
  27. What is the purpose of the 'constructor' function in a Solidity contract? It runs once when the contract is deployed
  28. Which modifier prevents a function from being re-entered before it finishes execution? nonReentrant
  29. What storage slot number is assigned to the first state variable declared in a Solidity contract? Slot 0
  30. Which of the following correctly uses a struct in Solidity? struct Person { string name; uint age; }
Was this helpful?