Blocks joined in a chain

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Blocks joined in a chain

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Where is a new block added in a blockchain?
A On the end of the chain, after the latest block
B At the start of the chain, before the first block
2. Which statement about how blocks are linked is correct?
A Each new block links to the block before it
B Each new block links only to the next block that has not been made yet
3. In what order are the blocks in a blockchain arranged?
A Alphabetical order of the names of the people sending money
B Time order, from the oldest block to the newest
4. A chain has Block 1, Block 2 and Block 3. Block 4 is made next. What is the new order?
A Block 4, Block 1, Block 2, Block 3
B Block 1, Block 2, Block 3, Block 4
5. You draw a blockchain as a row of boxes. What should join the boxes?
A An arrow or line from each block back to the previous block
B No links, because each block stands on its own

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1Block 3 -> Block 2 -> Block 1 ABlock 5: previous = Block 4
2chain = [B1, B2, B3]; chain.append(B4) BA new block is added to the end of the chain, after the newest existing block
3Blocks are kept in time order, with the oldest block first and the newest block last CEach block links back to the block before it, so the blocks form a chain
4Each new block stores a link to the block before it DBlock 1 (09:00) <- Block 2 (09:10) <- Block 3 (09:20)
5New Block 6 is inserted between Block 2 and Block 3 ENew blocks must be added to the end of the chain, not into the middle. Inserting a block breaks the time order of the chain.
6Block 4: previous = none (but Blocks 1 to 3 already exist) FA block that is not the first one must link to the block before it. Here Block 4 is not linked, so it is not joined to the chain.

Definitions

chain of blocks

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
Block3.previous ← ______
2.
______ Block4 TO chain
3.
Block5.________ ← Block4
4.
IF Block2.time _ Block1.time THEN OUTPUT "Block 2 is newer" ENDIF
5.
[Block 1]<-[Block 2]<-[Block 3]<-[Block _]

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A chain = [block1, block2]
B new_block = block3
C chain.insert(0, new_block)
Question 2
A block1.previous = None
B block2.previous = block1
C block3.previous = block2
D block4.previous = block1
Question 3
A block1.time = "09:00"
B block2.time = "09:05"
C block3.time = "08:55"
Question 4
A new ← NewBlock()
B new.previous ← new
C APPEND new TO chain
Question 5
A chain = [block1]
B chain = [block2]
C chain.append(block3)
D print(len(chain))

Answer Key

Blocks joined in a chain
Section A: Quick Questions
Q1
A — On the end of the chain, after the latest block
Q2
A — Each new block links to the block before it
Q3
B — Time order, from the oldest block to the newest
Q4
B — Block 1, Block 2, Block 3, Block 4
Q5
A — An arrow or line from each block back to the previous block
Section B: Match the Pairs
Q1
Block 3 -> Block 2 -> Block 1 → Each block links back to the block before it, so the blocks form a chain
Q2
chain = [B1, B2, B3]; chain.append(B4) → A new block is added to the end of the chain, after the newest existing block
Q3
Blocks are kept in time order, with the oldest block first and the newest block last → Block 1 (09:00) <- Block 2 (09:10) <- Block 3 (09:20)
Q4
Each new block stores a link to the block before it → Block 5: previous = Block 4
Q5
New Block 6 is inserted between Block 2 and Block 3 → New blocks must be added to the end of the chain, not into the middle. Inserting a block breaks the time order of the chain.
Q6
Block 4: previous = none (but Blocks 1 to 3 already exist) → A block that is not the first one must link to the block before it. Here Block 4 is not linked, so it is not joined to the chain.
Section C: Definitions
Q1
chain of blocks — Blocks are added one after another in time order. Each new block goes on the end and links to the block before it, so the blocks form a chain.
Section D: Fill in the Blanks
Q1
Block3.previous ← Block2
Q2
APPEND Block4 TO chain
Q3
Block5.previous ← Block4
Q4
IF Block2.time > Block1.time THEN OUTPUT "Block 2 is newer" ENDIF
Q5
[Block 1]<-[Block 2]<-[Block 3]<-[Block 4]
Section E: Spot the Error
Q1
C — A new block must go on the end of the chain. insert(0, ...) puts it at the start. It should be chain.append(new_block).
Q2
D — Each block links to the block directly before it. block4 should link to block3, not skip back to block1: block4.previous = block3.
Q3
C — Blocks follow time order. block3 comes after block2 (09:05), so its time must be later, such as 09:10, not 08:55.
Q4
B — The new block must link to the last block already in the chain. It cannot link to itself. It should be new.previous ← last_block.
Q5
B — This replaces the whole chain, so block1 is lost. A block must be added to the end with chain.append(block2).