A. Cannot use blockchain['index'] because blockchain is a list, not a dict
B. Missing 'data' key in new_block
C. append() method does not exist for lists
D. Index value should be a string, not a number
Solution
Step 1: Identify the type of 'blockchain'
blockchain is a list, so blockchain['index'] is invalid syntax.
Step 2: Understand correct way to get last block's index
To get last block's index, use blockchain[-1]['index'], not blockchain['index'].
Final Answer:
Cannot use blockchain['index'] because blockchain is a list, not a dict -> Option A
Quick Check:
List indexing needs integer, not string key [OK]
Hint: List uses numeric indexes, not string keys [OK]
Common Mistakes:
Using string keys on a list
Forgetting to access last element with -1
Confusing append() with other methods
5. You want to create a simple blockchain that stores ownership records. Which feature of blockchain helps ensure records cannot be changed without everyone noticing?
hard
A. Blocks can be edited by anyone at any time
B. Blocks are stored in a single central database
C. Blocks are linked by hashes that depend on previous blocks
D. Blocks are deleted after 24 hours automatically
Solution
Step 1: Understand blockchain's security feature
Each block contains a hash that depends on the previous block's data, linking them securely.
Step 2: Explain why this prevents unnoticed changes
If any block changes, its hash changes, breaking the chain and alerting everyone.
Final Answer:
Blocks are linked by hashes that depend on previous blocks -> Option C
Quick Check:
Hash linking = tamper detection [OK]
Hint: Hash links blocks to detect changes [OK]
Common Mistakes:
Thinking blockchain is centralized
Believing blocks can be freely edited
Assuming blocks are temporary
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.