Skip to content
Tech Interview Prep
Technical interview guide

DeFi Primitives (AMMs, Lending, Liquidity Pools)

The core building blocks of decentralized finance: automated market makers, lending protocols, and the liquidity pools they're built on.

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

Scope: Uniswap v2 and v3 specifications; Aave borrowing and liquidation documentation reviewed 2026-09-04 (version-specific parameters must be checked at integration); Chainlink Data Feeds; ERC-4626; ERC-3156; OWASP SCSVS.

Curated: · Written: · Reviewed:

25 questions

MCQ-3A desk sends a single 60 ETH sell into a Uniswap v2 pool holding 1,200 ETH and 2,400,000 USDC; the 0.30% fee is taken from the input before the swap. The router quotes an average fill near 1,899 USDC/ETH against a pre-trade spot of 2,000, while the desk's model predicted 1,994. Which correction makes the model match the quote?
MCQ-1A constant-product pool holds 1,200,000 USDC and 600 WETH, so k = 720,000,000. A trader submits a swap that sends in 12,000 USDC and demands at least 5.90 WETH out. The pool charges a 0.30% fee on the input, and the contract enforces the trader's minimum-output bound on-chain. What happens to this transaction?
MCQ-2A constant-product AMM pool holds 30 ETH and 60,000 USDC. You are the only liquidity provider. You deposit 3 ETH and 6,000 USDC, then a trader swaps 6,000 USDC into the pool. Ignoring fees, what is your LP token position worth in USDC immediately after the swap?
MCQ-4An LP deposits 1 ETH and 2,000 USDC into a 50/50 constant-product pool when ETH trades at $2,000. ETH now trades at $5,000, and the LP has separately claimed 120 USDC in swap fees. What is the LP's total position worth, and how does it compare with holding the original deposit?
MCQ-7An LP opens a Uniswap v3 WETH/USDC position with a range of $1,600–$2,500 per WETH, depositing 1 WETH and 2,000 USDC at a price of $2,000. Over the following week WETH trades up to $3,000 and never falls back below $2,500. Which statement describes the position at the end of the week?
MCQ-6An AMM pool holds 1,000 ETH and 2,000,000 USDC and charges a 0.3% fee. A trader submits a 20,000 USDC → ETH swap with minOut set to 9.77 ETH, 1% below the 9.87 ETH quote. In the same block, an address buys 9,000 USDC of ETH immediately before the trader's swap and sells that ETH back immediately after. The trader's swap lands and returns 9.78 ETH. Which conclusion about this block is correct?
MCQ-5A user swaps 10,000 USDC into a constant-product AMM pool holding 1,000,000 USDC and 500 ETH and sets minAmountOut = 4.40 ETH. Ignore fees and gas. A builder includes a front-running buy of 50,000 USDC just before the user's swap. What happens to the user's swap?
MCQ-10A lending market uses a two-slope borrow rate model: a 0% base rate, 4% at the 80% optimal-utilization kink, and a 60% additional slope from the kink to 100% utilization. The market currently holds 50M in cash and 50M in outstanding borrows. A supplier withdraws 40M of cash in a single transaction. Assuming nothing else changes, what is the borrow APR immediately after the withdrawal?
MCQ-9A lending pool tracks supplier claims with a share index. The pool has 100,000 shares outstanding and 125,000 USDC of assets, so the index is 1.25 USDC per share. A supplier deposits 10,000 USDC and receives 8,000 shares. A borrower then defaults, wiping out 6,750 USDC, 5% of the pool's total assets, and the loss is socialized by writing down the index. What is the supplier's claim worth after the write-down?
MCQ-18A lending market tracks each borrower's debt as scaled balance times a single borrowIndex, and tracks totalBorrows in underlying units. accrueInterest() is the only code that moves either: it multiplies the index by (1 + rate times elapsed) and grows totalBorrows by that same factor for the elapsed period. repay() computes the payoff from the index currently in storage, subtracts that payoff from totalBorrows, and zeroes the borrower's scaled balance, but it never calls accrueInterest(). Alice borrowed 2,000 when the index was 1.00, so her stored scaled balance is 2,000. At a 10% annual rate, with no other interaction touching the market for a full year, the index would be 1.10 and her debt 2,200 had accrual run. Alice now calls repay() to close the loan. What is the result?
MCQ-11A lending market lists a volatile collateral asset with maximum LTV of 65% and liquidation threshold of 80%. A borrower deposits $200,000 of that collateral and draws the maximum allowed debt. The collateral then falls 15% in price while the debt is unchanged. What is the borrower's position, and what happens next?
MCQ-12A borrower has 10 ETH supplied as collateral to an Aave v3 ETH market and 12,000 USDC borrowed against it. The market's max LTV is 80% and the ETH liquidation threshold is 82.5%. ETH is now $1,450. What is the health factor, and what happens to the position?
MCQ-13An ETH-collateralized USDC market is configured with an 80% liquidation threshold, a 5% liquidation bonus, and a close factor of 50% while the health factor is at or above 0.95 and 100% below it. A borrower has 10 ETH deposited at $2,000 per ETH and owes $16,800 USDC. A keeper submits a liquidation call. What does that call execute?
MCQ-14A lending market on Ethereum has a position with 500 USDC of debt and 550 USDC of ETH collateral. The liquidation threshold is 82.5%, so the health factor is 0.9075 and the position is liquidatable. The liquidation bonus is 8% of repaid debt, paid in collateral. A keeper's transaction costs 40 USD in gas, and selling the seized collateral incurs 0.5% slippage on its value. The keeper has no other positions to batch. What does a profit-maximizing keeper do, and why?
MCQ-15A lending market uses an 80% liquidation threshold, a 10% liquidation bonus, and a 100% close factor. A borrower deposits 100 ETH and borrows 100,000 USDC when ETH is $2,000. ETH then falls to $800 in a single block. A liquidator seizes all 100 ETH of collateral. The borrower has no other assets. How much bad debt does the protocol record?
MCQ-25A lending market holds $120M of debt across 4,000 positions. Over 48 hours ETH falls 22% while the debt is unchanged. Which on-chain metric most directly warns that the market is heading toward bad debt?
MCQ-21A lending market's governance transaction bundles two changes to one asset: collateral factor 0.70 to 0.80 and liquidation bonus 5% to 3%. In this market a position is liquidatable once its debt exceeds collateral value times the collateral factor. The change would execute atomically, with no timelock, which is why the team calls it security-sensitive. The largest borrower holds USD 10M of debt against USD 12M of that collateral; the market carries USD 50M supplied and USD 35M borrowed. Simulating against current positions, what happens to that borrower when the transaction lands?
MCQ-23A lending market on Ethereum mainnet prices collateral from the Chainlink ETH/USD aggregator proxy. The proxy reports `decimals() == 8` and the latest answer is `300000000000`. The market stores prices as 18-decimal WAD, where `1e18` represents $1. The integration is: ```solidity // Solidity 0.8.20 (, int256 answer, , , ) = ethUsd.latestRoundData(); priceWad = uint256(answer); ``` ETH is trading at $3,000. What price does the market use, and what follows?
MCQ-8A lending market prices collateral from a single Uniswap v3 pool. Liquidity is $3M within ±2% of the current tick and thins out beyond that. An attacker can push the spot price with one swap and borrow against the inflated collateral in the same block. The team is choosing between a single-block spot read and a 30-minute TWAP. Which property of the TWAP is the reason it is harder to manipulate in this pool?
MCQ-17A lending market with $12M TVL and a 75% collateral factor prices collateral from the spot price of a Uniswap v3 ETH/USDC pool holding $1.5M. An attacker takes a $40M flash loan from Lender A, swaps to move the spot price 18%, and borrows $9M against inflated collateral. The team blacklists Lender A. Two weeks later the same attacker takes a $40M flash loan from Lender B and repeats the drain. Which conclusion does the second incident support?
MCQ-16A lending pool charges a 0.05% flash-loan fee and enforces repayment inside the same transaction. A borrower's receiver contract is called with 1,000,000 USDC, runs an arbitrage that nets 300 USDC, then transfers back 1,000,000 USDC and stops: no fee transfer, no revert. The pool's repayment check runs after the callback returns. What happens to this transaction?
MCQ-19An ERC-4626 vault holds one asset and reports totalAssets() as its own balance of that asset. It has no virtual-share offset, no minimum-liquidity seed, and no guards beyond the standard conversion and floor rounding. It starts empty. An attacker deposits 1 asset and receives 1 share (the vault mints one-for-one when totalSupply is zero), then transfers 999 assets directly to the vault address, so totalAssets() is 1000 and totalSupply() is 1. A victim then calls deposit(1500, victim). What is the outcome?
MCQ-20USDX has 1.05B tokens outstanding and trades at $0.9995 on $8M of daily DEX volume. The issuer publishes $1.00B of reserves: $400M USDC, $300M tokenized T-bills settling T+1, $200M corporate bonds settling T+3, and $100M of its own governance token. Primary redemption is whitelisted, capped at $10M/day, settling T+2. A desk analyst says the $0.9995 print shows the reserves are sound. What does that price actually establish?
MCQ-22Market M holds one position: 200,000 LST deposited as collateral against 169,600 ETH of debt (hypothetical figures). M's price feed is the staking protocol's redemption rate, reading 1.06 ETH per LST, and it moves with staking rewards rather than with trades; M's liquidation threshold is 82% and its liquidation bonus is 5%. The LST has traded at 0.98 ETH on the secondary market for six hours because the exit queue is 12 days long. Protocol V accepts M's mTokens as collateral and marks each mToken at the same 1.06 ETH redemption rate. Which statement about M's position is correct?
MCQ-24A lending protocol's fuzz suite runs 50,000 iterations. Each iteration takes a fresh state snapshot, picks one actor and one function at random, calls it once, then asserts `totalAssets >= sum(userBalances)`. Every iteration passes. Two weeks later an attacker drains the pool in a single transaction by calling `donate(1_000e6)`, then `borrow(...)`, then `liquidate(...)` in that order. Which change to the harness would have made that sequence reachable?