Solidity · Interview questions · Updated November 2026
Solidity interview questions in 2026 test the current 0.8 compiler line, and 0.8.38 is the latest release. Expect questions on data locations, inheritance, custom errors and events, sending Ether safely, reentrancy, the ABI, and tools such as Remix, Foundry and Hardhat. The Solidity project publishes no official certification exam, so interviews and technical assessments are where these skills are checked. This guide covers the topics by area and by level, gives a 2–3 week plan and ends with 10 free Solidity practice questions with answers.
At a glance
| Topic | Solidity smart contract development |
| Current compiler | Solidity 0.8.38 (released 22 October 2026) |
| Levels covered | Junior, mid-level and senior |
| Core topics | Data locations, inheritance, errors, Ether, security, ABI |
| Official certification | None published by the Solidity project |
| Exametics set | 6 practice tests, 240 questions |
- Since Solidity 0.8.0, arithmetic reverts on overflow and underflow by default, so old SafeMath answers are out of date.
send()andtransfer()are now deprecated; expect questions on why.- Free in this post: 10 original practice questions with every option explained.
Source: Solidity documentation and Solidity releases on GitHub. Checked on 9 November 2026.
What Solidity interview questions test
Solidity interview questions check whether you can write a contract that is correct, cheap to run and hard to attack, often through code you have to read or fix.
The Solidity documentation calls Solidity “an object-oriented, high-level language for implementing smart contracts”. It also says to deploy with the latest released compiler, so recent 0.8 changes are fair game.
Quick answers to common Solidity interview questions
Short answers based on the Solidity 0.8.38 documentation; each topic is explained below.
| Question | Short answer |
|---|---|
What is the difference between constant and immutable? | A constant is fixed at compile time; an immutable can be assigned in the constructor. Both cost less gas than ordinary state variables. |
| What is a function selector? | The first four bytes of the Keccak-256 hash of the function signature. |
When does receive() run, and when does fallback() run? | receive() runs on calls with empty calldata. fallback() runs when no function matches, and must be payable to accept Ether. |
What is the difference between require and assert? | A failed require reverts with no data, Error(string) or a custom error. A failed assert creates Panic(uint256) with code 0x01. |
| How do you prevent reentrancy? | Use Checks-Effects-Interactions: update state before any external call. A reentrancy guard adds a second layer. |
Why not use tx.origin for access control? | The docs say never to use it for authorisation; check msg.sender instead. |
The language and data locations
Expect basics first: types, mappings, structs, visibility, view and pure. Know the four function visibilities, and that the Solidity docs say private data is still visible to anyone reading the blockchain.
The Solidity types reference says assignments between storage and memory always create an independent copy, while assigning storage to a local storage variable only creates a reference.
- storage: persistent contract state; a local storage variable is a pointer to it.
- memory: temporary data for the current call; copying from storage gives you a separate copy.
- calldata: read-only function input that the function cannot modify.
- transient storage: added with EIP-1153; it behaves like storage but is reset to zero at the end of the transaction.
Inheritance, errors and events
The Solidity contracts reference says Solidity uses C3 linearization, like Python, but you list base contracts from “most base-like” to “most derived”, which is the reverse of Python. A call through super goes to the next contract in that final order, not simply to the parent you see in the source.
Error questions cover require, revert, assert, custom errors and try/catch. Panic(uint256) comes from failed assertions, overflow or division by zero.
For events, interviewers ask what indexed does. Up to three parameters can be indexed and become log topics that off-chain code can filter on; anonymous events can have four.
Ether, gas and security
Ether handling has changed: the docs now point to call{value: amount}("") for sending.
Security questions are the core of most mid-level and senior interviews. The Solidity security considerations page describes the Checks-Effects-Interactions pattern as “a common foolproof way to prevent reentrancy attacks” and says plainly: “Never use tx.origin for authorization.”
The compiler, the ABI and tools
ABI questions check that you know how a call reaches a function. The Solidity ABI specification defines the function selector and warns that abi.encodePacked is ambiguous with two dynamic values.
Remix IDE runs in your browser (a desktop app also exists) and covers writing, testing and deploying contracts. Foundry is a toolkit made up of forge (build, test and deploy), cast, anvil (a local node) and chisel (a Solidity REPL); forge runs tests written in Solidity. Hardhat 3 supports both TypeScript and Solidity tests.
Exametics practice tests
Solidity Interview Questions Practice Tests
- 6 practice tests with 40 questions each: 240 questions in total
- Rebuilt in November 2026 against the Solidity documentation for the 0.8.38 compiler, with every code question compiled
- Every answer explained, with a hint, and tagged with one of nine topic areas
- Timed Exam Mode test
- Lifetime access
30-day refund. Instant access after payment.
Solidity interview questions by level: junior, mid and senior
The level of the role changes the depth more than the topics: juniors explain what a feature does, mid-level developers explain why code behaves as it does, and seniors explain how they would secure a whole system.
| Level | What you should be able to do |
|---|---|
| Junior | Build and explain a small contract: a balance mapping, an owner check with msg.sender, an event on each transfer and a function that accepts Ether. Explain visibility, view/pure, payable, and require versus revert. Deploy and call it in Remix. |
| Mid-level | Read code and predict the result: why an update does not persist, why a call panics, and which function runs when Ether arrives with no data. Write Foundry or Hardhat tests that expect a specific custom error. |
| Senior | Review a withdrawal function, find and fix reentrancy and unsafe authorisation, reason about gas, and explain why abi.encodePacked with two strings is unsafe as a hash key. The 0.8.38 docs list osaka as the default EVM version and mark send(), transfer(), selfdestruct and virtual modifiers as deprecated. |
Next on your Web3 developer path
- JavaScript Interview Questions practice tests: front ends and scripts that call your contracts are usually written in JavaScript.
- TypeScript practice tests: Hardhat 3 tests can be written in TypeScript as well as Solidity.
- Cybersecurity and Ethical Hacking Interview practice tests: a broader security base helps if you are training as a smart contract auditor.
For background reading, see our guides to JavaScript interview questions on closures, async code and the DOM, TypeScript practice tests on types and generics and the JSE-40-01 JavaScript certification exam format and topics.
How to prepare for a Solidity interview in 2–3 weeks
If you can already program in another language, two to three weeks is a realistic plan: language and data first, then Ether and security, then tools and timed practice.
- Days 1–4: language basics and data locations Write a small token contract in Remix with a mapping, a struct and all four visibilities. Copy a storage struct into memory, change it, and check what was saved.
- Days 5–7: inheritance, errors and events Build an inheritance chain that calls
superand log the order. Use custom errors and indexed events. - Days 8–10: Ether, gas and security Add
receive()and a withdrawal function that usescall. Attack it with a reentrancy contract, then fix it with Checks-Effects-Interactions. - Days 11–13: tools, testing and the ABI Port the project to Foundry or Hardhat, write tests that expect specific reverts, and compare
abi.encodewithabi.encodePacked. - Days 14–18: timed practice Try the 10 free questions below, then take the Solidity interview practice tests in timed Exam Mode. Then revisit your weakest topic areas.
Tip
For every vulnerability you study, practise saying three things out loud: how the attack works, the code that allows it, and the fix. Interviewers listen for all three.
Planning more than one exam?
If you are preparing for several interviews or certifications, the All-Access Pass covers every practice test on Exametics, including all 58 interview-question sets, plus new exams as they are added, with lifetime access. It costs less than buying about six single practice tests.
Free Solidity interview questions (10 with answers)
Try these 10 free practice questions before you open the answers. They are original Solidity sample questions written for 0.8.38, each labelled with its topic area; the full Exametics Solidity practice test set has 240 more questions in the same style.
Practice question 1 · Language basics
A contract compiled with Solidity 0.8.38 has function inc(uint8 x) public pure returns (uint8) { return x + 1; }. What happens when you call inc(255)?
- A. It returns 0, because
uint8wraps around. - B. It reverts with a
Panic(uint256)error, code0x11. - C. It returns 256, because the addition is done in a wider type.
- D. It fails to compile, because 255 + 1 does not fit in a
uint8.
Show answer
Answer: B. Since Solidity 0.8.0, arithmetic is checked by default and reverts on overflow or underflow. The Solidity control structures reference lists panic code 0x11 for an overflow or underflow outside an unchecked block.
A is the pre-0.8.0 behaviour, or what you get inside unchecked { }. C is wrong because the result type of x + 1 is uint8. D is wrong because x is only known at run time, so the compiler cannot reject the call.
Practice question 2 · Data locations
A contract stores mapping(address => User) users;, where User is a struct with a uint score. A function runs User memory u = users[msg.sender]; u.score += 1; and then ends. What is the value of users[msg.sender].score afterwards?
- A. One higher, because
upoints to the struct in storage. - B. The transaction reverts, because a storage struct cannot be read into memory.
- C. One higher, but only until the end of the transaction.
- D. Unchanged, because
uis an independent copy in memory.
Show answer
Answer: D. The Solidity types reference says assignments between storage and memory always create an independent copy. Changing u changes only the memory copy, which is thrown away when the function ends. To update the stored struct, declare User storage u = users[msg.sender];, which assigns a reference.
A describes a storage local variable, not a memory one. B is wrong because copying a storage struct to memory is allowed. C describes transient storage, which is a different data location.
Practice question 3 · Tools and testing
In a Foundry test, vault.sweep() should revert with the custom error NotOwner(), declared in the Vault contract, because the test contract is not the owner. Where should vm.expectRevert(Vault.NotOwner.selector); go?
- A. On the line directly before
vault.sweep();. - B. On the line directly after
vault.sweep();. - C. Once in
setUp(), so it applies to every test in the file. - D. Nowhere; Foundry treats any revert as a passed test.
Show answer
Answer: A. The Foundry expectRevert reference says the cheatcode “asserts that the next call reverts”, and the bytes4 form checks for an exact match of the error selector. So it must come right before the call you expect to fail.
B is wrong because the revert has already happened before that line runs. C is wrong because the expectation applies to the next call only, not to a whole file. D is wrong because the Foundry docs present vm.expectRevert as the way to test that a call reverts, so the expectation has to be stated before the call.
Practice question 4 · Inheritance
Root has function run() public virtual that emits Log("Root"). Left is Root and Right is Root each override run() (marked virtual override) to emit their own name and then call super.run(). Leaf is Left, Right overrides run() with override(Left, Right), emits Log("Leaf") and calls super.run(). In what order are the events emitted when you call Leaf.run()?
- A. Leaf, Left, Right, Root
- B. Leaf, Left, Root
- C. Leaf, Right, Left, Root
- D. Leaf, Right, Root, Left, Root
Show answer
Answer: C. Solidity uses C3 linearization with bases listed from most base-like to most derived, so the final order for Leaf is Leaf, Right, Left, Root. The Solidity contracts reference explains that super calls the next contract in that final order, not the parent in the source. So Right‘s super.run() calls Left, and Left‘s calls Root.
A uses Python’s left-to-right order, which the docs say is the reverse of Solidity’s. B is the order you would get if super simply meant the first listed parent and Left‘s super meant its own parent Root; it skips Right. D runs Root twice, which linearization prevents: each contract appears once.
Practice question 5 · Errors
A function checks require(balance >= amount); with no second argument, and the condition is false. What does the caller receive?
- A. An
Error(string)with an empty string. - B. A revert with no return data at all, not even an error selector.
- C. A
Panic(uint256)error with code0x01. - D. No revert;
requirereturnsfalseand execution continues.
Show answer
Answer: B. The Solidity control structures reference lists three overloads of require. require(bool) reverts without any data, require(bool, string) reverts with Error(string), and require(bool, error) reverts with your custom error.
A is what you get only when you pass a message string. C is the panic from a failed assert, not from require. D is wrong because a failed require always reverts the current call; returning false is how the deprecated send() reports failure.
Practice question 6 · Events
A developer declares event Moved(address indexed from, address indexed to, uint256 indexed id, uint256 indexed amount); as a normal, non-anonymous event. What happens?
- A. It does not compile: a non-anonymous event can have at most three indexed parameters.
- B. It compiles, and all four parameters become searchable topics.
- C. It compiles, but the fourth
indexedkeyword is silently ignored. - D. It compiles only if
amountis changed to a reference type such asstring.
Show answer
Answer: A. The Solidity contracts reference says you can add indexed to up to three parameters. For a non-anonymous event, the hash of the event signature is also one of the topics. Only an anonymous event can have four indexed arguments.
B describes an anonymous event, not this one. C is wrong because the compiler reports an error rather than ignoring the keyword. D is wrong because the limit counts indexed parameters of any type; an indexed reference type stores only its Keccak-256 hash as the topic.
Practice question 7 · Ether and gas
A contract has fallback() external payable { ... } but no receive() function. Another contract sends it 1 ether using call{value: 1 ether}("") with empty calldata. What happens?
- A. The call reverts, because only
receive()can accept plain Ether. - B. The Ether is accepted, but no code in the contract runs.
- C. The contract fails to compile, because a payable fallback needs a
receive()function. - D. The payable
fallback()runs and the Ether is accepted.
Show answer
Answer: D. The Solidity contracts reference says that when there is no receive() function but a payable fallback exists, the fallback is called on a plain Ether transfer. If neither exists, the transfer throws an exception.
A is wrong because a payable fallback can accept Ether. B is wrong because the fallback’s code does run. C is wrong because this compiles; the docs only recommend also adding receive(), so that Ether transfers can be told apart from calls to functions that do not exist.
Practice question 8 · Ether and gas
A code review asks you to modernise payable(to).transfer(amount); for Solidity 0.8.38. Which statement matches the current Solidity documentation?
- A. Keep
transfer(), because its 2300 gas stipend is the recommended reentrancy protection. - B. Switch to
send(), because it reverts with a clearer error message. - C.
transfer()andsend()are deprecated; usecall{value: amount}(""), check the returned success flag, and protect against reentrancy by other means. - D. Use
call{value: amount}(""), which forwards exactly 2300 gas by default.
Show answer
Answer: C. The Solidity types reference says transfer and send are deprecated and scheduled for removal, and that simple Ether transfers can use call{value: amount}(""). It adds that the 2300 gas value “no longer holds its original meaning” and recommends other ways to prevent reentrancy, such as Checks-Effects-Interactions.
A is wrong because the docs no longer treat the stipend as reentrancy protection. B is wrong because send() returns false on failure instead of reverting, and it is deprecated too. D is wrong because call forwards all remaining gas by default unless you set a gas limit.
Practice question 9 · Common vulnerabilities
Alice owns a wallet contract with function payOut(address payable to, uint amount) external { require(tx.origin == owner); (bool ok, ) = to.call{value: amount}(""); require(ok); }. An attacker persuades Alice to call a function on the attacker’s own contract, and that function calls payOut with the attacker’s address. What happens?
- A. The call reverts, because the wallet sees the attacker’s contract as the caller, not Alice.
- B. The check passes and the attacker is paid, because
tx.originis still Alice; checkingmsg.sender == ownerwould stop it. - C. The call reverts, because a contract cannot call another contract’s function that sends Ether.
- D. The payment waits until Alice signs a second transaction that approves it.
Show answer
Answer: B. tx.origin is the account that started the transaction, so it stays Alice’s address through every nested call. msg.sender is the immediate caller, which here is the attacker’s contract. That is why the Solidity security considerations page says “Never use tx.origin for authorization”: a phishing contract that the owner calls can pass the check.
A would be true only if the wallet checked msg.sender, which is the fix. C is wrong because contracts call each other and send Ether all the time; nothing in the language blocks it. D is wrong because the whole chain of calls runs inside Alice’s one transaction, and the wallet asks for no second approval.
Practice question 10 · Compiler and ABI
A registry uses keccak256(abi.encodePacked(firstName, lastName)), where both values are string, as a unique key. What is the problem?
- A.
abi.encodePackedpads each string to 32 bytes, so it wastes gas. - B.
keccak256cannot takebytesinput. - C.
abi.encodePackedcannot encode strings and fails to compile. - D. Different inputs can give the same key, for example (“a”, “bc”) and (“ab”, “c”); use
abi.encodeinstead.
Show answer
Answer: D. The Solidity ABI specification warns that packed encoding is ambiguous with two dynamic types and gives this exact case: abi.encodePacked("a", "bc") == abi.encodePacked("ab", "c"). abi.encode includes lengths and padding, so different inputs give different encodings.
A is backwards: in packed mode, dynamic types are encoded in place without their length, and short types without padding. B is wrong because keccak256 takes bytes memory. C is wrong because packed encoding accepts strings; the problem is ambiguity, not compilation.
How did you score?
8–10 correct: you are ready for a full timed test, so try Exam Mode next. Under 8: revise the topic areas you missed in the Solidity docs, then practise again. The Solidity interview practice tests have 240 more questions like these, each with a hint and a full explanation.
Common mistakes in Solidity interviews
Most lost marks come from answers based on older Solidity versions, or from naming a fix without the attack it stops.
- Recommending SafeMath by reflex. Arithmetic has been checked by default since 0.8.0. Explain when
uncheckedis safe instead. - Calling
transfer()the safe way to send Ether. The current docs marksend()andtransfer()as deprecated; talk aboutcall, checking the result, and reentrancy protection. - Mixing up
memoryandstorage. Copying a storage struct to memory and editing the copy is a classic “why did nothing save?” bug. - Using
tx.originfor access control. The docs say never use it for authorisation; usemsg.sender. - Treating
selfdestructas a delete button. The docs mark it deprecated since 0.8.18; from the Cancun upgrade it only sends Ether unless called in the transaction that created the contract.
Solidity interview questions: FAQs
What do Solidity interview questions cover in 2026?
They cover the Solidity 0.8 language, data locations, inheritance, custom errors and events, sending and receiving Ether, common vulnerabilities such as reentrancy, the ABI, and tools such as Remix, Foundry and Hardhat. The Solidity documentation says to deploy with the latest released compiler, which is 0.8.38 according to the Solidity releases page on GitHub.
Are there free Solidity interview practice questions with answers?
Yes. This post includes 10 free Solidity practice questions written for Solidity 0.8.38, with answers that explain every option. For a full practice test, the Exametics Solidity interview practice tests have 6 tests with 40 questions each, 240 questions in total.
What is the difference between memory, storage and calldata in Solidity?
Storage is persistent contract state, memory holds temporary data for the current call, and calldata is non-modifiable function input. The Solidity types reference says assignments between storage and memory always create an independent copy, while assigning storage to a local storage variable creates a reference.
How many questions are in the Exametics Solidity practice tests?
There are 6 practice tests with 40 questions each, 240 questions in total, including a timed Exam Mode test. Every question explains why the right answer is right and why the others are wrong, includes a hint, and is tagged with one of nine topic areas.
Is there an official Solidity certification exam?
No official certification is published on soliditylang.org, the Solidity project’s website. The Exametics Solidity practice tests are a knowledge and interview-preparation bank, not a copy of any exam.
Should I still learn transfer() and send() for a Solidity interview?
Learn how they work, but explain that they are deprecated. The Solidity types reference marks send and transfer as deprecated and scheduled for removal, and points to call with a value and an empty payload, plus separate reentrancy protection.
Is Solidity hard to learn, and how long does it take to prepare for an interview?
The Solidity documentation says the language is influenced by C++, Python and JavaScript, so the syntax feels familiar to many developers; the harder parts are data locations, gas and security. If you already program, two to three weeks of focused study is a realistic plan: language basics first, then Ether and security, then tools and timed practice.
Official documentation: Solidity 0.8.38 documentation. Checked on 9 November 2026.
Practise Solidity interview questions with full practice tests
Work through 240 Solidity questions in six practice tests, written for the 0.8.38 compiler, with a hint and a full explanation for every answer and a timed Exam Mode test.
✓ Every answer explained · ✓ Timed exam mode · ✓ 30-day refund