CS 2.1 Elements of Computational Thinking

0.0(0)
Studied by 0 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/41

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 3:26 PM on 9/3/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

42 Terms

1
New cards

What is abstraction, in computational thinking?

The process of removing unnecessary details of a problem to focus on the important features needed to implement a solution

2
New cards

Why is abstraction necessary when creating a computational solution to a real-world problem?

The real world is highly complex with far too many variables to model directly; removing irrelevant detail makes a problem manageable and lets a computer process only what actually matters to solving it

3
New cards

What is the difference between an abstraction and reality?

Reality includes every variable and detail of a situation, however small; an abstraction deliberately strips away detail that is irrelevant to the specific problem being solved, keeping only what's needed

4
New cards

*Using the London Underground map as an example, explain why the map is a useful abstraction rather than a geographically accurate map

Travellers only need to know that getting on at stop A will eventually get them to stop B; the actual geographical layout, distances and curves of the tracks are irrelevant to this need, so removing them makes the map clearer and easier to use

5
New cards

*Explain how a road map for a satnav is an abstraction of a real city

Unnecessary detail such as buildings and greenspace is removed, leaving only roads and junctions; junctions can be represented as graph nodes and roads as weighted edges, allowing algorithms like Dijkstra's or A* to be applied to find routes

6
New cards

What four questions should be asked when devising an abstract model for a situation?

What is the specific problem to be solved? Can it be broken into milestones? What elements impact the solution for each milestone? Would removing a given element change the solution?

7
New cards

Give three questions a chair game/sports simulator abstraction model would need to answer

Any three of: Is gravity taken into account? Is air resistance/friction modelled? How closely does the simulation need to resemble reality? What level of detail is required for the intended purpose?

8
New cards

What is programming language abstraction, and what is machine code an example of?

Programming languages abstract away the complexity of controlling hardware directly; machine code (binary) is the lowest level, with no abstraction — every instruction must be written as raw 0s and 1s

9
New cards

How does assembly language abstract away detail compared to machine code, and what is its main limitation?

It uses mnemonics (e.g. ADD) to represent groups of binary digits, making programs quicker and less error-prone to write; its limitation is that each processor family has its own instruction set, so programs must be rewritten to run on a different type of processor

10
New cards

How do high-level languages (e.g. Python) abstract away detail compared to assembly language?

They let a single, short instruction (e.g. A = B*C) represent what would take many lines in assembly, and hide how data is stored in memory or how instructions run on the processor, letting developers focus on solving the problem itself

11
New cards

What is data abstraction, and give an example?

Hiding the underlying implementation details of how a data type is stored and represented, so a programmer can use it without needing to know the details; e.g. a programmer using a queue only needs to know they can add/remove data, not that underneath it is implemented using arrays, bytes, bits and flip-flops

12
New cards

An algorithm's inputs and outputs form part of what wider consideration in computational thinking?

Its preconditions — the conditions that must be true for the algorithm to run and complete successfully

13
New cards

What information should be explicitly defined about an algorithm's inputs and outputs before writing it?

Their type, size, and format (e.g. for a search algorithm: what data type are the elements, how many elements, is the array sorted, and what does the output represent — a value, a boolean, an index, or nothing?)

14
New cards

What is a precondition, in the context of an algorithm?

A condition that must be true before an algorithm is run, in order for it to complete successfully without errors or crashing

15
New cards

Give an example of a precondition for a binary search algorithm, and explain why it matters

The list supplied must already be in order — if an unordered list is passed to a binary search, it will fail to execute correctly, since the algorithm's logic relies on being able to eliminate half the remaining list at each step based on order

16
New cards

What are the benefits of explicitly specifying an algorithm's preconditions in its documentation?

The developer calling the subroutine knows in advance what checks they need to carry out before calling it; it avoids the subroutine itself needing to carry out extra validation code; and it allows the subroutine to be reused reliably, including being placed in a shared library

17
New cards

What is caching, in computational thinking?

Storing frequently used data and instructions in a small area of fast storage (cache) close to the processor, so that program execution can access them more quickly than repeatedly fetching from slower memory

18
New cards

Give one benefit of caching outside of CPU cache, such as web caching

Storing recently viewed HTML pages/images locally means they don't need to be re-downloaded each time they're accessed, giving faster access and saving bandwidth

19
New cards

Why are reusable program components (e.g. subroutines in a library) useful?

Common tasks (e.g. printing, casting, finding a maximum value, generating random numbers) can be written once, thoroughly tested, and documented, then reused across multiple projects — saving development time and reducing the risk of bugs compared to rewriting the same logic repeatedly

20
New cards

What does it mean to "identify the components of a problem"?

Abstracting away unimportant detail from the real-world problem and identifying the specific elements that will actually form part of the solution

21
New cards

*A teacher wants software to calculate grades for several classes over a year — give two questions that would help identify the components of this problem

Any two of: How many classes/students are there? What are the possible grades a student could achieve? How many assessments need to be considered? Are assessments split into difficulty categories?

22
New cards

What does it mean to "identify the components of a solution"?

Once the components of the problem are known, working out the matching technical elements needed to build a solution — e.g. what data types, data structures, libraries, and program constructs will be required

23
New cards

What is decomposition, and what is one common method used to carry it out?

Breaking a problem down into smaller, more understandable, and more easily solved sub-problems; a common method is top-down design

24
New cards

What is top-down design?

A method of decomposition where a problem is broken into major tasks, and those major tasks are broken into smaller sub-tasks, repeating until each sub-task can be solved with a single subroutine or module that cannot sensibly be broken down further

25
New cards

Give two advantages of decomposing a problem into sub-problems (subroutines)

Any two of: each subroutine is simpler to test and maintain (e.g. via unit testing), self-contained and well-documented code is easier to debug, tasks can be delegated to different developers, and subroutines can be reused rather than rewritten

26
New cards

What is a hierarchy chart, and what is it used for?

A diagram (in the form of a tree structure) used to show how a problem has been decomposed into subproblems, and how the resulting modules/subroutines relate to each other

27
New cards

Why are diagrams like hierarchy charts often preferred over lists or tables for decomposing larger problems?

Lists and tables quickly become cumbersome and hard to follow as a problem grows in complexity, whereas a diagram like a hierarchy chart makes the relationships between sub-problems clear and easy to follow at a glance

28
New cards

Name the three structured programming techniques used to control the flow of a program

Sequence (one statement after another), selection (decision making, e.g. if/then/else or switch/case), iteration (loops, e.g. for/while/do)

29
New cards

Why is it good practice for each block of code in structured programming to have a single entry and exit point?

It prevents unintended consequences relating to flow of control, such as leaving a subroutine early, entering it unexpectedly, or branching unintentionally, which makes programs harder to understand and debug

30
New cards

Why might a flowchart or pseudocode be used before writing code in a specific programming language?

It allows the algorithm/decision points to be planned and checked independently of a specific language's syntax; flowcharts show flow of control visually (though are time-consuming to create), while pseudocode mimics program constructs without needing correct syntax

31
New cards

Where in a program do decision points ("where a decision has to be taken") typically occur?

In selection structures (e.g. if statements, switch/case) and in iteration structures (e.g. while loops), wherever a Boolean condition determines what happens next

32
New cards

Why is care especially needed when constructing Boolean conditions with multiple clauses (e.g. combining AND/OR/NOT)?

Most programming errors occur when evaluating Boolean conditions, and long/complex conditions involving multiple clauses are especially error-prone if not carefully constructed and tested

33
New cards

How do decisions affect the flow of control through a program?

Each decision point (in an if/else, switch/case, or loop condition) directs the program down a different path of statements depending on whether the Boolean condition evaluates to true or false, meaning different code executes for different inputs

34
New cards

*In a program checking "if age >= 15 AND money >= 8 then entry = True", what are the logical conditions affecting the outcome?

Two conditions must both be true simultaneously (an AND condition): the age must be at least 15, and the money must be at least 8; if either condition is false, entry remains false

35
New cards

What is the difference between concurrent computing and parallel computing?

Concurrent computing runs multiple processes/tasks on a single processor by giving each a fraction of time before swapping to another; parallel computing runs multiple processes genuinely at the same time across multiple processor cores

36
New cards

*Why does concurrent processing on a single core appear simultaneous to a human user, even though it isn't?

Because the processor swaps between tasks extremely quickly (microsecond timeslices), and human information-processing speed is far too slow to notice the switching, so the effect looks simultaneous even though execution is actually sequential

37
New cards

What is a dependency, in the context of deciding whether tasks can be tackled at the same time?

A relationship where one task relies on another task starting or completing before it can begin, meaning dependent tasks cannot be run in parallel (e.g. a roof cannot be built until the walls are finished)

38
New cards

When can parts of a problem be run in parallel across multiple cores?

When the datasets or tasks involved do not rely on, relate to, or interact with each other (i.e. have no dependencies), allowing them to be processed independently and simultaneously

39
New cards

Give one advantage and one disadvantage of concurrent processing

Advantage: increases program throughput, since more tasks make progress within a given timeframe (e.g. ten tasks half-finished rather than two fully finished). Disadvantage: if many processes require heavy computation, each is allocated only a timeslice, so all of them take longer to fully complete

40
New cards

Give one advantage and one disadvantage of parallel processing

Advantage: significantly speeds up repetitive calculations on large datasets (e.g. image/video editing) by splitting the work across multiple processors. Disadvantage: processors running simultaneously may need to communicate with each other, introducing overhead and delays

41
New cards

*Why might a video game use concurrent processing for background tasks like loading assets while the main game loop keeps running?

It allows the game to keep responding to user input and rendering frames smoothly, while other tasks (like loading the next level's assets) are given smaller timeslices in the background, avoiding the whole game freezing while it waits for a slower task to complete

42
New cards

*Why might a video editing application use parallel processing rather than concurrent processing when rendering a final video?

Rendering large amounts of repetitive frame-by-frame calculation benefits from being split genuinely simultaneously across multiple processor cores, since the frames don't depend on each other and true parallelism gives real speed gains, unlike concurrency which only gives the appearance of simultaneity on a single core