Blockchain Developer Token Standards and Creation — Questions and Answers
Question 1: Which ERC-20 function returns the number of tokens a spender is still allowed to withdraw from an owner's account?
- allowance(owner, spender) (Correct answer)
- balanceOf(owner)
- approve(spender, amount)
- transferFrom(from, to, amount)
Correct answer: allowance(owner, spender)
allowance(owner, spender) returns the remaining amount the spender is permitted to withdraw.
Question 2: In ERC-20, what is the well-known race-condition risk associated with the approve() function?
- A spender can front-run a changed approval and spend both the old and new amounts (Correct answer)
- It permanently locks the owner's balance
- It mints unlimited tokens
- It bypasses the totalSupply cap
Correct answer: A spender can front-run a changed approval and spend both the old and new amounts
Changing an existing non-zero allowance lets a spender front-run and use both old and new amounts.
Question 3: What does the ERC-20 decimals() function actually control?
- Only the display formatting of token amounts off-chain (Correct answer)
- The on-chain divisibility enforced by the contract
- The maximum total supply
- The gas cost of transfers
Correct answer: Only the display formatting of token amounts off-chain
decimals() is purely informational for UI display; the contract stores integer values regardless.
Question 4: Which event must an ERC-20 token emit when tokens move between addresses?
- Transfer(from, to, value) (Correct answer)
- Approval(owner, spender, value)
- Sent(operator, from, to)
- Mint(to, value)
Correct answer: Transfer(from, to, value)
The Transfer event is required on every token movement, including minting (from the zero address).
Question 5: Why is it best practice to emit a Transfer event from the zero address when minting ERC-20 tokens?
- So off-chain indexers can track supply changes consistently (Correct answer)
- Because the EVM rejects mints without it
- To reduce gas costs
- To prevent reentrancy
Correct answer: So off-chain indexers can track supply changes consistently
Emitting Transfer from address(0) lets explorers and indexers treat minting as a standard balance change.
Question 6: What problem does the ERC-2612 'permit' extension solve for ERC-20 tokens?
- It allows gasless approvals via off-chain signed messages (Correct answer)
- It increases the maximum supply
- It adds NFT metadata
- It enables cross-chain bridging automatically
Correct answer: It allows gasless approvals via off-chain signed messages
ERC-2612 permit lets users approve spenders with a signature, removing the need for a separate approve transaction.
Question 7: If an ERC-20 transfer() returns false instead of reverting, what is the recommended way to handle it safely in a calling contract?
- Use a SafeERC20 wrapper that checks the return value and reverts on failure (Correct answer)
- Ignore the return value since transfers always succeed
- Retry the transfer in a loop
- Call selfdestruct on failure
Correct answer: Use a SafeERC20 wrapper that checks the return value and reverts on failure
SafeERC20 wrappers verify the boolean return and revert, handling non-compliant tokens correctly.
Question 8: What is the key difference between ERC-721 and ERC-1155 token standards?
- ERC-1155 supports both fungible and non-fungible tokens in one contract, ERC-721 only non-fungible (Correct answer)
- ERC-721 is for fungible tokens only
- ERC-1155 cannot represent NFTs
- ERC-721 supports batch transfers but ERC-1155 does not
Correct answer: ERC-1155 supports both fungible and non-fungible tokens in one contract, ERC-721 only non-fungible
ERC-1155 is a multi-token standard handling fungible, non-fungible, and semi-fungible tokens together.
Question 9: Which ERC-721 function returns the owner of a specific token ID?
- ownerOf(tokenId) (Correct answer)
- balanceOf(owner)
- tokenURI(tokenId)
- approve(to, tokenId)
Correct answer: ownerOf(tokenId)
ownerOf(tokenId) returns the address that currently owns the given NFT.
Question 10: What is the primary purpose of the ERC-721 tokenURI() function?
- Return a URI pointing to the token's JSON metadata (Correct answer)
- Transfer the token to a new owner
- Burn the token
- Return the total supply
Correct answer: Return a URI pointing to the token's JSON metadata
tokenURI() returns a link to metadata describing the NFT, often including name, image, and attributes.
Question 11: Why does ERC-1155 enable significant gas savings for transferring many tokens?
- It supports batch operations like safeBatchTransferFrom in a single transaction (Correct answer)
- It eliminates the need for events
- It removes ownership tracking
- It uses no storage
Correct answer: It supports batch operations like safeBatchTransferFrom in a single transaction
Batch transfer functions let multiple token types and amounts move in one transaction, reducing overhead.
Question 12: What safety check distinguishes safeTransferFrom from transferFrom in ERC-721?
- It verifies the recipient contract implements onERC721Received (Correct answer)
- It checks the sender's gas balance
- It validates the token's metadata URI
- It enforces a maximum supply
Correct answer: It verifies the recipient contract implements onERC721Received
safeTransferFrom calls onERC721Received to ensure contract recipients can handle NFTs, preventing locked tokens.
Question 13: In ERC-1155 metadata, what does the {id} substitution placeholder in a URI represent?
- The lowercase hex token ID padded to 64 characters (Correct answer)
- The contract address
- The owner's address
- The chain ID
Correct answer: The lowercase hex token ID padded to 64 characters
Clients replace {id} with the 64-character zero-padded lowercase hex token ID to fetch per-token metadata.
Question 14: Which interface must a contract implement to be recognized as ERC-721 compliant via ERC-165?
- supportsInterface returning true for the ERC-721 interface ID (Correct answer)
- A public mint function
- A fixed totalSupply variable
- An owner-only constructor
Correct answer: supportsInterface returning true for the ERC-721 interface ID
ERC-165's supportsInterface lets contracts advertise that they implement the ERC-721 interface ID.
Question 15: When deploying a token contract, why is using OpenZeppelin's audited contracts generally preferred over writing from scratch?
- They reduce the risk of security bugs through community-reviewed, tested code (Correct answer)
- They make tokens immune to all attacks
- They are required by the EVM
- They eliminate all gas costs
Correct answer: They reduce the risk of security bugs through community-reviewed, tested code
Audited libraries lower the chance of introducing vulnerabilities compared to custom implementations.
Question 16: What is a 'mintable' token, and what access-control risk does it introduce?
- A token whose supply can be increased; the minter role must be tightly controlled to prevent inflation abuse (Correct answer)
- A token that can never change supply
- A token with no owner
- A token that auto-burns on transfer
Correct answer: A token whose supply can be increased; the minter role must be tightly controlled to prevent inflation abuse
Mintable tokens allow new supply creation, so unrestricted minting permissions can be exploited to dilute holders.
Question 17: What does making a token 'burnable' allow?
- Holders or authorized roles to permanently destroy tokens, reducing total supply (Correct answer)
- Tokens to be transferred without fees
- The contract to be upgraded
- Infinite minting
Correct answer: Holders or authorized roles to permanently destroy tokens, reducing total supply
Burning sends tokens out of circulation (often to address zero), decreasing totalSupply.
Question 18: Why might a token contract include a 'pausable' feature?
- To halt transfers during an emergency or exploit, buying time to respond (Correct answer)
- To permanently disable the token
- To increase transfer speed
- To bypass gas fees
Correct answer: To halt transfers during an emergency or exploit, buying time to respond
Pausable lets an admin freeze token activity temporarily if a vulnerability or attack is detected.
Question 19: What is the main trade-off of deploying an upgradeable (proxy-based) token contract?
- It adds flexibility but introduces centralization and proxy-related security risks (Correct answer)
- It permanently freezes the logic
- It removes the need for gas
- It prevents any future bug fixes
Correct answer: It adds flexibility but introduces centralization and proxy-related security risks
Upgradeable proxies allow logic changes but rely on an admin and add storage-layout and trust risks.
Question 20: During token creation, what does setting an initial supply in the constructor and minting it to the deployer accomplish?
- It allocates the entire starting supply to the deployer's address at deployment (Correct answer)
- It locks the supply forever to the contract
- It distributes tokens equally to all addresses
- It sets the token price
Correct answer: It allocates the entire starting supply to the deployer's address at deployment
Constructor minting credits the deployer with the initial supply, which can then be distributed.
Question 21: Why should a fixed-supply (non-mintable) token omit any mint function entirely?
- To guarantee the supply cap can never be exceeded, building holder trust (Correct answer)
- To save deployment gas only
- Because mint functions are illegal
- To allow unlimited burning
Correct answer: To guarantee the supply cap can never be exceeded, building holder trust
Removing mint capability cryptographically guarantees the supply cannot inflate beyond the cap.
Which ERC-20 function returns the number of tokens a spender is still allowed to withdraw from an owner's account?
What Practice Test Geeks adds beyond an AI chat for Blockchain
An AI chatbot can quiz you, but it can't reproduce the exam conditions or keep your record. Here you get:
- A timed, full-length Blockchain mock exam — 100 questions in 90 minutes with a 60% pass mark, modeled on the official exam's question count and time limit, followed by a score report broken down by exam domain.
- A fixed Blockchain question bank: the same test every attempt, so your score is comparable from one try to the next instead of changing with every regenerated quiz.
- Progress saved on your device: completed tests, scores and missed questions stay in My Progress, so you can retake only what you got wrong.
- A printable Blockchain cheat sheet you can print or save as a PDF.
- Blockchain flashcards built from the same question bank.
These practice questions were written with AI tools. They are not real exam questions. We have not yet matched this exam's facts to an official source, so confirm fees, dates and rules with the exam body. Not reviewed by a subject-matter expert. Editorial policy