Barcodes compared with QR codes

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

Barcodes compared with QR codes

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which code stores data in only ONE dimension (a row of lines)?
A QR code
B Barcode
2. Which code can store much more data, such as a web address or a paragraph of text?
A QR code
B Barcode
3. A barcode on a packet of crisps usually stores...
A A short number that identifies the product
B The whole description, price and photo of the product
4. Which statement about reading a QR code is correct?
A A camera can read it from any angle
B It must be scanned in a straight line across the lines
5. Which scanner is traditionally used to read a barcode at a supermarket till?
A A 3D scanner that measures the shape of the packet
B A laser scanner that sweeps a beam across the lines

Match the Pairs

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

Left columnRight column
11D barcode AA barcode uses 1D lines and holds only a short number. A grid of squares and much more data describe a QR code.
22D QR code BStores much more data using a grid of squares in two dimensions, so it can hold web links and text
3A laser scanner reads a barcode by sweeping a beam across the lines, so the barcode must be lined up with the scanner CStores a short number using one dimension of vertical lines, so it holds only a small amount of data
4A camera-based scanner captures an image of a QR code, so it can read the code at any angle Dlaser scanner + 1D barcode
5A barcode stores a web link in a grid of squares Ecamera + 2D QR code
6A QR code is 1D, so it must be scanned in a straight line FA QR code is 2D, using width and height. Because of this it can be scanned from any angle.

Definitions

1D barcode vs 2D QR code

Fill in the Blanks

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

1.
barcode.dimensions ← _
2.
qrCode.dimensions ← _
3.
IF dataLength > 20 THEN code ← "__" ENDIF
4.
qrCode.readAngle ← "___"
5.
qrScanner.uses ← "______"

Spot the Error

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

Question 1
A bar_dims = 1
B qr_dims = 2
C print(qr_dims < bar_dims)
Question 2
A bar_dims = 2
B qr_dims = 2
C print("Barcode dims:", bar_dims)
Question 3
A def can_store_url(code)
B return code == "QR"
C print(can_store_url("QR"))
Question 4
A code = "QR"
B reader = "camera"
C if reader = "camera":
D print("Can read QR")
Question 5
A data = "www.cloodit.com"
B code = "barcode"
C print("Use", code, "for a URL")

Answer Key

Barcodes compared with QR codes
Section A: Quick Questions
Q1
B — Barcode
Q2
A — QR code
Q3
A — A short number that identifies the product
Q4
A — A camera can read it from any angle
Q5
B — A laser scanner that sweeps a beam across the lines
Section B: Match the Pairs
Q1
1D barcode → Stores a short number using one dimension of vertical lines, so it holds only a small amount of data
Q2
2D QR code → Stores much more data using a grid of squares in two dimensions, so it can hold web links and text
Q3
A laser scanner reads a barcode by sweeping a beam across the lines, so the barcode must be lined up with the scanner → laser scanner + 1D barcode
Q4
A camera-based scanner captures an image of a QR code, so it can read the code at any angle → camera + 2D QR code
Q5
A barcode stores a web link in a grid of squares → A barcode uses 1D lines and holds only a short number. A grid of squares and much more data describe a QR code.
Q6
A QR code is 1D, so it must be scanned in a straight line → A QR code is 2D, using width and height. Because of this it can be scanned from any angle.
Section C: Definitions
Q1
1D barcode vs 2D QR code — A barcode stores a short number in one dimension of lines; a QR code stores much more data in two dimensions of squares and can be read by a camera from any angle.
Section D: Fill in the Blanks
Q1
barcode.dimensions ← 1
Q2
qrCode.dimensions ← 2
Q3
IF dataLength > 20 THEN code ← "QR" ENDIF
Q4
qrCode.readAngle ← "any"
Q5
qrScanner.uses ← "camera"
Section E: Spot the Error
Q1
C — A QR code is 2D and a barcode is 1D, so qr_dims is greater than bar_dims. The comparison should use > so it prints True.
Q2
A — A barcode stores data in one dimension (a row of lines), so bar_dims should be 1. Two dimensions describes a QR code.
Q3
A — A function definition must end with a colon. It should be def can_store_url(code):
Q4
C — A single = assigns a value, but an if statement needs a comparison. It should be if reader == "camera": so the camera is checked.
Q5
B — A barcode only holds a short number, so it cannot store a web address. A QR code stores much more data, so code should be "QR".