Unit 2.1 - Elements of Computational Thinking Flashcards

1
Q

What is abstraction?

A

Hiding unnecessary detail and showing details that are important in context in order to reduce complexity.

A representation of reality, using symbols to show real-life features or irrelevant features left out. ​

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Why is it necessary to use abstraction?

A
  • Irrelevant details to the problem would require unnecessary programming/design effort (and could detract from the main program.
  • Reduces complexity
  • Highlight the important details to improve the clarity of what is being conveyed.​
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is procedural abstraction?

A

The process of breaking down a complex problem into smaller, more manageable (and essential) steps.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is functional abstraction?

A

The details of a function’s implementation are suppressed and show only the output provided by the function.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is data abstraction?

A

The reduction of a particular body of data to a simplified representation of data that separates the interface from the implementation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is problem abstraction?

A

The process of taking away or removing certain characteristics of a complex problem to reduce it to its most essential components.

This helps to simplify or break down the problem to make it easier to resolve.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is an input?

A

The signals or data, received by the system, that it needs to process.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is an output?

A

The result of an activity carried out after data has been processed which the system produces.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a precondition?

A

A condition that already exists and should be taken into consideration before devising a solution to a problem (or a program).

They often impose sensible restrictions - and sometimes very frustrating and essential ones.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What types of blocks of code can be reused multiple times?

A
  • Procedures
  • Subroutines
  • Functions
  • Methods
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is caching?

A

Frequently used instructions/data retrieved and placed from main memory to cache in case they are needed again before the program using them ends.​

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is prefetching?

A

Data being requested from main memory (RAM) by the processor before it is required.​

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How are flowcharts an abstraction?

A

They are an abstraction of program code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How are assignments an abstraction?

A

An assignment is a statement to set a value to a variable.
Variables are labels to where the value is stored, but the actual value is stored in binary.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Why is thinking ahead essential when designing a program?

A
  • Maximise code efficiency
  • Minimise errors
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are the first tasks to do when designing a program?

A
  • Decide the output the system should produce.
  • Decide what the inputs are.
  • Consider about any preconditions.
  • If any parts of the code can be reused.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What are 3 types of input devices?

A
  • Microphone
  • Mouse
  • Keyboard
  • Camera
  • Phone/computer
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What are 3 types of output devices?

A
  • Speakers
  • Screen
  • Printer
  • Monitor
  • GPS
  • Headphones
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What is considered a computer?

A

A device that takes in user input, processes the data and outputs it into an understandable format for humans.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Why are preconditions important?

A
  • They impose sensible restrictions (sometimes very essential ones)
  • They will have implications on certain factors (time, money and overall result produced etc)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What are the benefits of reusing code?

A
  • Shortens development time
  • Saves systems resources
  • Lowers development costs
  • Reduces redundant code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What is redundant code?

A

Source code that has no logical affect to the output (unnecessary code ).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What is code-reuse?

A
  • Reusing existing sections of code that have been tested by a previous developer
  • Reusable components can- and should be - reused during the development of newer programs
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What are 4 ways that code can be reused?

A
  • Modular programming
  • Software library (library routines)
  • Using entire components across program suites
  • External reuse
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

What is modular programming?

A

A concept where developers separate program functions into independent pieces, and each piece contains all of the necessary parts to execute one aspect of functionality.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

What is a subroutine?

A

A block of code that performs a specific task and can be reused multiple times by calling it and supplying it with data it needs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

What are three types of subroutines?

A
  • Procedures
  • Functions
  • Methods
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

What is a software library?

A

A suite full of pre-written and pre-tested code available for other programmers to develop software programs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

What is a library routine?

A

A small block of debugged code that can be used in programs to perform specific tasks (usually functions).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

What are the benefits of library routines?

A
  • Already compiled = tested and error free
  • Shortens development time and reduces costs
  • Can be reused multiple times
  • May have been written in different source language
  • Allows use of other programmers’ expertise
  • More standardised approach to coding
  • May require fewer developers to work on a project
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

What are the benefits of using entire components across program suites (e.g. Office 365)?

A
  • Products have a similar look and feel.
  • Quicker to master
  • User feels more comfortable with additional products in suite
  • User becomes more productive
32
Q

What is external reuse?

A

Reselling components off to a third party - international tech companies offer integration with other programs and software programs, allowing the user to use certain programs and systems to log onto platforms.

33
Q

Why is caching beneficial?

A

Results in faster retrieval times, as instructions or data don’t need to be fetched from secondary storage, which is much slower.​ ​

34
Q

How is prefetching implemented into algorithms?

A

Clever algorithms need to be designed to predict – with a high degree of certainty – that an instruction or piece of data will be required soon.​

34
Q

How is caching involved with retrieving web pages?

A
  • Every time a user loads a webpage, their browser has to download quite a lot of data in order to display it
  • Browsers cache most of the content that appears and saves a copy into the cache
  • So the next time the user loads the page, most of the content is already stored locally and the page will load much more quickly
35
Q

What are the advantages of caching?

A

Improving speed and efficiency

36
Q

What are the disadvantages of caching?

A
  • Introduces inconsistency - cached data may not reflect the latest changes on the server
  • Introduces complexity - web application needs to manage the cache expiration, validation, and invalidation policies
  • The wrong data is often fetched and cached and subsequently has to be flushed
  • Maintaining the correct sequence of instructions or data items in these circumstances can be problematic
  • Storage consumption
37
Q

What does it mean to think procedurally?

A

The computational skill of breaking down a problem, identifying a number of smaller sub-problems and being able to determine the order of events in a solution.

38
Q

How is a top-down modular design made?

A
  • Start with the general task the program needs to perform
  • That task is then split into smaller sub-tasks
  • Each of these sub-tasks can be split up into even smaller sub-tasks if necessary
39
Q

What is step-wise refinement?

A

A problem-solving technique that involves breaking down a complex problem into smaller, more manageable subproblems.

The technique is also known as top-down design.

40
Q

Why are top-down designs used?

A

The aim is to end up with sub-tasks that perform a single function or task and can be tackled as small, largely independent modules.​

41
Q

What are the advantages of step-wise refinement?

A
  • Parts of the solution may end up being reusable elsewhere
  • Breaking down a problem helps programmers work out what needs to be done
  • Breaking a problem enables more than one person to work on the solution at a time
  • With each additional step, new parts become less complicated
42
Q

After using stepwise refinement, what needs to be done next in the process?

A

Identifying the components to the solution.

43
Q

What happens after you identify the components to a solution?

A

Working out the order of the steps needed to take in order to solve a problem.​

44
Q

What is an event driven program?

A

A computer programming paradigm in which the flow of the program is determined by the occurrence of events (e.g. user inputs from mice, keyboards or or sensors).

They respond to events using event handlers - code that is triggered when the event occurs.

45
Q

What examples of situations can the order steps required be largely predetermined?

A
  • Constructing a house
  • A calculator (turn on, number, operation, another number, equals)
  • Backup utility
  • Food shop in a supermarket
46
Q

What examples of situations can’t the order steps required be largely predetermined?

A
  • Operating system
  • Role-playing video game
  • Smartphone software
  • Word processing software
47
Q

What are some techniques used to lay out the steps to a problem?

A
  • Flowcharts
  • Stepwise refinement
48
Q

What does it mean to think logically?

A

The computational skill of identifying the points at which a decision is needed, the conditions of those decisions and determining the next steps depending on the outcome of the decisions.

49
Q

What does it mean to think abstractly?

A

Abstraction is representing essential features without including the details that are not necessary.

50
Q

What does it mean to think ahead?

A

The computational skills of identifying the preconditions of a system, the inputs, outputs and reusable components.

51
Q

What does it mean to think concurrently?

A

The computational skill of identifying if parts of a problem can be tackled at the same time, and which parts are dependent on one another.

52
Q

What happens after breaking down the problem down into its individual components?

A
  • Having breaking it down, we can take the tasks on the structure diagram and turn them into a set of functions and procedures.​
  • Each task will need to be coded up by a programmer, who would add the functionality required to make that module work.​
  • Also we can identify any parameters needed for each module and any values returned (for functions)
53
Q

What is an advantage to identifying sub-procedures required to solve a problem?

A
  • Becomes easier to spot if a module that performs any of these tasks already exists.
  • If there is an existing module, it could be reused or customized, saving developers time and money.​
54
Q

What is a Boolean expression?

A

A statement in programming that represents a decision.

It can evaluate to either TRUE or FALSE.

Typically, a Boolean expression may be evaluated as part of a selection statement, causing your code to branch (e.g. IF … THEN)​

55
Q

When could you use an IF statement?

A

If the decision is a true or false situation which results in branching in one or two directions.

56
Q

When could you use a WHILE/FOR/Do UNTIL loop?

A

If the decision that will cause a loop to be entered or exited.

57
Q

When could you use a SELECT/SWITCH CASE statement?

A

If the decision has multiple selection paths (e.g. menu selection from A to D).

58
Q

What does concurrency mean?

A

When an application is making progress on more than one task at the same time.

59
Q

What is a single-threaded program?

A
  • A program that contains the execution of instructions in a single sequence
  • There is a single point of execution at any given time where one command is processed at a time without the interruption of another thread.
60
Q

What is a multiple-thread program?

A

A program that can execute multiple commands at a time, allowing it to perform multiple tasks concurrently.

61
Q

What are the steps to thinking concurrently?

A
  • Determine which parts of the problem can be developed to take place at the same time and which parts are dependent on others
  • Outline the benefits and trade-offs that might result from concurrent processing in a particular situation.
62
Q

How is concurrency applied to Python?

A
  • Python has a global interpreter lock that limits a program to a single processor at a time
  • It will run for a slice of time with one thread then pause and switch to executing the other thread for another slice of time
  • This happens so fast it appears the threads are running simultaneously.
63
Q

What is the difference between concurrency and parallelism?

A
  • A system is concurrent if it can support two or more tasks in progress at the same time
  • Dealing with lots of things at once
  • A system is said to be parallel if it can support two or more actions executing simultaneously.
  • Doing lots of things at once
64
Q

How does concurrency work in a computer?

A

In a computer with a single processor, several running processes are each given a slice of the processor time in turn.

This provides the illusion of several tasks being performed simultaneously due to the speed processors operate at.

This is handled by scheduling algorithms.

65
Q

How does parallelism work in a computer?

A

In a computer, an application splits its tasks into subtasks which can be processed in parallel - over multiple CPU cores simultaneously.

This means that multiple parts of a task/multiple tasks are physically executing at the same time by making use of multicore or multi-processor infrastructure.

This can happen with specialized processors (GPUs).

66
Q

What are the benefits of concurrent processing?

A
  • Controllability
  • Availability of services
  • Reactive programming
  • Parallelism
67
Q

What are the trade-offs of concurrent processing?

A
  • Safety
  • Resource consumption
  • Liveliness
  • Non-determinism
68
Q

How is reactive programming a benefit of concurrent processing?

A

A user should be able to interact with applications whilst other programs are running in the background.

Virtually all operating systems are built like this to support many concurrent processes.

69
Q

How is availability of services a benefit of concurrent processing?

A

Long running tasks won’t delay short running ones.

Web browsers use this concept all of the time - the entry page to a new website could be served to the browser in parts, with texts and images loading before video content has arrived.

70
Q

How is parallelism a benefit of concurrent processing?

A

Complex programs can make better use of multiple resources in multi-core processor systems.

Parallel processing is a specialized form of concurrency where different, independent tasks are able to physically run and execute simultaneously.

71
Q

How is controllability a benefit of concurrent processing?

A

Tasks requiring certain preconditions can suspend and wait until the preconditions hold, then resume execution transparently.

72
Q

How is liveliness a trade-off of concurrent processing?

A

Tasks should not suspend and then wait for each other indefinitely - this situation is known as deadlock - something that databases experience often (only one person can edit a database at a time but the others who have access are locked out).

This can occur more easily with many concurrent processes or operations occurring at once.

73
Q

How is safety a trade-off of concurrent processing?

A

Concurrent tasks shouldn’t be allowed to corrupt the consistent state of a program, by causing unexpected behavior or errors.

These safety concerns include deadlocks, starvation and race conditions.

74
Q

How is resource consumption a trade-off of concurrent processing?

A

Threads can consume resources.

Multi-threading is possible due to concurrency, but threads can be expensive.
There are overheads to consider when it comes to the scheduling of multiple threads, context-switching and synchronization.

If designed poorly, concurrent programs could run slower than their sequential counterparts even with multiple CPU cores.

75
Q

How is non-determinism a trade-off of concurrent processing?

A

Concurrent programs are often non-deterministic - they will give different results depending on the precise timing of events.

This is often the case in transactions.

76
Q

What are the two biggest reasons for concurrent processing (with the benefits into consideration)?

A
  • The number of tasks completed in a given time is increased
  • The time wasted by the processor waiting on a user or another process is reduced.