Bird
Raised Fist0
Blockchain / Solidityprogramming~20 mins

Blockchain use cases beyond crypto - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Blockchain Use Cases Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate
2:00remaining
What is the output of this smart contract function?

Consider a smart contract function that stores and retrieves a document hash for supply chain tracking. What will be the output after calling getDocumentHash()?

Blockchain / Solidity
contract SupplyChain {
    string private documentHash;

    function storeDocumentHash(string memory hash) public {
        documentHash = hash;
    }

    function getDocumentHash() public view returns (string memory) {
        return documentHash;
    }
}

// After calling storeDocumentHash("abc123hash")
// What does getDocumentHash() return?
A"abc123hash"
B"documentHash"
C""
Dnull
Attempts:
2 left
💡 Hint

Think about what value is stored and returned by the function.

🧠 Conceptual
intermediate
1:30remaining
Which blockchain feature best supports secure medical record sharing?

In healthcare, sharing patient records securely is critical. Which blockchain feature helps ensure data integrity and controlled access?

AProof of Work mining
BAnonymous public transactions
CImmutable ledger with permissioned access
DUnlimited data storage on-chain
Attempts:
2 left
💡 Hint

Consider how data can be protected and shared only with authorized parties.

🔧 Debug
advanced
2:30remaining
Why does this blockchain voting contract fail to count votes correctly?

Review the following simplified voting contract code. Why does the vote count remain zero after voting?

Blockchain / Solidity
contract Voting {
    mapping(address => bool) public voters;
    uint public voteCount;

    function vote() public {
        if (!voters[msg.sender]) {
            voters[msg.sender] = true;
            voteCount = voteCount + 1;
        }
    }

    function getVotes() public view returns (uint) {
        return voteCount;
    }
}

// After calling vote() from different addresses, voteCount is still 0.
AThe contract is deployed but vote() is never called successfully due to missing payable modifier
BThe voteCount variable is private and cannot be read
CThe mapping voters is not initialized, causing voteCount to reset
DThe voteCount variable is not updated because vote() is never executed in a transaction
Attempts:
2 left
💡 Hint

Think about how blockchain state changes happen and what is needed to update state variables.

📝 Syntax
advanced
1:30remaining
Which option fixes the syntax error in this blockchain identity contract snippet?

Identify the correct fix for the syntax error in this Solidity code snippet:

mapping(address => string) public identities

function setIdentity(string memory name) public {
    identities[msg.sender] = name;
}
AAdd a semicolon after the mapping declaration
BAdd <code>public</code> keyword to the function setIdentity
CChange <code>string</code> to <code>string memory</code> in mapping
DReplace <code>msg.sender</code> with <code>address(this)</code>
Attempts:
2 left
💡 Hint

Check the end of the mapping declaration line.

🚀 Application
expert
3:00remaining
How many unique assets are tracked after these blockchain transactions?

A blockchain asset tracking contract stores assets by unique IDs. After these transactions, how many unique assets are stored?

storeAsset(101, "Car")
storeAsset(102, "Bike")
storeAsset(101, "Truck")
storeAsset(103, "Boat")
storeAsset(102, "Scooter")
A2
B3
C5
D4
Attempts:
2 left
💡 Hint

Consider that storing an asset with an existing ID overwrites the previous one.

Practice

(1/5)
1. Which of the following is a common use of blockchain technology beyond cryptocurrency?
easy
A. Creating new digital currencies only
B. Running traditional centralized databases
C. Tracking the origin and movement of goods in supply chains
D. Replacing all internet servers

Solution

  1. Step 1: Understand blockchain beyond money

    Blockchain is used to keep safe and clear records, not just for digital money.
  2. Step 2: Identify common non-crypto uses

    Tracking goods in supply chains is a popular use case to ensure transparency and trust.
  3. Final Answer:

    Tracking the origin and movement of goods in supply chains -> Option C
  4. Quick Check:

    Blockchain use beyond crypto = Tracking goods [OK]
Hint: Think of blockchain as a secure record keeper beyond money [OK]
Common Mistakes:
  • Thinking blockchain only creates cryptocurrencies
  • Confusing blockchain with regular databases
  • Assuming blockchain replaces all internet servers
2. Which syntax correctly describes a smart contract in blockchain?
easy
A. contract SmartContract { function run() public {} }
B. smart contract run() {}
C. contract = SmartContract()
D. function smartContract run()

Solution

  1. Step 1: Recognize smart contract syntax

    Smart contracts are written like small programs with a contract keyword and functions.
  2. Step 2: Check syntax correctness

    contract SmartContract { function run() public {} } uses correct syntax with 'contract' keyword and function declaration.
  3. Final Answer:

    contract SmartContract { function run() public {} } -> Option A
  4. Quick Check:

    Correct smart contract syntax = contract SmartContract { function run() public {} } [OK]
Hint: Look for 'contract' keyword and function inside braces [OK]
Common Mistakes:
  • Missing 'contract' keyword
  • Using assignment instead of declaration
  • Incorrect function declaration syntax
3. What will be the output of this simplified blockchain smart contract code snippet?
mapping(address => uint) public votes;
function vote() public {
votes[msg.sender] += 1;
}
vote() called twice by same address.
medium
A. votes[msg.sender] = 1
B. votes[msg.sender] = 2
C. votes[msg.sender] = 0
D. Error: duplicate voting not allowed

Solution

  1. Step 1: Understand the vote function

    Each call to vote() increases the caller's vote count by 1 in the votes mapping.
  2. Step 2: Calculate votes after two calls

    Calling vote() twice adds 1 twice, so votes[msg.sender] becomes 2.
  3. Final Answer:

    votes[msg.sender] = 2 -> Option B
  4. Quick Check:

    Two votes increment count to 2 [OK]
Hint: Each call adds 1, so two calls add up to 2 [OK]
Common Mistakes:
  • Assuming only one vote allowed
  • Thinking votes reset after each call
  • Confusing mapping with array
4. Identify the error in this blockchain voting smart contract snippet:
mapping(address => bool) public voted;
function vote() public {
require(!voted[msg.sender]);
voted[msg.sender] = true;
votes += 1;
}
medium
A. votes variable is not declared
B. require statement syntax is wrong
C. voted mapping should be uint not bool
D. Function vote() missing return type

Solution

  1. Step 1: Check variable declarations

    The code uses 'votes += 1' but 'votes' is not declared anywhere.
  2. Step 2: Verify other parts

    require syntax and voted mapping type are correct; vote() functions in Solidity do not need return type.
  3. Final Answer:

    votes variable is not declared -> Option A
  4. Quick Check:

    Undeclared variable 'votes' causes error [OK]
Hint: Check if all variables used are declared [OK]
Common Mistakes:
  • Assuming require syntax is wrong
  • Thinking bool mapping is incorrect
  • Expecting return type in void functions
5. You want to build a blockchain system to manage digital rights for music tracks. Which feature is most important to include beyond basic blockchain storage?
hard
A. Anonymous voting for favorite tracks
B. A cryptocurrency token for trading music
C. A centralized database for faster queries
D. Smart contracts to automate royalty payments

Solution

  1. Step 1: Understand digital rights management needs

    Managing rights requires automatic, trustworthy payment distribution to artists.
  2. Step 2: Identify blockchain feature for automation

    Smart contracts can run code to automate royalty payments when music is used or sold.
  3. Step 3: Evaluate other options

    Cryptocurrency tokens and voting are unrelated; centralized database loses blockchain benefits.
  4. Final Answer:

    Smart contracts to automate royalty payments -> Option D
  5. Quick Check:

    Automate payments with smart contracts [OK]
Hint: Use smart contracts to automate rules and payments [OK]
Common Mistakes:
  • Choosing cryptocurrency token instead of automation
  • Using centralized database losing blockchain trust
  • Confusing voting with rights management
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