NFT Token Standards (ERC-721/1155) 2 — Questions and Answers
Question 1: In ERC-721, which function returns the address that owns a given tokenId?
- balanceOf(uint256)
- ownerOf(uint256) (Correct answer)
- tokenOwner(address)
- getApproved(uint256)
Correct answer: ownerOf(uint256)
ownerOf(tokenId) returns the current owner address of that specific NFT.
Question 2: What does ERC-721's safeTransferFrom do that transferFrom does not?
- Skips approval checks
- Checks the recipient can receive ERC-721 via onERC721Received (Correct answer)
- Mints a new token
- Burns the token after transfer
Correct answer: Checks the recipient can receive ERC-721 via onERC721Received
safeTransferFrom verifies a contract recipient implements onERC721Received to avoid trapping tokens.
Question 3: ERC-1155 supports which type of token in a single contract?
- Only fungible
- Only non-fungible
- Both fungible and non-fungible (Correct answer)
- Only soulbound
Correct answer: Both fungible and non-fungible
ERC-1155 is a multi-token standard handling fungible, non-fungible, and semi-fungible tokens together.
Question 4: Which ERC-1155 function transfers multiple token types at once?
- safeTransferFrom
- safeBatchTransferFrom (Correct answer)
- batchMint
- transferAll
Correct answer: safeBatchTransferFrom
safeBatchTransferFrom moves arrays of ids and amounts in one call to save gas.
Question 5: What standard is used to detect whether a contract implements ERC-721?
- ERC-20
- ERC-165 supportsInterface (Correct answer)
- ERC-2981
- ERC-4626
Correct answer: ERC-165 supportsInterface
ERC-165's supportsInterface lets callers query whether a contract implements a given interface id.
Question 6: In ERC-721, what does approve(address, uint256) grant?
- Permission for one address to transfer one specific token (Correct answer)
- Ownership of the token
- Operator rights over all tokens
- The right to burn the contract
Correct answer: Permission for one address to transfer one specific token
approve authorizes a single address to transfer that one specific tokenId.
Question 7: ERC-1155 uses a single URI with which placeholder for token metadata?
- {address}
- {id} (Correct answer)
- {tokenName}
- {owner}
Correct answer: {id}
ERC-1155 metadata URIs use the {id} placeholder, replaced with the hex token id.
In ERC-721, which function returns the address that owns a given tokenId?