Bird
Raised Fist0
Blockchain / Solidityprogramming~20 mins

Public vs private blockchains - Practice Questions

Choose your learning style10 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.

Practice

(1/5)
1. Which statement best describes a public blockchain?
easy
A. Anyone can join and participate without permission.
B. Only invited members can access the network.
C. It is controlled by a single organization.
D. It uses private keys only for administrators.

Solution

  1. Step 1: Understand public blockchain access

    Public blockchains are open networks where anyone can join and participate without needing permission.
  2. Step 2: Compare with private blockchain features

    Private blockchains restrict access to trusted members, unlike public ones.
  3. Final Answer:

    Anyone can join and participate without permission. -> Option A
  4. Quick Check:

    Public blockchain = open access [OK]
Hint: Public means open to all, no permission needed [OK]
Common Mistakes:
  • Confusing public with private blockchain access
  • Thinking public blockchains are controlled by one entity
  • Assuming private keys limit public blockchain access
2. Which of the following is the correct way to describe a private blockchain?
easy
A. It is always slower than public blockchains.
B. It allows anyone to validate transactions.
C. It restricts access to selected participants only.
D. It uses proof-of-work exclusively.

Solution

  1. Step 1: Identify private blockchain access rules

    Private blockchains restrict access to selected participants, unlike public blockchains.
  2. Step 2: Eliminate incorrect options

    Private blockchains do not necessarily use proof-of-work or are always slower; these are unrelated to access control.
  3. Final Answer:

    It restricts access to selected participants only. -> Option C
  4. Quick Check:

    Private blockchain = restricted access [OK]
Hint: Private means limited access to trusted members only [OK]
Common Mistakes:
  • Assuming private blockchains allow anyone to validate
  • Confusing consensus methods with access control
  • Believing private blockchains are always slower
3. Consider this code snippet representing blockchain access control:
def can_access(user, blockchain_type):
    if blockchain_type == 'public':
        return True
    elif blockchain_type == 'private':
        return user in ['Alice', 'Bob']
    else:
        return False

print(can_access('Alice', 'public'))
print(can_access('Eve', 'private'))
print(can_access('Bob', 'private'))
What is the output?
medium
A. False False True
B. True False True
C. True True False
D. False True False

Solution

  1. Step 1: Evaluate access for 'Alice' on public blockchain

    Public blockchain always returns True, so can_access('Alice', 'public') is True.
  2. Step 2: Evaluate access for 'Eve' on private blockchain

    'Eve' is not in ['Alice', 'Bob'], so can_access('Eve', 'private') returns False.
  3. Step 3: Evaluate access for 'Bob' on private blockchain

    'Bob' is in the allowed list, so can_access('Bob', 'private') returns True.
  4. Final Answer:

    True False True -> Option B
  5. Quick Check:

    Public always True, private checks user list [OK]
Hint: Public always True; private checks user list membership [OK]
Common Mistakes:
  • Assuming private blockchain allows all users
  • Mixing up True/False return values
  • Ignoring the user list check for private blockchains
4. The following code is intended to check if a user can access a private blockchain. What is the error?
def check_access(user, blockchain):
    if blockchain == 'private':
        if user == ['Alice', 'Bob']:
            return True
        else:
            return False
    else:
        return True

print(check_access('Alice', 'private'))
medium
A. The user comparison uses == with a list instead of membership check.
B. The function does not return anything for public blockchains.
C. The else block is missing for private blockchain condition.
D. The print statement has incorrect syntax.

Solution

  1. Step 1: Analyze user comparison in private blockchain check

    The code uses 'user == ['Alice', 'Bob']' which compares a string to a list, always False.
  2. Step 2: Identify correct way to check user membership

    It should use 'user in ['Alice', 'Bob']' to check if user is in the allowed list.
  3. Final Answer:

    The user comparison uses == with a list instead of membership check. -> Option A
  4. Quick Check:

    Use 'in' to check list membership, not '==' [OK]
Hint: Use 'in' to check if user is in list, not '==' [OK]
Common Mistakes:
  • Using '==' to compare a string with a list
  • Forgetting to handle public blockchain case
  • Syntax errors in print statement
5. You want to design a blockchain system for a company where only employees can add transactions, but anyone can view the ledger. Which blockchain type fits best and why?
hard
A. Private blockchain, because it hides the ledger from everyone except employees.
B. Public blockchain, because it allows everyone to add transactions.
C. Public blockchain, because it restricts access to employees only.
D. Private blockchain, because it restricts who can add transactions but allows public viewing.

Solution

  1. Step 1: Identify who can add transactions

    The company wants only employees to add transactions, so write access must be restricted.
  2. Step 2: Identify who can view the ledger

    Anyone can view the ledger, so read access is open to the public.
  3. Step 3: Match blockchain type to requirements

    Private blockchains restrict write access to trusted members but can allow public read access, fitting the need.
  4. Final Answer:

    Private blockchain, because it restricts who can add transactions but allows public viewing. -> Option D
  5. Quick Check:

    Restrict writes, allow public reads = Private blockchain [OK]
Hint: Restrict who writes, allow public reads means private blockchain [OK]
Common Mistakes:
  • Choosing public blockchain for restricted write access
  • Thinking private blockchain hides ledger from public
  • Confusing read and write permissions
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard