← QCE Digital Solutions Unit 4

Back-end sub-system

The server side of a system that processes requests, applies business rules and stores data in databases, hidden from the user. The front-end displays results.

Understanding Back-end sub-system in QCE Digital Solutions Unit 4

What it does: This back-end rule checks the order against the stock held on the server and rejects it if the rule is broken, which is business logic. Security checks must run on the server. Code in the browser can be viewed and changed by the user, so it cannot be trusted. The back-end runs on the server and is hidden from the user. The user only sees what the server sends back, such as a web page or JSON data.

Common mistakes: A single = assigns a value, so it cannot be used in a condition. The back-end should test the password check with if check(user, pw): (or == True). The business rule is to reject an order when the quantity is MORE than the stock. The condition should be if qty > stock:, otherwise valid orders are refused.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 89–125) and word search (Modules 17–125).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Which part of a web system stores data in a database and applies business rules?
The back-endThe front-end
Matches
Back-end code runs in the user's browser so the user can see and edit it
↓
The back-end runs on the server and is hidden from the user. It is the front-end code that runs in the browser and can be seen.
Applying
Meanings
Term
back-end
Meaning
The server side of a system that processes requests, applies business rules and stores data in databases, hidden from the user. The front-end displays results.
Practice
database = {"ava": 120, "liam": 95}
Testing
Gaps
@app.("/login", methods=["POST"])
Check Answer
Spots
3 pw = request.pw
4 if check(user, pw) = True:

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Manta Ray' badge — Graceful Coder, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Which part of a web system stores data in a database and applies business rules?
A. The back-end ✓
B. The front-end
The back-end is the server side. It processes requests, applies business logic and stores data. The front-end only displays results and collects input.
2. A student logs in to a school portal. Where is the password checked against the stored hash?
A. In the user's browser (front-end)
B. On the server (back-end) ✓
Security checks must run on the server. Code in the browser can be viewed and changed by the user, so it cannot be trusted.
3. True or false: the user can see the back-end code and database directly while using a website.
A. False: the back-end is hidden from the user ✓
B. True: the back-end is visible in the browser
The back-end runs on the server and is hidden from the user. The user only sees what the server sends back, such as a web page or JSON data.
4. An online shop rejects an order because the quantity is more than the stock. What is this an example of?
A. Business logic in the back-end ✓
B. Page layout in the front-end
A business rule such as 'cannot order more than the stock' is applied by the back-end. It checks the database before it accepts the order.
5. Which is a back-end task?
A. Changing a button's colour with CSS
B. Saving a new order to the database ✓
Storing data in a database is done on the server. CSS styling belongs to the front-end, which handles how the page looks.

Match the Pairs

back-end → The server side of a system that processes requests, applies business rules and stores data, hidden from the user
SELECT * FROM students WHERE studentId = 1 → A back-end database query that retrieves one student's stored record
Business logic on the back-end applies the rules of the system before data is saved → if quantity > stock: reject_order()
A server-side security check verifies the user's login on the back-end instead of trusting the front-end → if not is_valid_token(token): return 401
Back-end code runs in the user's browser so the user can see and edit it → The back-end runs on the server and is hidden from the user. It is the front-end code that runs in the browser and can be seen.
Only check the price in the front-end form. The back-end can trust it. → The back-end must never trust data from the front-end. It must run its own server-side checks because a user can change front-end data.

Key Term

back-end
The server side of a system that processes requests, applies business rules and stores data in databases, hidden from the user. The front-end displays results.

Fill in the Blanks

1. @app.route("/login", methods=["POST"]) def login(): return check_user(request.form)
Hint: Type the decorator method that links a URL to a back-end function.
2. rows = db.execute("SELECT * FROM students")
Hint: Type the SQL keyword that reads data from a database table.
3. if quantity > stock: return "Out of stock"
Hint: Type the comparison operator for a business rule that checks whether the order is larger than the stock available.
4. if not user.is_logged_in: return "Access denied", 403
Hint: Type the keyword that reverses a condition, so users who are not authenticated are blocked on the server.
5. db.execute(sql, values) db.commit()
Hint: Type the method name that saves changes permanently in the database.

Spot the Error

Question 1
A def login(request):
B user = request.user
C pw = request.pw
D if check(user, pw) = True:
E return 'Welcome'
F return 'Denied'
Line D — A single = assigns a value, so it cannot be used in a condition. The back-end should test the password check with if check(user, pw): (or == True).
Question 2
A def place_order(qty, stock):
B if qty < stock:
C return 'Not enough'
D return 'Order saved'
Line B — The business rule is to reject an order when the quantity is MORE than the stock. The condition should be if qty > stock:, otherwise valid orders are refused.
Question 3
A def save_score(db, mark):
B db.connect()
C db.insert(results, mark)
D db.close()
Line C — The table name is text, so it must be in quotes. Without quotes, Python looks for a variable called results. It should be db.insert('results', mark).
Question 4
A def get_grades(request):
B if request.logged_in:
C return 'Access denied'
D return grades(request.id)
Line B — This server-side security check is reversed. It would deny logged-in users and let anonymous users through. It should be if not request.logged_in:.
Question 5
A def get_price(item_id):
B row = db.find(item_id)
C price = row['price'] + 1.1
D return price
Line C — The business logic adds 10% GST, which needs multiplication. Adding 1.1 only adds $1.10. It should be row['price'] * 1.1.

Student with a class code? Join your class →