Exam Information
Free practice questions with explanations
Blockchain CBDE Practice Questions
Answer a question to see the correct answer and the explanation, or click Show answer. Newest questions first.
- Questions
- 12
- Answered
- 0
- Correct
- 0
- Score
- -
-
1 Question 1 Single choice Implement web3.js
A fintech team runs a dApp front end that reads balances from an Ethereum node and submits transactions signed by users' MetaMask wallets. After a recent upgrade, the app sends a transaction and gets back a receipt, but the UI shows the old balance for several seconds. The team uses web3.js 1.x with an HTTP provider pointing at a private node. Users complain the UI never shows the updated balance until they refresh. The compliance team requires that the displayed balance reflect only mined state, not pending transactions. Which change is the BEST fix?
Correct Answer: AExplanationSubscribing to newBlockHeaders over a WebSocket provider lets the dApp refetch balances only when a new block is mined, which satisfies the requirement that the displayed value reflect mined state. Reading with the pending block tag would surface unmined transactions, violating compliance. Raising gas price changes inclusion timing but does not fix the UI refresh logic. eth_getStorageAt reads contract storage slots, not an externally owned account's balance, so it is the wrong call entirely.
-
2 Question 2 Single choice Write and compile Solidity smart contracts
A logistics company is writing a Solidity contract that records shipment checkpoints. The contract must compile with a pragma that locks the compiler to the audited 0.8.x line and must reject any build that would silently change arithmetic semantics. The developer compiles with solc on a CI runner that has version 0.7.6 installed globally, and the build fails with a pragma mismatch. The team cannot upgrade the runner image for two weeks because of a change freeze. Which action BEST satisfies both the pragma requirement and the change freeze?
Correct Answer: DExplanationRunning an explicit 0.8.x compiler alongside the frozen runner keeps the source pinned to the audited line while avoiding changes to the shared image. Removing the pragma lets any compiler build the code, which breaks the pinning requirement. Lowering the pragma to 0.7 violates the audited-line rule. ABIEncoderV2 is a separate encoding pragma and does not relax a version constraint, so the build still fails.
-
3 Question 3 Single choice Create secure smart contracts
A DeFi protocol's vault contract lets users withdraw ETH with a call to msg.sender. During an external audit, the auditors found that an attacker contract can re-enter withdraw before the balance is decremented and drain the vault. The product owner wants the fix to be minimal, keep the withdraw function's public interface unchanged, and not depend on an off-chain monitoring service. Which change BEST meets these constraints?
Correct Answer: BExplanationCombining a reentrancy lock with the checks-effects-interactions ordering (zeroing the balance before the external call) directly closes the re-entry path without changing the function signature or relying on off-chain tooling. Switching to transfer with an adjusted stipend is not a fix, since transfer's fixed 2300-gas stipend is itself a reason it is discouraged and gas costs change over time. tx.origin is a known phishing vector and does not stop re-entry. delegatecall to an external withdrawal contract executes that code in the vault's storage context and adds risk rather than removing it.
-
4 Question 4 Single choice Deploy smart contracts both the live and test Ethereum networks
A startup must deploy an upgrade-ready ERC-20 token to a public testnet for QA, then to mainnet. The deployment script uses Hardhat with a funded deployer account. The QA lead reports that the same script deployed to the testnet succeeded, but on mainnet the transaction is rejected with an error indicating the chain ID does not match. The team is not allowed to store private keys in the repository, and the script must remain usable for both networks. What is the BEST correction?
Correct Answer: DExplanationHardhat network entries pair each RPC URL with its chainId and the signing accounts, and --network selects which entry is used, so the same script works per environment. Reading the key from an environment variable keeps secrets out of the repository, as required. Hardcoding chainId 1 breaks the testnet deployment. Pointing mainnet at the testnet RPC means the node is not on mainnet at all. Relying on auto-detection is not how signed transactions are scoped; the chain ID must be set so replay protection works.
-
5 Question 5 Single choice Calculate Ethereum gas costs
A marketplace plans a batch function that mints 50 NFTs in one transaction. Each mint writes a new storage slot for ownership and emits an event. The operations lead wants to estimate the minimum intrinsic cost before running the function on mainnet, to confirm the transaction will fit within a planned gas limit of 2,000,000. The base transaction cost is 21,000 gas, and calldata costs 16 gas per non-zero byte and 4 gas per zero byte. Which approach gives the MOST accurate pre-deployment estimate of total gas used?
Correct Answer: DExplanationeth_estimateGas executes the call against the current state and returns the gas the path actually consumes, including SSTORE costs for new slots and LOG costs for events, which static arithmetic cannot capture. Multiplying by 21,000 ignores storage and calldata, so it grossly undercounts. The block gas limit is an upper bound on the whole block, not an estimate of this transaction. Dividing the gas limit by gas price yields an affordability figure, not a gas usage estimate.
-
6 Question 6 Multiple choice Unit test smart contracts
A lending platform's Solidity contract computes collateral ratios and must never allow a loan when the collateral price feed returns zero. The team writes Hardhat tests with Chai assertions. A reviewer notes that the current suite only checks the happy path and that a revert on zero price would not be detected if the check were removed. The team wants to strengthen the suite with minimal new infrastructure and without running on mainnet. Which TWO actions together BEST improve the test suite? (Choose two.)
Correct Answer: C, DExplanationA revert test with a mocked zero price directly asserts the guard, and a controllable mock feed in the fixture makes that scenario reproducible locally without depending on live data. Forking mainnet adds network dependence and cannot force a zero price, so it does not target the failure mode. Raising the gas limit has no bearing on whether the revert occurs. Replacing assertions with console logs removes automated pass/fail checking entirely.
-
7 Question 7 Single choice Run an Ethereum node on development machines
A developer wants a local Ethereum node for integration tests that reproduce the behaviour of a proof-of-stake network with realistic block times, rather than instant-mining behaviour. The machine is a laptop with limited disk space, and the team needs the chain state to be discarded after each test run. The developer is considering running a full Geth node with a fresh data directory each time. Which configuration is the BEST choice for this requirement?
Correct Answer: BExplanationA private genesis with Clique proof-of-authority and a configured block period gives realistic interval-based block production while keeping the chain entirely local and small. Using a temporary data directory satisfies the discard requirement without syncing a large public chain. Ganache's default instant-mining does not reproduce block time. Syncing a public testnet strains the laptop's disk and adds network dependence. Geth dev mode mines on transaction arrival rather than on a timed interval, so it misses the realistic block-time requirement.
-
8 Question 8 Order list Deploy smart contracts both the live and test Ethereum networks
A team must deploy a verified contract to a public testnet and then check that the deployed bytecode and constructor arguments match the source. The contract is compiled with a fixed compiler version and optimisation settings. Arrange the steps in the correct order.
Drag the steps into the correct order, or use the arrows.
- Send the deployment transaction from the funded deployer account and wait for the receipt
- Confirm the transaction receipt shows a successful status and note the contract address
- Submit the source, compiler version, settings and ABI-encoded constructor arguments to the block explorer for verification
- Compile the source with the pinned compiler version and optimisation settings recorded in the build config
Correct Answer:- Compile the source with the pinned compiler version and optimisation settings recorded in the build config
- Send the deployment transaction from the funded deployer account and wait for the receipt
- Confirm the transaction receipt shows a successful status and note the contract address
- Submit the source, compiler version, settings and ABI-encoded constructor arguments to the block explorer for verification
ExplanationThe source must be compiled with pinned settings first, since the bytecode produced depends on those settings. The deployment transaction is then broadcast and its receipt confirms success and yields the contract address. Only after the address exists can the verification step match the on-chain bytecode against the submitted source and constructor arguments. Verifying before deployment is impossible because the explorer needs a deployed address, and confirming the receipt before sending the transaction has no meaning.
-
9 Question 9 Single choice Create secure smart contracts
A healthcare consortium's contract uses a role-based access model where an admin account can grant and revoke a PAUSER role. A security review found that the admin role is assigned to a single externally owned account controlled by one employee. The consortium requires that no single key can unpause the system or change roles, and that the design avoids an upgradeable proxy. Which change BEST satisfies these requirements?
Correct Answer: CExplanationA multisignature wallet as the admin means no single key can change roles or unpause, which directly meets the consortium's requirement while keeping the access logic in the contract. A timelock controlled by one employee still leaves a single key with ultimate authority. A single owner that transfers in one transaction is exactly the single-key pattern being removed. A proxy violates the stated no-upgradeable-proxy constraint.
-
10 Question 10 Single choice Calculate Ethereum gas costs
A rollup-style batching contract stores a 32-byte commitment per batch and runs on Ethereum mainnet. The product team wants to reduce per-user cost. The contract currently writes each user's batch entry to a separate storage slot with a fresh SSTORE on every submission, which costs roughly 20,000 gas per new non-zero slot. The team considers packing several small fields into a single storage slot. Which statement describes the MOST accurate gas impact of this change?
Correct Answer: DExplanationThe EVM charges per storage slot touched, so writing several small values into one slot costs one fresh SSTORE instead of several, provided they are written together. Claiming there is no effect ignores that storage is charged per slot. Packing does not change the 21,000 base transaction cost, which is fixed. Packing mainly benefits writes rather than reads, and SSTORE is charged per slot touched rather than per byte.
-
11 Question 11 Drag and drop Write and compile Solidity smart contracts
A team is preparing a Solidity 0.8.x project for a deployment review. Each change to the compiler setup has a specific purpose, and the reviewer wants each requirement matched to the setting that satisfies it. Match each requirement to the setting that meets it.
Drag each item onto its matching target. On a phone: tap an item, then tap a target.
Reduce deployed bytecode size and runtime cost for frequently called functionsLock the source to the audited compiler line so builds cannot drift to a newer minor versionProduce artifacts that let an explorer reproduce and verify the exact buildRecording the compiler version and settings in the build metadataUsing an experimental pragma to enable unaudited language featuresoptimizer enabled with a chosen runs valueSetting the EVM version to a pre-Shanghai hard fork for all deploymentsCaret-free pragma such as pragma solidity 0.8.20Correct Answer:- Lock the source to the audited compiler line so builds cannot drift to a newer minor version → Caret-free pragma such as pragma solidity 0.8.20
- Reduce deployed bytecode size and runtime cost for frequently called functions → optimizer enabled with a chosen runs value
- Produce artifacts that let an explorer reproduce and verify the exact build → Recording the compiler version and settings in the build metadata
ExplanationA fixed pragma without a caret pins the source to one compiler version, which matches the audit-lock requirement. Enabling the optimizer with a runs value tunes the trade-off between deployment size and per-call runtime cost. Recording the compiler version and settings in the metadata is what lets verification reproduce the build. Experimental pragmas are a separate concern that adds risk rather than meeting a reproducibility need, and pinning an old EVM version is not what reduces runtime cost.
-
12 Question 12 Single choice Unit test smart contracts
A team's token contract emits a Transfer event on every successful transfer, and downstream indexers depend on the event's argument order and values. A developer wants a Hardhat test that confirms the event is emitted with the correct sender, recipient and amount, and that no event is emitted when the transfer reverts because of insufficient balance. Which test approach is the MOST appropriate?
Correct Answer: DExplanationHardhat's Chai matchers let the test assert the emitted event with its exact arguments in the success path, and assert the revert in the failure path, which directly verifies both behaviours. Reading balances cannot prove that the correct event was emitted or that none was emitted on revert. Gas used is not a reliable signal of success or emission. View functions cannot emit events, so calling transfer that way returns no events.
These are 12 of the 102 questions in the full CBDE pack.
Get All 102 QuestionsGet all 102 questions & answers
Full access options for Blockchain CBDE
Self-study
PDF Version
- 102 actual exam questions
- Compatible with all devices
- Printable PDF format
- No download limits
- 90 days free updates
- 24/7 customer support
Best value
Bundle Pack
- Discounted PDF + online access
- 102 actual exam questions
- Both PDF and online practice test
- Free 90 days updates
- No download or practice limits
- 24/7 customer support
Exam simulation
Online Practice Test
- 102 actual exam questions
- Actual exam environment
- 90 days free updates
- Browser-based software
- 24/7 customer support
100% Money Back Guarantee
Your success comes first
At DumpsProvider, we give you a 100% money back guarantee on all of our exam dumps. For us, your success is the #1 priority and we are more than confident that our exam material will help you pass the CBDE Exam (BTA Certified Blockchain Developer - Ethereum) on your very first attempt.
In a rare case, if you fail your exam, we will refund your amount without asking a single question.