0
0
Blockchain / Solidityprogramming~20 mins

Public vs private blockchains - Practice Questions

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Blockchain Mastery: Public vs Private
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Which statement best describes a public blockchain?

Choose the statement that correctly describes a public blockchain.

AIt is controlled by a single organization with restricted access.
BAnyone can join and participate without permission.
COnly invited members can join and validate transactions.
DIt uses a private network with no public access.
Attempts:
2 left
💡 Hint

Think about who can access and participate in a public blockchain.

🧠 Conceptual
intermediate
1:30remaining
What is a key feature of a private blockchain?

Identify the key feature that distinguishes a private blockchain from a public one.

AIt is maintained by a decentralized group of unknown validators.
BIt allows anonymous participation from anyone worldwide.
CIt uses proof-of-work mining to secure the network.
DIt restricts access to a selected group of participants.
Attempts:
2 left
💡 Hint

Consider who controls access in a private blockchain.

Predict Output
advanced
2:00remaining
What is the output of this blockchain node access check?

Given the code below simulating node access in a blockchain network, what will be printed?

Blockchain / Solidity
class BlockchainNode:
    def __init__(self, is_public):
        self.is_public = is_public
    def can_join(self, user):
        if self.is_public:
            return True
        else:
            return user in ['Alice', 'Bob']

node_public = BlockchainNode(True)
node_private = BlockchainNode(False)

print(node_public.can_join('Eve'))
print(node_private.can_join('Eve'))
ATrue\nTrue
BFalse\nTrue
CTrue\nFalse
DFalse\nFalse
Attempts:
2 left
💡 Hint

Check how the can_join method works for public and private nodes.

Predict Output
advanced
2:00remaining
What error does this private blockchain access code raise?

Analyze the code below and identify the error it produces when run.

Blockchain / Solidity
class PrivateBlockchain:
    def __init__(self, members):
        self.members = members
    def add_member(self, member):
        if member not in self.members:
            self.members.append(member)
    def validate_transaction(self, user):
        if user not in self.members:
            raise PermissionError('User not authorized')
        return 'Transaction validated'

chain = PrivateBlockchain(['Alice', 'Bob'])
print(chain.validate_transaction('Eve'))
APermissionError: User not authorized
BAttributeError: 'PrivateBlockchain' object has no attribute 'members'
CTypeError: 'in' requires string as left operand
DNo error, prints 'Transaction validated'
Attempts:
2 left
💡 Hint

Look at the validate_transaction method and the user passed.

🧠 Conceptual
expert
2:30remaining
Which blockchain type best fits a company needing fast, private transactions with controlled access?

Choose the blockchain type that best suits a company requiring fast transaction processing, privacy, and controlled participant access.

APrivate blockchain with restricted access and permissioned nodes.
BPublic blockchain with open participation and proof-of-work consensus.
CPublic blockchain with anonymous nodes and no access control.
DHybrid blockchain with no restrictions on transaction visibility.
Attempts:
2 left
💡 Hint

Consider privacy and access control needs for a company.