Hyperledger Fabric Certified Practitioner Free Sample Questions

Description

Covers Hyperledger Fabric network architecture, the ordering service, channels and ledger, chaincode development and ledger operations, and production deployment and performance.

20 free sample questions204 in the full practice test

Try simulator

HFCP Sample Questions

  1. Question 1

    Beginner

    Network Structure and Components · Ordering Service Implementation

    A financial consortium is deploying a Hyperledger Fabric network with three ordering service nodes using the Raft consensus protocol. To ensure high availability, the operations team wants to allow for one orderer node to fail without impacting the network's ability to process transactions. What is the minimum number of orderer nodes that must be operational to maintain a quorum?

    Answer and explanation

    Correct answer: A

    Raft is crash fault tolerant as long as a majority of the consenters (a quorum) is available. The quorum is floor(N/2) + 1, so for N = 3 it is 2: a three-node ordering service can lose one node and keep ordering transactions, but if two nodes fail the remaining node cannot form a majority and the channel stops producing blocks.

  2. Question 2

    Intermediate

    Smart Contracts and Chaincode · Reading and Modifying Ledger State

    A developer is writing a Go chaincode function to update an asset's state. To ensure data privacy, the asset's price must be passed to the chaincode function but NOT recorded in the transaction's read-write set on the public ledger. Which method should be used to access this private data within the chaincode?

    Answer and explanation

    Correct answer: C

    The GetTransient() method on the chaincode stub is used to access the transient data field of a transaction proposal. Data in the transient field is passed to the chaincode but is not included in the final transaction that gets committed to the ledger, making it ideal for passing private or confidential information for processing.

  3. Question 3

    Intermediate

    Production Deployment and Operations · Network Security

    A system administrator is joining a peer of a newly added organization to an existing channel. When the administrator requests the channel's genesis block from the ordering service (peer channel fetch 0 ...) so that the peer can join, the request is rejected and the ordering node's logs show 'access denied' policy-check failures for the request. The TLS connection to the ordering node is established successfully, and the organization's MSP ID is correct. What is a common cause of this issue?

    Answer and explanation

    Correct answer: C

    The ordering service delivers a channel's blocks only to identities that satisfy the channel's read policy. In the Fabric 'Adding an Org to a Channel' tutorial, the new organization fetches block 0 only after the configuration update that adds its MSP has been committed: if the organization had not been successfully appended to the channel configuration, the ordering service would reject the request. A missing orderer TLS CA certificate (for example, no --cafile on the CLI call) causes a TLS handshake or certificate-verification failure instead of an access-denied policy error, and the state database, chaincode containers and genesis block content do not decide whether the request is authorized.

  4. Question 4

    Beginner

    Client Applications · Smart Contract Invocation

    A developer is building a client application using the Fabric Gateway SDK. The application needs to query the current world state to display information to a user but should not create a transaction that goes through the ordering service. Which Gateway method is most efficient for this purpose?

    Answer and explanation

    Correct answer: D

    The evaluateTransaction() method is specifically designed for read-only operations (queries). It submits a proposal to a single peer, which executes the chaincode and returns the result directly to the client. This avoids the overhead of the full transaction flow involving endorsement from multiple peers and ordering, making it highly efficient for queries.

  5. Question 5

    Intermediate

    Smart Contracts and Chaincode · Private Data Collections

    True or False: When using Private Data Collections (PDCs), the actual private data is sent to the ordering service and included in the block, but it is encrypted so only authorized peers can decrypt it.

    Answer and explanation

    Correct answer: B

    This statement is false. The core privacy mechanism of PDCs is that the private data itself is NOT sent to the ordering service. Instead, only a hash of the private data is included in the public transaction. The actual private data is transmitted peer-to-peer via the gossip protocol only between the authorized organizations.

  6. Question 6

    AdvancedMultiple answers

    Smart Contracts and Chaincode · Chaincode Lifecycle

    During a chaincode upgrade using the new lifecycle, an administrator successfully packages and installs the new version. However, when trying to commit the new chaincode definition to the channel, the transaction fails. Which of the following are potential reasons for this commit failure? (Select TWO)

    Answer and explanation

    Correct answers: C, D

    Committing a chaincode definition requires satisfying the channel's LifecycleEndorsement policy (typically a majority of organizations). If not enough organizations have submitted an 'approveformyorg' transaction for the new definition, the 'commit' transaction will fail validation.

    The chaincode lifecycle requires that each new definition committed to a channel must have a sequence number that is exactly one greater than the previously committed sequence number. Failing to increment the sequence number is a common reason for commit failure.

  7. Question 7

    Intermediate

    Network Structure and Components · Channel Management

    A supply chain network uses anchor peers to facilitate cross-organization communication. Org1 has two peers, peer0.org1 and peer1.org1. Initially, only peer0.org1 was defined as an anchor peer. The administrator now wants to add peer1.org1 as a second anchor peer for redundancy. Which tool and process should be used to perform this update on a running network?

    Answer and explanation

    Correct answer: D

    Anchor peers are defined in the channel configuration. To update them on a live network, an administrator must create a channel configuration update transaction. This involves fetching the latest config block, using configtxlator to convert it to JSON, modifying the anchor peer definition, converting it back to a protobuf, and submitting the signed update transaction to the channel.

  8. Question 8

    Intermediate

    Smart Contracts and Chaincode · Executing Queries

    A developer needs to implement a query in chaincode that finds all assets belonging to a specific owner. The assets are stored with keys like ASSET_1, ASSET_2, etc., and the owner is an attribute in the JSON value. To make this query efficient without scanning the entire state database, which feature should be used?

    Answer and explanation

    Correct answer: D

    CouchDB supports rich queries against the JSON data values stored in the world state. To make these queries performant and avoid full database scans, a corresponding index must be created for the fields being queried (in this case, the 'owner' field). The chaincode can then use a GetQueryResult call with a selector to efficiently find all assets for that owner.

  9. Question 9

    Advanced

    Client Applications · Chaincode and Block Events

    An event-listening service is designed to monitor a Hyperledger Fabric channel for specific chaincode events. The service crashes and is restarted. To avoid processing duplicate events or missing events that occurred during the downtime, what mechanism should the application implement?

    Answer and explanation

    Correct answer: B

    This is event checkpointing. The Fabric Gateway client API does not reconnect automatically: after a failure the application must start a new eventing session at the correct start position. A checkpointer (for example checkpointers.file(path)) persists the block number and the last processed transaction ID within that block; passing it as the checkpoint option to getChaincodeEvents() resumes eventing just after the last processed event, with no missed or duplicated events. There is no replay=true option, and neither evaluateTransaction nor a peer buffer setting can recover missed events.

  10. Question 10

    Intermediate

    Production Deployment and Operations · Monitoring and Troubleshooting

    A DevOps engineer is setting up monitoring for a production Hyperledger Fabric network using Prometheus. To get detailed metrics about transaction validation latency and chaincode execution time, which component's configuration must be updated to enable the operations service?

    Answer and explanation

    Correct answer: D

    The operations service, which exposes a REST API for health checks and a /metrics endpoint for Prometheus, must be enabled and configured on the components you wish to monitor. This is done within the operations section of the core.yaml file for peers and the orderer.yaml file for orderers.

Register free for 10 more questions

Or unlock all 204 HFCP questions with explanations, timed mode and flashcards.