Skip to topic
    ← Back to course topics

    Mathematics — WJEC A-Level Computer Science

    Test yourself on Mathematics with WJEC A-Level practice questions.

    Start free

    7 days Premium · Then free forever · No card, no charge

    Mathematics explained

    This subtopic covers the fundamental mathematical concepts of number and algebra as applied to computer science, including number systems (binary, hexadecimal), arithmetic operations, and algebraic manipulation.

    Read the full explanation

    It underpins data representation, logic, and algorithmic problem-solving, providing the essential toolkit for computational thinking and programming.

    Your focus

    1. Convert between decimal, binary, and hexadecimal number systems
    2. Perform binary arithmetic including addition, subtraction, and multiplication
    3. Apply algebraic techniques to solve equations and simplify expressions
    Show all 5 objectives
    1. Use Boolean algebra to simplify logic circuits and expressions
    2. Analyze algorithms using mathematical concepts such as sequences and series

    Mathematics exam tips

    Quick Revision Summary (Key Takeaway)

    Mathematics in Computer Science (WJEC-CBAC A-Level) covers the mathematical foundations required for computational thinking, including Boolean algebra, number systems, graph theory, and algorithms. This topic is essential for understanding how computers process data, optimize solutions, and model real-world problems, and it underpins many aspects of programming and system design.

    Topic Overview

    Mathematics in Computer Science is a fundamental topic that bridges the gap between abstract mathematical concepts and their practical applications in computing. For WJEC-CBAC A-Level students, this includes number systems (binary, hexadecimal, two's complement), Boolean algebra, graph theory, and the analysis of algorithms. These topics are not just theoretical; they are used daily in programming, data representation, and problem-solving.

    Understanding this material is crucial because it forms the basis for many other areas of computer science, such as data structures, cryptography, and machine learning. For example, Boolean algebra is essential for designing logic circuits and writing efficient conditional statements, while graph theory underpins network routing and social media algorithms. Mastery of these concepts will not only help you in exams but also in your future studies and career.

    In the WJEC-CBAC A-Level specification, this topic is assessed through a mix of short-answer questions, calculations, and longer structured questions. You will be expected to apply your knowledge to unfamiliar scenarios, so it's important to practice a variety of problem types. The key is to understand the underlying principles rather than memorising procedures, as examiners often test your ability to adapt your knowledge.

    Key Concepts
    • →Number systems: binary, denary, hexadecimal, and conversions between them, including binary arithmetic and two's complement for negative numbers.
    • →Boolean algebra: logic gates, truth tables, and simplification using laws (commutative, associative, distributive, De Morgan's).
    • →Graph theory: vertices, edges, weighted graphs, adjacency matrices, and algorithms like Dijkstra's and Prim's.
    • →Algorithm complexity: Big O notation, time and space complexity, and comparing algorithm efficiency.
    • →Set theory and logic: sets, subsets, Venn diagrams, and logical operators (AND, OR, NOT) as used in programming.
    Marking Points
    • Award credit for accurate conversion between number bases with clear working
    • Award credit for correct binary arithmetic operations and handling of overflow
    • Award credit for correct algebraic manipulation and solving of equations
    • Award credit for correct application of Boolean algebra laws and simplification
    • Award credit for demonstrating mathematical reasoning in algorithm analysis
    Examiner Tips
    • 💡Practice conversions regularly to build speed and accuracy
    • 💡Always show your working for arithmetic and algebra to gain method marks
    • 💡Learn Boolean algebra laws (commutative, associative, distributive, De Morgan's) and apply them systematically
    • 💡Use substitution to check algebraic solutions
    • 💡Familiarize yourself with common exam question formats, such as converting between bases or simplifying logic expressions
    • 💡Always show your working for calculations, especially in number conversions and algorithm trace tables. Marks are often awarded for method even if the final answer is wrong.
    • 💡When answering questions on graph algorithms, draw the graph and label distances clearly. This helps you avoid mistakes and makes it easier for the examiner to follow your reasoning.
    • 💡For Boolean algebra, memorise the laws and practice applying them. In exams, you may be asked to simplify expressions, so be methodical and write down each step.
    Common Mistakes
    • Confusing binary and hexadecimal place values
    • Incorrectly handling binary addition carry bits
    • Misapplying algebraic rules, e.g., sign errors
    • Forgetting to simplify Boolean expressions fully
    • Not showing working in calculations, leading to loss of method marks
    • Misconception: Two's complement is just inverting bits. Correction: Two's complement is inverting bits and adding 1. For example, -5 in 4-bit is 1011 (invert 0101 to 1010, add 1 to get 1011).
    • Misconception: Dijkstra's algorithm works with negative weights. Correction: Dijkstra's algorithm fails with negative edge weights; use Bellman-Ford instead.
    • Misconception: Boolean algebra is the same as arithmetic. Correction: Boolean algebra uses logical operations (AND, OR, NOT) not arithmetic, and follows different laws like idempotent and absorption.
    Revision Plan
    1. 1Week 1: Focus on number systems. Practice converting between binary, denary, and hexadecimal, and perform binary addition and subtraction using two's complement. Use online quizzes to test speed and accuracy.
    2. 2Week 2: Study Boolean algebra. Learn the laws and practice simplifying expressions. Create truth tables for logic gates and verify your simplifications.
    3. 3Week 3: Dive into graph theory. Understand the terminology and practice implementing Dijkstra's algorithm on paper. Also, learn about adjacency matrices and how to represent graphs.
    4. 4Week 4: Review algorithm complexity. Understand Big O notation and analyse simple algorithms. Practice comparing algorithms and determining their efficiency.
    5. 5Week 5: Consolidate by doing past paper questions. Identify weak areas and revisit those topics. Use active recall to test yourself on key definitions and formulas.
    Exam Question Types
    • 📋Short-answer questions on number conversions: e.g., 'Convert 10110110 from binary to hexadecimal.' Practice these to ensure speed and accuracy.
    • 📋Boolean algebra simplification: e.g., 'Simplify the expression A AND (B OR C) using the laws of Boolean algebra.' Show each step clearly.
    • 📋Graph algorithm trace: e.g., 'Apply Dijkstra's algorithm to find the shortest path from A to D. Show your working.' You will be expected to produce a table of distances.
    • 📋Complexity analysis: e.g., 'State the time complexity of a linear search and explain why it is O(n).' Be prepared to justify your answer.
    Command Word Expectations (WJEC)
    Evaluate

    In WJEC-CBAC A-Level Computer Science, 'Evaluate' requires you to consider the strengths and weaknesses of a concept or algorithm, and make a judgement. For example, 'Evaluate the use of two's complement for representing negative numbers' – you must discuss advantages (e.g., ease of arithmetic) and limitations (e.g., range), and conclude with a reasoned opinion.

    Explain

    You must provide a clear, detailed account of how or why something works. For instance, 'Explain how Dijkstra's algorithm works' – you should describe the steps, including the use of priority queues and distance updates, and justify why it finds the shortest path.

    Calculate

    You must perform a mathematical computation and show your working. For example, 'Calculate the two's complement representation of -27 in 8 bits' – you need to show the binary conversion, inversion, and addition of 1, and present the final binary number.

    How Students Lose Marks (Examiner Pitfalls)
    Pitfall: Students often confuse the order of operations in Boolean algebra, especially when applying De Morgan's laws, leading to incorrect simplification of expressions.
    ❌ Weak Answer (Loses Marks):Simplify A AND (B OR C) to (A AND B) OR (A AND C) but then incorrectly apply De Morgan's law to get (A OR B) AND (A OR C).
    Example improved answer:To simplify A AND (B OR C), apply the distributive law: A AND (B OR C) = (A AND B) OR (A AND C). This is correct. De Morgan's law is used for negations: NOT (A AND B) = (NOT A) OR (NOT B). Ensure you apply the correct law at the correct step.
    Examiner Tip: Always write down which law you are applying at each step. Practice identifying distributive, associative, commutative, and De Morgan's laws in different expressions.
    Pitfall: When converting between binary and hexadecimal, students often forget to group bits correctly or misalign the groups, leading to errors in the final answer.
    ❌ Weak Answer (Loses Marks):Convert binary 110110 to hexadecimal by splitting as 110 and 110, giving 66 (incorrect).
    Example improved answer:To convert binary 110110 to hexadecimal, group the bits in fours from the right: 0011 0110. Then convert each group: 0011 = 3, 0110 = 6, so the hexadecimal is 36.
    Examiner Tip: Always pad the leftmost group with leading zeros to make a full group of four. Double-check your grouping by counting from the right.
    Step-by-Step Worked Solutions

    Question: A computer system uses 8-bit two's complement to represent integers. Convert the decimal number -45 to 8-bit two's complement and then add it to 23 (also in 8-bit two's complement). Show your working and state the result in decimal.

    1. 1.Step 1: Convert 45 to binary: 45 = 00101101 (8-bit).
    2. 2.Step 2: Invert the bits: 11010010.
    3. 3.Step 3: Add 1: 11010011. So -45 in two's complement is 11010011.
    4. 4.Step 4: Convert 23 to binary: 23 = 00010111.
    5. 5.Step 5: Add the two binary numbers: 11010011 + 00010111 = 11101010 (ignore overflow).
    6. 6.Step 6: Convert the result back to decimal: Since the leftmost bit is 1, it's negative. Invert bits: 00010101, add 1: 00010110 = 22, so result is -22.
    Final Answer: -22

    Question: Given the graph with vertices A, B, C, D and edges (A-B, weight 4), (A-C, weight 2), (B-C, weight 1), (B-D, weight 5), (C-D, weight 3). Apply Dijkstra's algorithm starting from A to find the shortest path to D. Show the table of distances at each step.

    1. 1.Step 1: Initialise distances: A=0, B=∞, C=∞, D=∞. Unvisited set: {A,B,C,D}.
    2. 2.Step 2: Visit A. Update neighbours: B=4, C=2. Mark A visited.
    3. 3.Step 3: Visit C (smallest unvisited distance). Update neighbours: B=min(4,2+1)=3, D=2+3=5. Mark C visited.
    4. 4.Step 4: Visit B (distance 3). Update D: min(5,3+5)=5 (no change). Mark B visited.
    5. 5.Step 5: Visit D (distance 5). No updates. Mark D visited.
    6. 6.Step 6: Shortest path to D is 5 via A-C-D.
    Final Answer: Shortest path from A to D is 5 (A-C-D).
    Active Recall Memory Test
    What is the two's complement representation of -1 in 8 bits?
    Key Fact: 11111111
    State De Morgan's laws in Boolean algebra.
    Key Fact: NOT (A AND B) = (NOT A) OR (NOT B) and NOT (A OR B) = (NOT A) AND (NOT B).
    What is the time complexity of binary search?
    Key Fact: O(log n)
    Define a weighted graph.
    Key Fact: A graph where each edge has a numerical value (weight) representing cost, distance, or capacity.
    Frequently Asked Questions
    How do I convert a negative decimal number to binary using two's complement?
    To convert a negative decimal number to two's complement, first write the absolute value in binary (using the required number of bits). Then invert all the bits (change 0s to 1s and vice versa). Finally, add 1 to the result. For example, to get -5 in 8 bits: 5 is 00000101, invert to 11111010, add 1 to get 11111011. This representation allows for easy binary addition and subtraction.
    What is the difference between a graph and a tree?
    A graph is a set of vertices connected by edges, and it can contain cycles. A tree is a special type of graph that is connected and acyclic (no cycles). In computer science, trees are used for hierarchical data, while graphs are used for networks. For example, a family tree is a tree, while a map of roads is a graph.
    Why is Big O notation important in computer science?
    Big O notation describes the efficiency of an algorithm in terms of time or space as the input size grows. It helps you compare algorithms and choose the most efficient one for a given problem. For example, a linear search is O(n) while a binary search is O(log n), so binary search is much faster for large datasets. Understanding Big O is crucial for writing scalable code.
    How do I simplify Boolean expressions for exams?
    To simplify Boolean expressions, you need to know the laws of Boolean algebra, such as commutative, associative, distributive, identity, and De Morgan's laws. Practice applying these laws step by step. For example, to simplify A AND (B OR C), you can use the distributive law to get (A AND B) OR (A AND C). Always check if you can apply the identity law (A AND 1 = A) or the null law (A OR 1 = 1) to reduce further.
    What is Dijkstra's algorithm used for?
    Dijkstra's algorithm finds the shortest path from a starting node to all other nodes in a weighted graph with non-negative weights. It is used in GPS navigation, network routing, and many other applications. The algorithm works by repeatedly selecting the unvisited node with the smallest known distance, updating the distances of its neighbours, and marking it as visited.
    Can I use a calculator in the WJEC-CBAC A-Level Computer Science exam?
    Yes, you are allowed to use a calculator in the exam, but you should not rely on it for everything. You will need to show your working for conversions and calculations, so use the calculator for arithmetic but write down the steps. Also, some questions may require you to perform binary arithmetic, which you should be able to do manually.