Skip to content
Tech Interview Prep
Technical interview guide

Smart Contract Development (Solidity & EVM)

Writing and deploying self-executing contract code on the Ethereum Virtual Machine: state, gas, and the constraints of on-chain execution.

Read
48 min
Practice MCQs
25
Interview Q&A
25
Edition
v3
Editorial status
Reviewed

Scope: Solidity latest documentation (0.8.36/0.8.37 development line reviewed 2026-09-04); Ethereum EVM documentation updated 2026-07-26; target-chain fork rules must be verified at deployment; ERC-1967, EIP-170, and EIP-1153.

Curated: · Written: · Reviewed:

25 questions

MCQ-2A contract increments a counter in one transaction; a second transaction mined in a later block reads the counter and sees the incremented value. Where does that value live between the two transactions?
MCQ-1A team proposes an EVM upgrade that adds a precompile performing an HTTPS GET, so a contract could read a price feed directly during execution. Which property of the EVM makes this unworkable even with the precompile in place?
MCQ-6A contract writes each new user's balance into a fresh storage slot that has never held a value, and later transactions read that slot on-chain. Which of these operations costs the most gas when the contract is used heavily?
MCQ-3A team deploys a contract with a tool that reports the creation transaction's input data as 12,340 bytes and the constructor arguments as 320 bytes. After the transaction is mined, the new account's code is 3,180 bytes. A reviewer flags this as a failed deployment because 12,340 bytes went in but only 3,180 bytes are on-chain. Which explanation is correct?
MCQ-8A Solidity 0.8.24 contract deployed three blocks ago stores a signing key in `bytes32 private signingKey;` (its first declared state variable, so slot 0) assigned once in the constructor from a literal in the source and never written again. The team's audit note says the key is safe because the variable is `private` and no function returns it. An auditor has the deployed address and a standard full-node RPC endpoint. Which action returns the key?
MCQ-14A marketplace contract emits `event Listed(uint256 indexed tokenId, string indexed name, uint256 price)`. Every `Listed` log carries three topics: the event signature hash, `tokenId`, and one more. An indexer built from the deployed ABI reads `topics[2]` and compares it byte-for-byte with the UTF-8 encoding of the search term. Searching for `alice` returns no matches, even though the contract was deployed three days ago, the node retains every receipt, and the indexer regenerates its ABI from the deployed source on each deploy. What is the cause?
MCQ-10A vault runs `(bool ok, bytes memory ret) = strategy.call(abi.encodeCall(IStrategy.withdraw, (amount)));` and credits the user whenever `ok` is true, never decoding `ret`. The strategy signals a partial fill by returning `false` instead of reverting. In production, users are credited for withdrawals the strategy never made. What does `ok == true` actually establish?
MCQ-12A staking contract is deployed with Solidity 0.8.19. It stores `uint256 public totalStaked`, currently 1, and exposes: ```solidity function stake(uint256 amount) external { totalStaked += amount; } ``` An integration test sends one transaction calling `stake(type(uint256).max)`. The transaction is mined. What is the observable result?
MCQ-5A payout contract stores recipients in `address[] public recipients` and pays them in one transaction: ```solidity function distribute() external { for (uint256 i = 0; i < recipients.length; i++) { (bool ok, ) = recipients[i].call{value: 0.001 ether}(""); require(ok, "transfer failed"); } } ``` The team measured about 15,000 gas per iteration on their node. The array now holds 3,000 addresses and the node's block gas limit is 30,000,000. `distribute()` reverts with out-of-gas on every call. Which change makes the payouts executable?
MCQ-4A contract routes its external calls through a hand-written Yul dispatcher that reads the four-byte selector from calldata and switches on it. A review finds that two of the contract's canonical function signatures have keccak256 hashes that share the same first four bytes. A client calls the second function. What happens?
MCQ-15A team ships an upgradeable vault. The proxy at 0xP holds all user balances in its storage slot 0 and forwards every call to implementation 0xI with delegatecall. A routine upgrade points the proxy at a new implementation 0xJ. Within minutes, an attacker drains the vault by calling a function on 0xJ that writes to slot 0. Which property of delegatecall explains why the attacker's write landed in the proxy's balance slot?
MCQ-7A proxy delegates to V1, which declares `address owner` (slot 0), `uint256 totalSupply` (slot 1), and `mapping(address => uint256) balances` (slot 2). Just before the upgrade, `totalSupply` is 1,000,000e18 and `balances[alice]` is 500e18. The team deploys V2, which declares `address owner`, then a new `uint256 feeBps`, then `uint256 totalSupply`, then `mapping(address => uint256) balances`, and repoints the proxy at it. What does a V2 call report for `feeBps`, `totalSupply` and `balances[alice]`?
MCQ-16An upgradeable staking contract is deployed by a script that sends three transactions: (1) deploy the implementation, (2) deploy an ERC1967Proxy with empty initialization calldata, (3) call initialize(owner, rewardRate) on the proxy. Before transaction 3 is mined, an attacker submits initialize(attacker, 0) to the proxy with a higher gas price; it is mined first and the attacker becomes owner. Which change removes this exposure?
MCQ-17A hypothetical $40M lending pool is deployed behind an ERC-1967 proxy. The proxy admin is a 2-of-3 multisig that can change the implementation address with no timelock. The proxy holds all USDC balances; the implementation holds all logic. A depositor is deciding whether to supply USDC. Which statement best describes the trust the depositor is extending?
MCQ-9A vault contract holds 3 ETH from three depositors. Its withdraw function runs `uint256 amount = balances[msg.sender]; require(amount > 0); (bool ok, ) = msg.sender.call{value: amount}(""); require(ok); balances[msg.sender] = 0;`. An attacker deposits 1 ETH, then calls withdraw() from a contract whose receive() calls withdraw() once more before returning. What is the result?
MCQ-11An EOA owner deploys a vault holding 1,800 ETH. Its sweep() is guarded by require(tx.origin == owner) and transfers the vault's entire balance to msg.sender. The owner signs a transaction that calls claim() on an attacker-deployed contract, sending 0.5 ETH with it; inside claim(), the attacker's contract calls vault.sweep(). What is the result?
MCQ-13An airdrop contract loops over five recipients and calls `token.transfer(recipient, amount)` on each inside a `try/catch`, so one bad recipient cannot abort the batch. For recipient #3, the token writes the balance update and then a post-transfer hook reverts; by that point the call has consumed 25,000 gas. The loop catches the error and continues, and the batch transaction is mined. Which statement describes the mined result?
MCQ-19A factory contract deploys a fresh clone of a wallet implementation with CREATE2 so that users can receive funds at a counterfactual address before the wallet exists on-chain. The factory is deployed at 0x9f8B...21c4 on mainnet, and the wallet initcode is the standard EIP-1167 minimal proxy pointing at implementation 0x4a3F...d7e1. A user computes their wallet address off-chain, shares it, and receives 3 ETH. When the factory later calls CREATE2 with the same salt and the same initcode, the deployment reverts with 'create2: address collision'. What is the most likely cause?
MCQ-20A vault replaces its SSTORE-based reentrancy lock with TSTORE/TLOAD to cut gas. During a deposit, the vault delegatecalls a helper that reads the same lock slot before doing its work. What does the helper read, and what does a later transaction read?
MCQ-18A team verifies a deployed contract. The source at the deployed commit matches exactly. Their local rebuild with solc 0.8.20 produces runtime bytecode of 4,213 bytes; the on-chain runtime code is also 4,213 bytes, but the final 53 bytes differ. The deployment pipeline used solc 0.8.19. What is the correct diagnosis and next step?
MCQ-21A team runs `solc --model-checker-engine bmc` on a `Vault` contract. Its `deposit` function loops over a storage array of balances and ends with `assert(total <= cap)`. The checker reports no assertion violation, so the team ships. An auditor later shows that depositing into a 12-element array pushes `total` past `cap` and trips the assertion. Which explanation fits the checker's silence?
MCQ-22A vault tracks a single `totalAssets` value and per-user balances, and the spec requires `totalAssets` to equal the sum of all balances at all times. A stateless fuzz test calls `withdraw(amount)` with `amount <= balance` from a fresh state and asserts it never reverts; it passes 50,000 runs. The team adds a stateful invariant test with `deposit`, `withdraw` and `transfer` handlers and the same invariant. After 12,000 sequences it reports a counterexample: B deposits 100, A deposits 100, B transfers 100 to A, A withdraws 200. `totalAssets` is 100 while the sum of balances is 0. What does this result establish?
MCQ-23A team's fork test runs against mainnet pinned at block 19,500,000. It impersonates a whale holder, calls `deal` to give that address 1,000,000 USDC, then runs the protocol's deposit flow, which passes. After deployment the same flow reverts in production with `ERC20: insufficient allowance` for that whale, and the fork test still passes on re-run. Which statement explains why the fork passed while production reverted?
MCQ-24A deployer service marks a CREATE durable only after 12 confirmations, counting confirmations as (current block height − inclusion block height). The CREATE receipt first appears at block 1,000,000 with status 1. At block 1,000,005 a reorg 7 blocks deep replaces blocks 999,999–1,000,005; the CREATE is re-included at block 1,000,002 with the same address and runtime code. At block 1,000,005, what is the deployment's confirmation count, and is it durable?
MCQ-25A marketplace backend subscribes to `newHeads` over websocket and credits a user's ERC-20 balance the moment a matching `Transfer` log arrives, storing only (user_address, amount, block_number). During a 3-block reorg, a 500 USDC deposit at block 19,204,113 was orphaned and replaced at block 19,204,114 by a transfer of the same 500 USDC to a different address. The credited user had already withdrawn the 500 USDC, and the balance table now reads 500 higher than the chain. Reads must stay under 50 ms from the local store. Which change makes the table correct and keeps it correct through reorgs?