Blockchain & Smart Contracts (Solidity) Interview Questions Hindi mein

Blockchain & Smart Contracts (Solidity) कोर्स के 25 सवाल, हर सवाल के सही जवाब और explanation के साथ। जवाब देखने से पहले ख़ुद सोचें।

Blockchain and Ethereum Foundations

1. How did Ethereum reach consensus after The Merge in 2022?

  1. Proof of stake with validators who stake ether
  2. Proof of work mining
  3. A central server
  4. Proof of authority by one company
जवाब देखें

जवाब: Proof of stake with validators who stake ether

Ethereum moved from proof of work to proof of stake in September 2022.

पाठ: What a Blockchain Is

2. What happens if a transaction runs out of gas?

  1. It completes for free
  2. The validator pays the rest
  3. It is retried automatically
  4. Its state changes are reverted, but the gas used is still paid
जवाब देखें

जवाब: Its state changes are reverted, but the gas used is still paid

Out-of-gas reverts the effects; the computation already performed is still charged.

पाठ: Ethereum, the EVM, Accounts and Gas

3. What happens if you lose your seed phrase and your device?

  1. The network resets your password
  2. The exchange restores it automatically
  3. You lose access to the accounts; there is no central recovery
  4. You can recover it from your address
जवाब देखें

जवाब: You lose access to the accounts; there is no central recovery

Self-custodied keys cannot be recovered without the seed phrase or a recovery mechanism you set up.

पाठ: Keys, Wallets, Testnets and Layer 2s

Solidity Basics

4. What does the ABI of a contract describe?

  1. The gas price
  2. The private keys of the deployer
  3. The functions, events and types used to encode calls and decode results
  4. The block number
जवाब देखें

जवाब: The functions, events and types used to encode calls and decode results

The ABI is the interface description tools use to talk to a contract.

पाठ: Your First Contract

5. What happens in Solidity 0.8+ when a uint256 subtraction would go below zero?

  1. It wraps around to a huge number
  2. The transaction reverts
  3. It returns zero
  4. It becomes negative
जवाब देखें

जवाब: The transaction reverts

Checked arithmetic reverts on overflow and underflow by default since 0.8.

पाठ: Types, Mappings and Structs

6. What does the `_;` inside a modifier represent?

  1. The place where the modified function's body is executed
  2. The end of the contract
  3. A comment
  4. A revert
जवाब देखें

जवाब: The place where the modified function's body is executed

Code before `_;` runs first, then the function body, then any code after it.

पाठ: Functions, Modifiers, Events and Errors

Contract Design and Reuse

7. What does `Item memory item = items[i]; item.stock += 1;` do to contract storage?

  1. Nothing: it changes a temporary memory copy
  2. Increments the stored stock
  3. Deletes the item
  4. Reverts the transaction
जवाब देखें

जवाब: Nothing: it changes a temporary memory copy

Memory variables are copies; use a storage reference to modify state.

पाठ: Storage, Memory, Calldata and Transient Storage

8. What is an interface in Solidity?

  1. A contract with full implementations
  2. A library
  3. A deployed proxy
  4. A declaration of external functions, events and errors with no state or implementation
जवाब देखें

जवाब: A declaration of external functions, events and errors with no state or implementation

Interfaces describe how to call contracts without implementing anything.

पाठ: Inheritance, Interfaces, Abstract Contracts and Libraries

9. Why should production admin roles usually be held by a multisig with a timelock?

  1. It is cheaper
  2. It speeds up transactions
  3. No single compromised key can act alone, and users get time to react to privileged changes
  4. It is required by the EVM
जवाब देखें

जवाब: No single compromised key can act alone, and users get time to react to privileged changes

Multisigs remove single points of failure, and timelocks give transparency and reaction time.

पाठ: OpenZeppelin and Access Control

Token Standards

10. Why use SafeERC20 when interacting with arbitrary tokens?

  1. It makes transfers free
  2. It converts tokens to ether
  3. Some tokens do not follow the standard exactly (for example, no return value), and SafeERC20 handles these cases and reverts on failure
  4. It is required to compile
जवाब देखें

जवाब: Some tokens do not follow the standard exactly (for example, no return value), and SafeERC20 handles these cases and reverts on failure

SafeERC20 wraps calls to handle non-standard tokens safely.

पाठ: ERC-20 Fungible Tokens

11. What does safeTransferFrom check that transferFrom does not?

  1. The gas price
  2. That a receiving contract implements onERC721Received, so tokens are not locked
  3. The token's price
  4. The sender's balance in ether
जवाब देखें

जवाब: That a receiving contract implements onERC721Received, so tokens are not locked

Safe transfers prevent sending NFTs to contracts that cannot handle them.

पाठ: ERC-721 NFTs

12. What does a Merkle allowlist store on chain?

  1. Only the Merkle root; users provide proofs of inclusion
  2. Every eligible address
  3. The private keys of users
  4. Nothing at all
जवाब देखें

जवाब: Only the Merkle root; users provide proofs of inclusion

A single 32-byte root commits to the whole list.

पाठ: ERC-1155, Signatures and Merkle Allowlists

Ether, External Calls and Upgrades

13. Why are transfer and send no longer recommended for sending ether?

  1. They forward only 2,300 gas, which can make transfers to contract wallets fail
  2. They are too expensive
  3. They are not available in Solidity 0.8
  4. They do not move ether
जवाब देखें

जवाब: They forward only 2,300 gas, which can make transfers to contract wallets fail

The fixed gas stipend breaks recipients that need more gas.

पाठ: Sending and Receiving Ether

14. What does delegatecall do?

  1. Calls another contract with its own storage
  2. Sends ether only
  3. Deploys a new contract
  4. Runs another contract's code using the calling contract's storage, msg.sender and balance
जवाब देखें

जवाब: Runs another contract's code using the calling contract's storage, msg.sender and balance

delegatecall borrows code while keeping the caller's context; proxies rely on it.

पाठ: Calling Other Contracts and Upgradeability

15. Why is block.timestamp unsuitable as a source of randomness for a valuable lottery?

  1. It is always zero
  2. It cannot be read in Solidity
  3. It is predictable and partly influenced by validators, so outcomes can be manipulated
  4. It changes every second
जवाब देखें

जवाब: It is predictable and partly influenced by validators, so outcomes can be manipulated

On-chain values are public and influenceable; use VRF or commit-reveal.

पाठ: Oracles, Time and Randomness

Smart Contract Security

16. In the checks-effects-interactions pattern, when should external calls happen?

  1. First
  2. Before checking inputs
  3. After state has been updated
  4. In the constructor only
जवाब देखें

जवाब: After state has been updated

Interactions come last so that re-entrant calls see updated state.

पाठ: Reentrancy and Checks-Effects-Interactions

17. Why is using tx.origin for authorisation dangerous?

  1. It costs more gas
  2. A malicious contract called by the user can pass a tx.origin check and act on the user's behalf
  3. tx.origin is always zero
  4. It only works on testnets
जवाब देखें

जवाब: A malicious contract called by the user can pass a tx.origin check and act on the user's behalf

tx.origin is the original EOA, even when an intermediate malicious contract makes the call.

पाठ: Common Vulnerabilities

18. What does an invariant (stateful fuzz) test do?

  1. Runs random sequences of function calls and checks that stated properties always hold
  2. Tests one fixed input
  3. Formats code
  4. Deploys to mainnet
जवाब देखें

जवाब: Runs random sequences of function calls and checks that stated properties always hold

Invariant tests explore many call sequences looking for property violations.

पाठ: Security Process: Testing, Tools and Audits

Development Tooling and Deployment

19. What does vm.prank(addr) do in a Foundry test?

  1. Makes the next call come from addr, setting msg.sender
  2. Deletes an address
  3. Gives addr ether
  4. Advances time
जवाब देखें

जवाब: Makes the next call come from addr, setting msg.sender

prank changes msg.sender for the next external call.

पाठ: Foundry: forge, cast and anvil

20. Why call simulateContract before writeContract in viem?

  1. To pay less gas always
  2. To deploy the contract
  3. It is required for read calls
  4. To catch reverts and prepare a valid request before sending a real transaction
जवाब देखें

जवाब: To catch reverts and prepare a valid request before sending a real transaction

Simulation runs the call against current state and surfaces errors without spending gas.

पाठ: Hardhat, ethers.js and viem

21. Why verify contract source code on a block explorer?

  1. It makes the contract cheaper
  2. It is required for the contract to run
  3. So users and tools can read and check the code that is actually deployed
  4. It hides the bytecode
जवाब देखें

जवाब: So users and tools can read and check the code that is actually deployed

Verification links published source to the on-chain bytecode, enabling public review.

पाठ: Deploying, Verifying and Operating Contracts

Gas, dApps, DeFi and Revision

22. Which change usually saves the most gas?

  1. Renaming variables
  2. Using shorter comments
  3. Reducing storage writes and packing variables into fewer slots
  4. Adding more events
जवाब देखें

जवाब: Reducing storage writes and packing variables into fewer slots

Storage operations are by far the most expensive.

पाठ: Gas Optimisation

23. Why should a dApp index events with a service rather than scanning the chain in the browser?

  1. Events cannot be read
  2. Scanning many blocks from the browser is slow and rate-limited; indexers provide fast, queryable history
  3. Indexers make transactions free
  4. Browsers cannot connect to RPC nodes
जवाब देखें

जवाब: Scanning many blocks from the browser is slow and rate-limited; indexers provide fast, queryable history

Indexers process events once and serve them efficiently.

पाठ: Building dApp Front Ends

24. In a constant-product AMM, what happens to the price of token B as you buy more of it in one trade?

  1. It rises, so larger trades get worse average prices (slippage)
  2. It stays the same
  3. It falls
  4. Trading stops
जवाब देखें

जवाब: It rises, so larger trades get worse average prices (slippage)

x*y=k makes each additional unit more expensive as reserves of B shrink.

पाठ: DeFi Building Blocks and Layer 2s

25. Which pattern is the primary defence against reentrancy?

  1. Using tx.origin
  2. Using transfer instead of call everywhere
  3. Making all functions public
  4. Checks-effects-interactions: update state before making external calls
जवाब देखें

जवाब: Checks-effects-interactions: update state before making external calls

CEI ensures re-entrant calls see updated state; ReentrancyGuard adds a safety net.

पाठ: Revision and Interview Questions

← कोर्स पर वापस जाएँ