Blockchain Developer FREE Blockchain Developer Token Standards and NFTs Questions and Answers 2 — Questions and Answers
Question 1: Which ERC standard introduced the concept of semi-fungible tokens by combining fungible and non-fungible token functionality in a single contract?
- ERC-1155 (Correct answer)
- ERC-721
- ERC-20
- ERC-777
Correct answer: ERC-1155
ERC-1155 is a multi-token standard that supports both fungible and non-fungible tokens within one contract, making them semi-fungible.
Question 2: What function in the ERC-721 standard is used to safely transfer an NFT while ensuring the recipient contract can handle it?
- safeTransferFrom (Correct answer)
- transferFrom
- approve
- send
Correct answer: safeTransferFrom
safeTransferFrom checks whether the recipient implements the ERC721Receiver interface, preventing tokens from being locked in incompatible contracts.
Question 3: In ERC-20, what happens if a user calls transfer() with an amount exceeding their balance?
- The transaction reverts (Correct answer)
- The transfer sends the maximum available balance
- A partial transfer occurs
- The recipient receives zero tokens
Correct answer: The transaction reverts
The ERC-20 transfer function will revert the entire transaction if the sender's balance is insufficient.
Question 4: What is the primary purpose of the tokenURI function in ERC-721?
- To return a URI pointing to the token's metadata (Correct answer)
- To generate the token's unique identifier
- To verify token ownership
- To set the token's sale price
Correct answer: To return a URI pointing to the token's metadata
The tokenURI function returns a URI that points to a JSON file containing the NFT's metadata such as name, description, and image.
Question 5: Which vulnerability can occur when an ERC-20 token's approve function is called to change an existing allowance without first setting it to zero?
- Front-running double-spend attack (Correct answer)
- Reentrancy attack
- Integer overflow
- Denial of service
Correct answer: Front-running double-spend attack
A spender can front-run the approve transaction to spend both the old and new allowance, resulting in a double-spend.
Question 6: What does the ERC-2981 standard define for NFTs?
- A standardized royalty payment interface (Correct answer)
- A new token minting mechanism
- A cross-chain bridge protocol
- A metadata encryption scheme
Correct answer: A standardized royalty payment interface
ERC-2981 provides a standard way to retrieve royalty payment information for NFTs, enabling marketplaces to honor creator royalties.
Which ERC standard introduced the concept of semi-fungible tokens by combining fungible and non-fungible token functionality in a single contract?