Paper 1 Lab Skills Drills

These are original Paper 1-style practice questions. They use concrete practical-exam scenarios so the answers can be checked exactly.

These questions ask you to explain practical workflow decisions in words. They support Paper 2 readiness, but they are written in a Paper 1-style short-answer format.

Detailed answers are in Paper 1 Lab Skills Answers.

Revise the topic hub first:

Questions

Question 1: Workflow

A lab task asks you to build a Flask app that reads data/books.csv, inserts selected rows into library.db, and displays books at /books.

Explain why it is better to build and test this in small stages rather than writing the whole app before running it. [2]

Question 2: File Management

The required folder tree is:

task/
  app.py
  data/books.csv
  templates/books.html
  static/style.css
  library.db

State two problems that may occur if books.csv or books.html is moved outside the task folder before submission. [2]

Question 3: Requirement Table

From this task description, identify one input, one output, one storage item, and one required file.

Read products from data/products.csv. Allow the user to choose a category.
Display matching products in a web page. Store selected products in shop.db.
Use template templates/products.html.

[4]

Question 4: Testing Ladder

A student must test:

A: full app from homepage to database insert
B: validate_category("Books")
C: /products route displays one product
D: final clean rerun after restarting the app

Order the tests from smallest to largest/final. [4]

Question 5: Debugging

This error appears:

FileNotFoundError: [Errno 2] No such file or directory: 'data/products.csv'

Give four systematic debugging checks or actions. [4]

Question 6: Error Message

This traceback line appears:

File "app.py", line 27, in load_products
    price = float(row["price"])
ValueError: could not convert string to float: ''

State what the line number and error type tell the programmer. [2]

Question 7: Database Smoke Test

Assume the Product table has already been created with compatible columns. Before building full routes, a student runs:

INSERT INTO Product (product_id, name) VALUES ('P01', 'Pen');
SELECT product_id, name FROM Product;

Explain why this small insert/select test is useful. [2]

Question 8: Submission Check

For the folder tree in Question 2, list four final submission checks before handing in the task. [4]

Question 9: Resource Inspection

The first line of products.csv is:

product_id,name,price,category

Explain why this line should be inspected before writing the CSV-reading code. [2]

Question 10: Recovery

Near the end, adding image upload breaks the app, but product listing and database insert were working earlier.

Suggest three practical recovery actions before submission. [3]

Review Checklist

After attempting these questions, check whether you can:

  • extract requirements from a practical task;
  • plan tests from unit level to final dry run;
  • interpret file, conversion, and database errors;
  • explain why resource inspection matters before coding;
  • prepare a practical submission without breaking working features.