Transaction

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

Transaction

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which of these is a transaction?
A Ali pays Sam 5 coins for a sandwich
B Ali counts how many coins he owns
2. What does a transaction always involve?
A Only a receiver with no sender
B A sender, a receiver and an amount
3. Who is the sender in this transaction: Mia pays Leo 20 coins?
A Mia
B Leo
4. Who is the receiver in this transaction: Noah sends Zoe 12 coins?
A Zoe
B Noah
5. What should happen to every transaction?
A It can be ignored once the money has moved
B It must be recorded

Match the Pairs

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

Left columnRight column
1transaction Asender: Mia, receiver: Noah, amount: 20
2Ava pays Liam 5 coins BA transaction needs an amount. Without one, it is not a complete movement of money and cannot be recorded properly.
3Every transaction needs a sender, a receiver and an amount of money CA single movement of money from one person to another, such as a payment
4Each transaction must be recorded so there is proof that the payment happened DA transaction is only a single movement of money, not the whole system that stores or processes many payments.
5Zoe pays Leo (no amount given) EOne transaction: a sender (Ava) sends an amount (5 coins) to a receiver (Liam)
6A transaction is the whole bank or blockchain system Fledger.add(transaction)

Definitions

transaction

Fill in the Blanks

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

1.
______ ← "Ava" receiver ← "Ben" amount ← 20
2.
sender ← "Ava" ________ ← "Ben" amount ← 20
3.
sender ← "Ava" receiver ← "Ben" ______ ← 20
4.
transaction ← [sender, receiver, amount] APPEND transaction TO ______
5.
___________ ← [sender, receiver, amount] APPEND transaction TO ledger

Spot the Error

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

Question 1
A sender <- "Ava"
B receiver <- "Ben"
C amount <- -25
D OUTPUT amount
Question 2
A amount <- 30
B sBal <- sBal + amount
C rBal <- rBal + amount
D OUTPUT sBal
Question 3
A amount <- 20
B IF amount >= balance THEN
C pay(amount)
D ENDIF
Question 4
A sender <- "Ava"
B receiver <- "Ben"
C amount <- 25
D record <- [sender, amount]
Question 5
A amount = 12.50
B sender <- "Mia"
C receiver <- "Leo"
D OUTPUT "Paid " + amount

Answer Key

Transaction
Section A: Quick Questions
Q1
A — Ali pays Sam 5 coins for a sandwich
Q2
B — A sender, a receiver and an amount
Q3
A — Mia
Q4
A — Zoe
Q5
B — It must be recorded
Section B: Match the Pairs
Q1
transaction → A single movement of money from one person to another, such as a payment
Q2
Ava pays Liam 5 coins → One transaction: a sender (Ava) sends an amount (5 coins) to a receiver (Liam)
Q3
Every transaction needs a sender, a receiver and an amount of money → sender: Mia, receiver: Noah, amount: 20
Q4
Each transaction must be recorded so there is proof that the payment happened → ledger.add(transaction)
Q5
Zoe pays Leo (no amount given) → A transaction needs an amount. Without one, it is not a complete movement of money and cannot be recorded properly.
Q6
A transaction is the whole bank or blockchain system → A transaction is only a single movement of money, not the whole system that stores or processes many payments.
Section C: Definitions
Q1
transaction — A single movement of money from one person to another, such as a payment of an amount from a sender to a receiver. Each one must be recorded.
Section D: Fill in the Blanks
Q1
sender ← "Ava" receiver ← "Ben" amount ← 20
Q2
sender ← "Ava" receiver ← "Ben" amount ← 20
Q3
sender ← "Ava" receiver ← "Ben" amount ← 20
Q4
transaction ← [sender, receiver, amount] APPEND transaction TO ledger
Q5
transaction ← [sender, receiver, amount] APPEND transaction TO ledger
Section E: Spot the Error
Q1
C — A payment is an amount of money moving from sender to receiver, so the amount must be positive. It should be amount <- 25.
Q2
B — The sender's balance must go down by the amount paid. It should be sBal <- sBal - amount.
Q3
B — The payment should only happen if the sender has enough money. The test should be amount <= balance.
Q4
D — A transaction record must include the sender, the receiver and the amount. The receiver is missing. It should be record <- [sender, receiver, amount].
Q5
A — In this pseudocode, a value is assigned to a variable with <-, not =. It should be amount <- 12.50.