4th Form Name: PREP Computer Science Date: 10/10/2023 Marks: / 25 L.O: Decomposition & Abstraction. Trace tables Computational thinking: thinking like a computer scientist. It’s all about the steps you take to find the best solution to a complex problem. Computer scientists rely on decomposition, abstraction and algorithmic thinking to help them turn a complex problem into small problems that a computer can help them to solve. Decomposition: breaking a complex problem down into smaller problems and solving each one individually. Abstraction: picking out the important bits of information from the problem, ignoring the specific details that don’t matter. Algorithmic thinking: a logical way of getting from the problem to the solution. If the steps you take to solve a problem follow an algorithm, then they can be reused and adapted to solve similar problems in the future. Questions You have been asked to produce an algorithm that calculates the approximate cost of a car journey for four adults of average weight in a 1.4 litre blue Ford Fiesta (2012). 1. Decompose the problem into a series of sub-problems and list those subproblems below. [5] Abstract information that is not relevant and list the information below. [3] 2. Produce an algorithm using a flowchart or pseudocode that calculates the cost of the journey. [5] Trace tables: Trace tables are tables that consist of columns. Each column can represent a variable, a condition, or an output. Not every variable, condition or output in an algorithm needs a column in a trace table. The purpose of the table is that we can run through an algorithm and simulate what a computer would do if the program were to execute. We complete the table to show how the variables change, what the conditions would resolve to, and/or what outputs would be displayed. There are two main reasons that trace tables are used. The first is to determine what an algorithm does by running through it to see what happens as the algorithm runs. The second is to test the logic of an algorithm if there are errors that are not easily spotted. Questions Complete the trace tables: FOR x 1 TO 3 x y Output FOR y 1 TO 2 OUTPUT ( x * y ) ENDFOR ENDFOR [6] x1 WHILE x < 5 OUTPUT (x*2) x xx+1 ENDWHILE OUTPUT "The end" [6] x<5 Output