Ledger

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

Ledger

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which best describes a ledger?
A A record book that lists every transaction
B A machine that prints new coins and notes
2. How many entries does a ledger usually have for each transaction?
A One record per transaction
B One record for the whole year
3. A shop writes every sale and payment in a book. What is this book called?
A A digital wallet
B A paper ledger
4. A bank wants to work out how much money a customer has. What should it use?
A Add up the transactions in the ledger
B Guess from the customer's last payment
5. A ledger shows that Sam paid Priya $20. What can you tell from this record?
A Only that some money moved, with no names
B Who paid whom and how much

Match the Pairs

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

Left columnRight column
1ledger Arecord = ("Ava", "Liam", 20)
2balance = total_in - total_out BThe records only list names. A ledger record must also show how much was paid, so the amount is missing.
3A ledger holds one record for each transaction, so the records form a list CA record book that lists every transaction, showing who paid whom and how much
4A ledger entry shows who paid whom and how much DClearing the ledger deletes every record. A ledger must keep an accurate history of all transactions, so records must not be wiped.
5ledger = ["Ava", "Liam"] Eledger = [t1, t2, t3]
6ledger = [t1, t2] ledger.clear() FWorking out how much money someone has by adding up the ledger records

Definitions

ledger

Fill in the Blanks

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

1.
______ ← []
2.
balance ← 100 FOR EACH t IN ledger balance ← balance _ t.amount
3.
total ← 0 ________ t IN ledger total ← total + t.amount
4.
ledger ← [t1, t2, t3] OUTPUT ______(ledger)
5.
FOR EACH t IN ledger OUTPUT t.payer, "paid", t._____, t.amount

Spot the Error

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

Question 1
A ledger ← 0
B APPEND ledger, "Ava pays Ben 5"
C APPEND ledger, "Ben pays Cy 2"
D OUTPUT LENGTH(ledger)
Question 2
A balance ← 100
B payment ← 30
C balance ← balance + payment
D OUTPUT balance
Question 3
A ledger ← []
B record ← "Ava,Ben,5"
C APPEND ledger, record
D OUTPUT LENGTH(record)
Question 4
A total ← 0
B FOR i ← 1 TO 3
C total ← amount[i]
D NEXT i
E OUTPUT total
Question 5
A balance ← 50
B IF balance <= 20 THEN
C balance ← balance - 20
D ENDIF

Answer Key

Ledger
Section A: Quick Questions
Q1
A — A record book that lists every transaction
Q2
A — One record per transaction
Q3
B — A paper ledger
Q4
A — Add up the transactions in the ledger
Q5
B — Who paid whom and how much
Section B: Match the Pairs
Q1
ledger → A record book that lists every transaction, showing who paid whom and how much
Q2
balance = total_in - total_out → Working out how much money someone has by adding up the ledger records
Q3
A ledger holds one record for each transaction, so the records form a list → ledger = [t1, t2, t3]
Q4
A ledger entry shows who paid whom and how much → record = ("Ava", "Liam", 20)
Q5
ledger = ["Ava", "Liam"] → The records only list names. A ledger record must also show how much was paid, so the amount is missing.
Q6
ledger = [t1, t2] ledger.clear() → Clearing the ledger deletes every record. A ledger must keep an accurate history of all transactions, so records must not be wiped.
Section C: Definitions
Q1
ledger — A record book listing every transaction, so you can see who paid whom and how much. It is used to work out balances and keep an accurate history.
Section D: Fill in the Blanks
Q1
ledger ← []
Q2
balance ← 100 FOR EACH t IN ledger balance ← balance + t.amount
Q3
total ← 0 FOR EACH t IN ledger total ← total + t.amount
Q4
ledger ← [t1, t2, t3] OUTPUT LENGTH(ledger)
Q5
FOR EACH t IN ledger OUTPUT t.payer, "paid", t.payee, t.amount
Section E: Spot the Error
Q1
A — A ledger holds one record per transaction, so it must start as an empty list: ledger ← []. A number cannot have records appended to it.
Q2
C — Paying money out lowers the balance. The line should subtract the payment: balance ← balance - payment.
Q3
D — The number of transactions recorded is the length of the ledger list, LENGTH(ledger). LENGTH(record) would count the characters in one record.
Q4
C — This overwrites the total on every loop instead of adding to it. It should be total ← total + amount[i] so the ledger amounts are summed.
Q5
B — The payment should only be recorded when the balance is at least the amount. The condition should be balance >= 20, not <=.