FreeMaster degree preparationMCQStructural

Master's Preparation – Database Systems – Practice Set

Exam
University degree preparation
Year
2026 · Practice
Level
Master entrance / M1
Duration
60 min
marks
30

Source: Original Ngahtech practice set for Master's entrance preparation.

Answer all questions. Show your reasoning.

  1. Question 1MCQ5 marks

    A relation is in Third Normal Form (3NF) if it is in 2NF and:

    • A. it has no multivalued attributes
    • B. no non-key attribute depends transitively on the key
    • C. every determinant is a candidate key
    • D. it has a single-column primary key

    🤖 Ask the AI tutor

    Show answer & explanation

    Correct answer: B. no non-key attribute depends transitively on the key

    Explanation

    3NF removes transitive dependencies of non-key attributes on the key. Option C describes BCNF.

  2. Question 2MCQ5 marks

    Which isolation anomaly occurs when a transaction reads data written by another transaction that later rolls back?

    • A. Phantom read
    • B. Dirty read
    • C. Lost update
    • D. Non-repeatable read

    🤖 Ask the AI tutor

    Show answer & explanation

    Correct answer: B. Dirty read

    Explanation

    Reading uncommitted data that is later rolled back is a dirty read.

  3. Question 3Structural20 marks

    Table ORDERS(order_id, customer_id, customer_name, customer_town, product_id, product_name, qty, unit_price).

    (a) List the functional dependencies and normalise the table to 3NF. [12]

    (b) Write an SQL query returning each town's total sales amount, highest first. [8]

    🤖 Ask the AI tutor

    Show answer & explanation

    Marking scheme

    (a) FDs: customer_id → name, town; product_id → product_name, unit_price; (order_id, product_id) → qty (4). Tables CUSTOMER, PRODUCT, ORDER, ORDER_LINE with correct keys (8).

    (b) Correct joins (3), SUM(qty × unit_price) (2), GROUP BY town (2), ORDER BY DESC (1).

    Model answer

    SELECT c.town, SUM(l.qty * p.unit_price) AS total
    FROM order_line l
    JOIN orders o ON o.order_id = l.order_id
    JOIN customer c ON c.customer_id = o.customer_id
    JOIN product p ON p.product_id = l.product_id
    GROUP BY c.town
    ORDER BY total DESC;