





















































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






















































































Question 1. Which property of blockchain ensures that once data is written it cannot be altered without detection? A) Decentralization B) Immutability C) Transparency D) Scalability Answer: B Explanation: Immutability means recorded data cannot be changed without breaking the cryptographic link to previous blocks. Question 2. In a Proof-of-Work consensus, what is the primary purpose of the nonce? A) To identify the miner B) To adjust transaction fees C) To find a hash below the target difficulty D) To store smart-contract bytecode Answer: C Explanation: Miners vary the nonce to produce a block hash that satisfies the network’s difficulty requirement. Question 3. Which hashing algorithm is used by Ethereum for generating addresses and transaction hashes? A) SHA- 256 B) Keccak- 256 C) RIPEMD- 160 D) Blake2b Answer: B
Explanation: Ethereum adopts Keccak-256 (the pre-standardized version of SHA-3) for its cryptographic hashes. Question 4. What distinguishes a permissioned blockchain from a public blockchain? A) Use of PoW consensus B) Open participation for any node C) Restricted access to known participants D) No transaction fees Answer: C Explanation: Permissioned blockchains limit who can read, write, or validate transactions to vetted entities. Question 5. The Byzantine Fault Tolerance (BFT) problem addresses which of the following? A) Double-spending attacks B) Nodes acting maliciously or failing arbitrarily C) High gas costs D) Smart-contract recursion limits Answer: B Explanation: BFT ensures a distributed system can reach consensus even when some nodes behave arbitrarily or maliciously. Question 6. Which consensus mechanism selects validators based on the amount of cryptocurrency they lock up as stake? A) Proof-of-Work B) Proof-of-Authority C) Proof-of-Stake
C) Can emit events D) Executes fallback functions automatically Answer: B Explanation: EOAs are controlled by private keys, whereas contract accounts are controlled by their code. Question 10. Which Ethereum test network was launched after the Merge? A) Ropsten B) Kovan C) Sepolia D) Rinkeby Answer: C Explanation: Sepolia is a post-Merge testnet that supports the latest consensus upgrades. Question 11. In Solidity, the pragma directive pragma solidity ^0.8.0; means: A) Only version 0.8.0 can be used B) Any version higher than 0.8.0, including future major releases C) Any compiler version from 0.8.0 up to, but not including, 0.9. D) The compiler will automatically upgrade the code to 0.9. Answer: C Explanation: The caret (^) allows any non-breaking version ≥0.8.0 and <0.9.0. Question 12. Which Solidity data type is a reference type that can hold a dynamic list of elements? A) uint B) bool
C) address D) uint256[] Answer: D Explanation: uint256[] is a dynamic array, a reference type that can grow or shrink. Question 13. What visibility modifier makes a function callable only from within the contract and its derived contracts? A) public B) private C) internal D) external Answer: C Explanation: internal restricts access to the contract itself and any contracts that inherit from it. Question 14. Which state mutability keyword indicates that a function does not read or modify state? A) view B) pure C) payable D) constant Answer: B Explanation: pure functions cannot read from or write to the blockchain state. Question 15. The require statement in Solidity is primarily used to: A) Emit an event
Question 18. Which tool provides an in-browser IDE for writing, compiling, and debugging Solidity contracts? A) Truffle B) Hardhat C) Remix D) Ganache Answer: C Explanation: Remix is a web-based IDE that supports compilation, deployment, and debugging. Question 19. In Hardhat, which plugin enables automatic generation of TypeScript typings for contracts? A) hardhat-waffle B) hardhat-etherscan C) hardhat-typechain D) hardhat-deploy Answer: C Explanation: hardhat-typechain (or @typechain/hardhat) generates TypeScript typings from compiled ABIs. Question 20. Which command starts a local Ethereum blockchain instance using Ganache CLI? A) ganache start B) ganache-cli C) npm run ganache D) truffle develop Answer: B
Explanation: Running ganache-cli launches a personal blockchain for rapid testing. Question 21. MetaMask stores users’ private keys in: A) A hardware wallet only B) The browser’s local storage, encrypted with a password C) A remote server managed by MetaMask D) The blockchain itself as a contract Answer: B Explanation: MetaMask encrypts the private key with the user’s password and stores it locally in the browser. Question 22. Which JavaScript library provides a Promise-based interface for interacting with Ethereum nodes? A) Web3.js B) Ethers.js C) Truffle.js D) Solidity.js Answer: B Explanation: Ethers.js offers a clean, Promise-based API for sending transactions and reading contract data. Question 23. The ERC-20 function transferFrom(address from, address to, uint256 amount) requires that the caller has: A) Ownership of from address B) Sufficient allowance set by from for the caller C) No allowance; it works automatically D) A special role defined in the contract
C) payable that makes external calls before state updates D) internal only functions Answer: C Explanation: If a contract sends ether before updating its balance, a malicious contract can re-enter and drain funds. Question 27. Prior to Solidity 0.8.0, how could developers protect against integer overflow? A) Use the unchecked keyword B) Rely on the compiler’s automatic checks C) Import OpenZeppelin’s SafeMath library D) Declare variables as uint128 only Answer: C Explanation: SafeMath provided overflow-checking arithmetic before built-in checks were added in 0.8.0. Question 28. Front-running in DeFi is primarily mitigated by: A. Using higher gas price to outrun competitors B. Implementing commit-reveal schemes or transaction ordering controls C. Deploying contracts on private blockchains only D. Disabling external calls Answer: B Explanation: Commit-reveal or time-locked mechanisms prevent attackers from seeing and copying pending transactions. **Question 29. The OpenZeppelin Ownable contract provides which functionality? **
A) Role-based access control with multiple admins B) A single owner address with onlyOwner modifier for privileged functions C) Automatic upgradeability of contracts D) Multi-signature transaction execution Answer: B Explanation: Ownable defines an owner and the onlyOwner modifier to restrict access. Question 30. In a proxy upgrade pattern, which contract holds the actual storage layout? A) Implementation contract B) Proxy contract C) Factory contract D) Registry contract Answer: B Explanation: The proxy delegates calls to the implementation but maintains the state variables in its own storage. Question 31. Chainlink oracles are used to: A) Store large files on-chain B) Provide deterministic randomness only C) Bring off-chain data (e.g., price feeds) onto the blockchain securely D. Replace the need for consensus mechanisms Answer: C Explanation: Chainlink nodes fetch external data and deliver it to smart contracts in a tamper-resistant way.
Question 35. Which Solidity keyword is used to declare a function that can receive ether? A) payable B) external C) view D) pure Answer: A Explanation: Adding payable allows the function to accept a non-zero msg.value. Question 36. The fallback() function in Solidity is executed when: A) A function with matching signature is called B) No other function matches the call data or when ether is sent without data (if receive is not defined) C) The contract is being created D) The contract self-destructs Answer: B Explanation: fallback() acts as a catch-all for unknown function calls or plain ether transfers. Question 37. In Solidity, what does the indexed keyword do when declaring event parameters? A) Stores the parameter in contract storage B) Allows the parameter to be filtered in logs using topics C) Makes the parameter immutable D) Encrypts the parameter value
Answer: B Explanation: indexed parameters become searchable topics, enabling efficient log filtering. Question 38. Which Hardhat network configuration option sets the block gas limit for the locally simulated chain? A) gasPrice B) blockGasLimit C) hardfork D) chainId Answer: B Explanation: blockGasLimit defines the maximum gas per block in the Hardhat network. Question 39. The call low-level function in Solidity returns: A) A boolean indicating success and raw returned data B) Only a boolean success flag C) The transaction hash D) An error string on failure Answer: A Explanation: address.call(...) returns (bool success, bytes memory data) allowing manual handling of the result. Question 40. Which Solidity version introduced the unchecked block to skip overflow checks? A) 0.6. B) 0.7.
A) library.function() B) LibraryName.function() without this C) this.function() after attaching the library to a type D) Both B and C are valid Answer: D Explanation: Libraries can be called directly via LibraryName.function() or attached to a type and called as a member function. Question 44. Which EIP introduced the ERC-777 token standard? A) EIP- 20 B) EIP- 721 C) EIP- 1820 D) EIP- 2535 Answer: C Explanation: ERC-777 builds on ERC-20 and uses the ERC-1820 registry for interface detection. Question 45. The selfdestruct opcode in Solidity: A) Sends all ether to the caller and removes contract code from the state trie B) Pauses the contract indefinitely C) Upgrades the contract to a new implementation automatically D) Emits a Destructed event automatically Answer: A Explanation: selfdestruct(address payable) transfers remaining balance to the specified address and deletes the contract’s bytecode.
Question 46. Which Solidity pragma directive disables the optimizer? A) pragma optimizer off; B) pragma experimental optimizer; C) pragma solidity ^0.8.0; (optimizer is enabled by default) D) pragma abicoder v2; Answer: A Explanation: pragma optimizer off; instructs the compiler to skip optimization passes. Question 47. In the context of gas, what does the term “gas stipend” refer to? A) The fixed amount of gas supplied to a contract when it receives ether via transfer or send B) The maximum gas a block can contain C) The gas price set by the miner D) The amount of gas refunded after a successful transaction Answer: A Explanation: transfer and send forward only 2300 gas to the recipient, known as the gas stipend. Question 48. Which of the following is a recommended practice when writing Solidity tests with Hardhat? A) Use await for all asynchronous calls B) Deploy contracts on the mainnet for testing C) Disable the Solidity optimizer in tests D) Write tests only in JavaScript, not TypeScript Answer: A
Answer: B Explanation: Quorum ensures that enough participants have voted before a decision is enacted. Question 52. Which of these is a common method to mitigate front-running in NFT minting contracts? A) Randomly assign token IDs after minting B) Use a whitelist that only allows pre-approved addresses to mint C) Set a high gas price for all mint transactions D) Disable the approve function Answer: B Explanation: A whitelist restricts minting to known participants, reducing the chance of bots front-running. Question 53. What does the bytes32 type represent in Solidity? A) A dynamic array of bytes B) A fixed-size 32-byte value C) A string of up to 32 characters D) An address type alias Answer: B Explanation: bytes32 is a static 32-byte array, often used for hashes and identifiers. Question 54. Which EIP introduced the concept of “gas refunds” for clearing storage? A) EIP- 150 B) EIP- 2929
Answer: D Explanation: EIP-3529 reduces gas refunds for storage clearing to mitigate certain DoS attacks. Question 55. In Solidity, the assembly keyword allows: A) Writing inline Yul or EVM assembly code for low-level operations B) Declaring a new contract type C) Importing external libraries automatically D) Defining a new storage layout Answer: A Explanation: Inline assembly lets developers write raw EVM instructions for optimization or special tasks. Question 56. Which of the following is NOT a standard component of a Solidity contract’s ABI? A) Function signatures B) Event signatures C) Variable storage layout D) Input and output parameter types Answer: C Explanation: The ABI describes the interface (functions/events) but not the internal storage layout. Question 57. The SafeERC20 library from OpenZeppelin is used to: A) Prevent reentrancy attacks in ERC-20 contracts