Free Certified Blockchain Professional (CBCP) Smart Contracts and DApps Questions and Answers — Questions and Answers
Question 1: A smart contract is designed to release payments to a supplier only after a shipment's arrival is confirmed by an IoT sensor. The blockchain network itself cannot directly access data from the IoT sensor. Which of the following is required to securely and reliably feed the external data to the smart contract?
- A centralized server owned by the shipping company
- A blockchain oracle (Correct answer)
- A direct API call from the smart contract to the IoT device
- Manual data entry by a network administrator
Correct answer: A blockchain oracle
Blockchains are deterministic, isolated networks and cannot natively access external, off-chain data. A blockchain oracle is a service that connects smart contracts with off-chain data sources, acting as a bridge to provide the necessary external information in a trusted manner.
Question 2: Which of the following best describes the core architectural difference between a traditional application and a Decentralized Application (DApp)?
- DApps use HTML and CSS for the frontend, while traditional applications use proprietary languages.
- DApps store data on a centralized database for faster retrieval, unlike traditional apps which use distributed storage.
- The backend logic of a DApp is executed on a peer-to-peer network via smart contracts, whereas a traditional app's backend runs on centralized servers. (Correct answer)
- Traditional applications are always open-source, while DApps are typically closed-source to protect the smart contract logic.
Correct answer: The backend logic of a DApp is executed on a peer-to-peer network via smart contracts, whereas a traditional app's backend runs on centralized servers.
The fundamental architectural shift in DApps is the replacement of a centralized backend server with smart contracts running on a decentralized, peer-to-peer blockchain network. The frontend can use standard web technologies, but the business logic is enforced by the smart contracts on the blockchain.
Question 3: A developer is creating a smart contract on Ethereum and is concerned about the high computational costs associated with a complex function. Which of the following is a primary reason to optimize the smart contract code for 'gas' consumption?
- To increase the physical storage size of the smart contract on the blockchain.
- To reduce the monetary transaction fees users must pay to execute the contract's functions. (Correct answer)
- To improve the readability of the code for other developers.
- To make the smart contract's execution non-deterministic.
Correct answer: To reduce the monetary transaction fees users must pay to execute the contract's functions.
On blockchains like Ethereum, 'gas' is the unit used to measure the computational effort required to execute operations. Each unit of gas has a price, and the total transaction fee is a product of the gas used and the gas price. Optimizing code to use less gas directly reduces the execution cost for users.
Question 4: A development team is launching a new cryptocurrency on the Ethereum blockchain that will be used for payments within their DApp. They need to ensure their token is compatible with various wallets and exchanges. Which token standard should they implement for this fungible token?
- ERC-721
- ERC-1155
- ERC-20 (Correct answer)
- ERC-998
Correct answer: ERC-20
The ERC-20 standard is the most widely adopted framework for creating fungible tokens on the Ethereum blockchain. Fungible tokens are interchangeable, meaning each token is identical to another. This standardization ensures interoperability with wallets, exchanges, and other DApps. ERC-721 is for non-fungible (unique) tokens.
Question 5: A Decentralized Autonomous Organization (DAO) is being established to manage a DeFi protocol. How are major decisions, such as updating smart contract parameters or allocating treasury funds, typically made in a DAO?
- By the lead development team without external input.
- By a centralized board of directors appointed by the founders.
- Through a hierarchical management structure led by a CEO.
- Through proposals and voting by community members who hold governance tokens. (Correct answer)
Correct answer: Through proposals and voting by community members who hold governance tokens.
A core principle of a DAO is decentralized governance. Decisions are not made by a central authority but are instead proposed by and voted on by the community of members. Typically, voting power is proportional to the number of governance tokens a member holds.
Question 6: A key characteristic of a smart contract is that once it is deployed on the blockchain, its code cannot be altered. What is this property called?
- Determinism
- Autonomy
- Immutability (Correct answer)
- Customizability
Correct answer: Immutability
Immutability is the property of blockchain and smart contracts that ensures once data or code is written, it cannot be changed or deleted. This provides a high level of trust and security, as the rules of the contract are guaranteed to remain as they were when deployed.
A smart contract is designed to release payments to a supplier only after a shipment's arrival is confirmed by an IoT sensor.
The blockchain network itself cannot directly access data from the IoT sensor.
Which of the following is required to securely and reliably feed the external data to the smart contract?