Ethereum and Solidity Quiz

Ethereum and Solidity Quiz

Here’s a comprehensive Ethereum and Solidity multiple-choice quiz with 90 questions, covering topics from beginner to intermediate level. Each question has four options and one correct answer provided.


🧠 Ethereum and Solidity Quiz (90 MCQs with Answers)

πŸ“˜ Section 1: Ethereum Basics (1–30)

  1. What is Ethereum primarily used for?
    A. File sharing
    B. Smart contracts and DApps βœ…
    C. Image hosting
    D. Traditional banking.
  2. What is Ether (ETH)?
    A. A hardware component
    B. A stablecoin
    C. A token standard
    D. The native cryptocurrency of Ethereum βœ…
  3. Ethereum uses which consensus mechanism (before Ethereum 2.0)?
    A. PoW βœ…
    B. PoS
    C. DPoS
    D. BFT
  4. What does EVM stand for?
    A. Ethereum Voting Machine
    B. Ethereum Virtual Machine βœ…
    C. Elastic Virtual Machine
    D. Elastic Voting Mechanism
  5. Which language is most commonly used to write Ethereum smart contracts?
    A. Python
    B. Solidity βœ…
    C. Java
    D. Ruby
  6. What is “gas” in Ethereum?
    A. Network bandwidth
    B. A metric for contract complexity
    C. Fuel for transactions and computation βœ…
    D. Ether balance
  7. What are blocks in Ethereum?
    A. Encrypted contracts
    B. Bundles of transaction data βœ…
    C. Gas units
    D. Tokens
  8. What happens when gas runs out during a transaction?
    A. Transaction is paused
    B. Transaction fails and is reverted βœ…
    C. Transaction continues
    D. Partial execution
  9. Ethereum accounts are of two types:
    A. Public and private
    B. User and system
    C. EOA and Contract βœ…
    D. Gas and No-Gas
  10. Ethereum launched in:
    A. 2012
    B. 2013
    C. 2014
    D. 2015 βœ…
  11. Which of the following is true about a payable function in Solidity?
    A. It can receive Ether βœ…
    B. It can send Ether automatically
    C. It is used for gas estimation
    D. It returns an event by default
  12. What is the smallest denomination of Ether called?
    A. Wei βœ…
    B. Finney
    C. Gwei
    D. Mwei
  13. What does require() do in Solidity?
    A. It declares a function
    B. It reverts the transaction if a condition fails βœ…
    C. It logs an event
    D. It returns a fallback
  14. Which Ethereum client is written in Go?
    A. Parity
    B. Geth βœ…
    C. Besu
    D. OpenEthereum
  15. Which keyword is used to define a public variable in Solidity?
    A. let
    B. var
    C. public βœ…
    D. visible
  16. What is a fallback function in Solidity?
    A. A function that is always public
    B. A function called when no other function matches βœ…
    C. A function that logs errors
    D. A function to override modifiers
  17. Which command is used to deploy contracts using Hardhat?
    A. npx hardhat compile
    B. npx hardhat test
    C. npx hardhat run scripts/deploy.js βœ…
    D. npx hardhat init
  18. What is a block in Ethereum?
    A. A fixed-size data structure
    B. A container of multiple transactions βœ…
    C. A cryptographic algorithm
    D. A validation node
  19. Which of the following is used for upgrading smart contracts?
    A. ABI
    B. Proxy pattern βœ…
    C. Gas estimation
    D. Truffle
  20. What is the purpose of ABI in Ethereum?
    A. Compress contract bytecode
    B. Define token supply
    C. Interface between contract and frontend βœ…
    D. Generate gas reports
  21. What is the gas limit?
    A. The total Ether in a block
    B. The amount of data in a transaction
    C. The maximum gas allowed for execution βœ…
    D. Number of blocks mined per second
  22. What is msg.sender in Solidity?
    A. The contract owner
    B. The miner’s address
    C. The address that called the function βœ…
    D. The signer of a transaction
  23. What does the keyword view signify in Solidity?
    A. The function can only write to storage
    B. The function can read but not write to state βœ…
    C. It returns no value
    D. It sends Ether
  24. What is the return type of a function that doesn’t return anything in Solidity?
    A. uint
    B. null
    C. void
    D. none βœ…
  25. What does Truffle provide for Ethereum development?
    A. Block scanning
    B. IDE
    C. Testing, compiling, and deploying framework βœ…
    D. Cloud wallet
  26. What is the storage location of a mapping in Solidity?
    A. Stack
    B. Memory
    C. Storage βœ…
    D. Calldata
  27. What is the purpose of the constructor in Solidity?
    A. Destroy contract
    B. Initialize state on deployment βœ…
    C. Upgrade contract
    D. Pause functions
  28. Which of the following can emit events in Solidity?
    A. Libraries
    B. Contracts βœ…
    C. Constants
    D. Fallback functions
  29. How is inheritance supported in Solidity?
    A. By linking libraries
    B. Through interfaces
    C. Using is keyword βœ…
    D. By using override only
  30. What is the main difference between memory and storage in Solidity?
    A. Memory is for constants
    B. Memory is temporary, storage is persistent βœ…
    C. Storage is read-only
    D. Memory is on-chain

πŸ“˜ Section 2: Solidity Language (31–60)

  1. Solidity is a:
    A. Compiled, high-level programming language βœ…
    B. Interpreted scripting language
    C. Low-level language
    D. Framework
  2. What does pragma solidity ^0.8.0 mean?
    A. Use only version 0.8.0
    B. Use versions greater than 0.8.0
    C. Use 0.8.0 or any higher compatible version βœ…
    D. Disable Solidity versioning
  3. The keyword used to declare a contract is:
    A. class
    B. contract βœ…
    C. interface
    D. pragma
  4. To store Ether in a contract, which function modifier is used?
    A. pure
    B. view
    C. payable βœ…
    D. constant
  5. What is msg.sender?
    A. Contract address
    B. Caller of the function βœ…
    C. Miner address
    D. Blockchain ID
  6. What is the purpose of require() in Solidity?
    A. Log output
    B. Assert values
    C. Revert if condition fails βœ…
    D. Import contracts
  1. What is the purpose of using interfaces in Solidity?
    A. To add UI functionality
    B. To inherit from abstract classes
    C. To define a contract’s external functions without implementation βœ…
    D. To control Ether transfers
  2. What type of value does a mapping return if the key is not found?
    A. Reverts
    B. Null
    C. Zero-value of the value type βœ…
    D. Throws an error
  3. What does keccak256() function do in Solidity?
    A. Generates pseudorandom numbers
    B. Encodes string to base64
    C. Calculates the SHA-3 hash βœ…
    D. Performs digital signing
  4. Which Solidity version introduced pragma ^0.8.0?
    A. With overflow/underflow protections βœ…
    B. Added string slicing
    C. Deprecated events
    D. Introduced memory-only data
  5. What is the default value of a boolean in Solidity?
    A. 1
    B. false βœ…
    C. null
    D. 0x0
  6. Which type of variable is not stored on the blockchain?
    A. public
    B. memory βœ…
    C. storage
    D. mapping
  7. What does msg.value represent in a payable function?
    A. The amount of tokens received
    B. The sender’s balance
    C. The amount of Wei sent with the call βœ…
    D. The block reward
  8. How do you send Ether from a contract in Solidity >= 0.8.x?
    A. address.transfer(amount)
    B. address.send(amount)
    C. payable(address).call{value: amount}(“”) βœ…
    D. address.deposit(amount)
  9. What is an enum in Solidity?
    A. A constant address
    B. A data type that restricts variable to predefined values βœ…
    C. A fixed array
    D. A form of hashing
  10. Which statement is true about modifiers in Solidity?
    A. Used only with fallback functions
    B. Automatically handle errors
    C. Reusable pre-function logic βœ…
    D. Provide event logs
  11. What is the purpose of block.timestamp in Solidity?
    A. The current time of the Ethereum network βœ…
    B. The timestamp of contract deployment
    C. The hash of the block
    D. Miner-provided nonce
  12. How are constructor arguments passed during deployment?
    A. Through a separate file
    B. As metadata in bytecode βœ…
    C. They are ignored
    D. Via fallback function
  13. What does abi.encodePacked() return?
    A. String
    B. JSON
    C. Bytes tightly packed βœ…
    D. Hash
  14. What is the function of assert() in Solidity?
    A. To test external conditions
    B. To revert on failed internal error checks βœ…
    C. To send Ether
    D. To prevent reentrancy
  15. Which type of call is considered dangerous for reentrancy?
    A. Static call
    B. External function call βœ…
    C. Internal pure function
    D. emit call
  16. Which of the following Solidity types is dynamic?
    A. uint256
    B. address
    C. bytes βœ…
    D. bool
  17. What is the use of indexed keyword in Solidity events?
    A. Allows filtering by that field βœ…
    B. Marks the field for deletion
    C. Removes duplicates
    D. Limits gas usage
  18. What is OpenZeppelin used for?
    A. Ethereum network setup
    B. Testing token transfers
    C. Standard, secure smart contract libraries βœ…
    D. Gas optimization
  19. What does the fallback function not have?
    A. A name βœ…
    B. Logic
    C. An address
    D. A return value
  20. Which gas cost is higher in Ethereum?
    A. Setting a variable to zero
    B. Setting a new non-zero value βœ…
    C. Calling a pure function
    D. Calling a view function
  21. Which of the following causes a transaction to fail in Ethereum?
    A. Reaching the block gas limit
    B. Calling a non-existent address
    C. Reverting inside the contract βœ…
    D. Having zero balance
  22. What does a smart contract address depend on during deployment?
    A. Deployer’s balance
    B. Random nonce
    C. Deployer’s address and nonce βœ…
    D. Chain ID
  23. What is the default visibility of a function in Solidity?
    A. public
    B. internal βœ…
    C. private
    D. external
  24. What does memory keyword do in Solidity?
    A. Saves data on-chain
    B. Saves data in EVM logs
    C. Temporarily stores data during function execution βœ…
    D. Encrypts a string

πŸ“˜ Section 3: Intermediate Solidity & DApps (61–90)

  1. What is a fallback function in Solidity?
    A. Main logic of contract
    B. Default function called when no other matches βœ…
    C. Error handler
    D. Token allocator
  2. What is an event in Solidity?
    A. A type of struct
    B. A log on blockchain βœ…
    C. A function
    D. A contract initializer
  3. What does view modifier signify?
    A. Can modify state
    B. Can only call another contract
    C. Reads blockchain state, cannot modify βœ…
    D. Sends ETH
  4. Which standard is used for fungible tokens?
    A. ERC-721
    B. ERC-1155
    C. ERC-20 βœ…
    D. ERC-1400
  5. What is keccak256 in Solidity?
    A. A hash function βœ…
    B. Random number generator
    C. Decryption algorithm
    D. Compiler
  6. Mapping in Solidity is used for?
    A. Iteration
    B. Database connection
    C. Key-value storage βœ…
    D. Logging

πŸ“˜ Section 3: Intermediate Solidity & DApps (continued)

  1. Which data type should you use for storing ETH or token balances?
    A. int
    B. string
    C. uint256 βœ…
    D. bool
  2. What happens if assert(false) is triggered?
    A. Skips line
    B. Contract continues
    C. Reverts transaction and consumes all gas βœ…
    D. Logs error and exits gracefully
  3. What is a constructor in Solidity?
    A. A function that destroys a contract
    B. A payable function
    C. A function executed only once during contract deployment βœ…
    D. A fallback function
  4. Which function transfers Ether safely in Solidity (0.8+)?
    A. transfer()
    B. send()
    C. call{value: amount}(“”) βœ…
    D. sendEther()
  5. Which of these keywords is used to define an interface in Solidity?
    A. interface βœ…
    B. abstract
    C. implement
    D. define
  6. What does the keyword memory mean in a function parameter?
    A. Persistent storage
    B. Temporary storage during execution βœ…
    C. Stack location
    D. Blockchain storage
  7. The function modifier onlyOwner is used for?
    A. Checking token balance
    B. Ensuring only the contract owner can call the function βœ…
    C. Verifying transactions
    D. Pausing the contract
  8. Which function is used to receive Ether in a contract?
    A. receive() βœ…
    B. receiveEther()
    C. getEther()
    D. etherReceiver()
  9. When should the fallback() function be defined?
    A. To handle undefined function calls βœ…
    B. To transfer Ether
    C. To initialize tokens
    D. To manage errors
  10. What is the visibility of a function that can be accessed internally and externally?
    A. public βœ…
    B. private
    C. internal
    D. external
  11. How do you return multiple values from a Solidity function?
    A. Use arrays
    B. Use structs
    C. Use tuples βœ…
    D. It’s not possible
  12. The keyword emit is used for?
    A. Returning gas
    B. Calling a fallback
    C. Triggering events βœ…
    D. Declaring errors
  13. What is OpenZeppelin?
    A. Ethereum blockchain
    B. Token
    C. Security library for smart contracts βœ…
    D. Solidity compiler
  14. Which type of contract can be inherited in Solidity?
    A. Constant
    B. Interface
    C. Abstract βœ…
    D. Static
  15. What is a reentrancy attack?
    A. Mining manipulation
    B. Calling another contract recursively before state update βœ…
    C. Gas refund
    D. ETH overflow
  16. What does the keyword payable allow?
    A. Receiving Ether βœ…
    B. Storing data
    C. Logging transactions
    D. Protecting from overflow
  17. What is SafeMath used for?
    A. Gas optimization
    B. Integer overflow protection βœ…
    C. Signature validation
    D. Token management
  18. What is Remix IDE used for?
    A. DApp frontend
    B. Wallet manager
    C. Smart contract development and testing βœ…
    D. Database management
  19. How to prevent overflows in Solidity 0.8+?
    A. Use SafeMath
    B. Manual checks
    C. Built-in overflow checks βœ…
    D. OverflowFixer
  20. What is a smart contract?
    A. Web server
    B. Decentralized application logic on blockchain βœ…
    C. Ethereum node
    D. Token
  21. Which data type is used for true/false logic?
    A. string
    B. uint
    C. bool βœ…
    D. bytes
  22. What’s the advantage of using libraries in Solidity?
    A. External debugging
    B. Avoid code duplication βœ…
    C. Reduce contract size
    D. Add mining features
  23. What does msg.value represent?
    A. Sender’s address
    B. ETH sent with transaction βœ…
    C. Gas used
    D. Recipient balance
  24. What is the role of a smart contract ABI?
    A. Bytecode
    B. Compilation
    C. Interface for interacting with the contract βœ…
    D. Wallet generation

βœ… End of Quiz


Comments

No comments yet. Why don’t you start the discussion?

    Leave a Reply

    Your email address will not be published. Required fields are marked *