CS Chapter 2 Problem Solving and Theory of Computation

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall with Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/82

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No study sessions yet.

83 Terms

1
New cards

What is computational thinking?

The ability to think logically about a problem and apply techniques to solve it.

2
New cards

What is simulation?

Designing a model of a real system to understand how it works.

3
New cards

What are some uses of simulation?

Amusement park rides, population problems, queueing problems, etc.

4
New cards

What is enumeration?

Listing out all the cases of a problem to find the best possible solution.

5
New cards

How does an anagram solver use enumeration?

It lists out all combinations of a set of letters to find all possible anagrams.

6
New cards

What is trial and error?

Experimenting with different approaches to a problem until a successful one is found.

7
New cards

Give an example of trial and error.

Trying on different shoe sizes to find the perfect fit.

8
New cards

What is a theoretical approach?

Using published knowledge to make an educated guess about how effective a solution is.

9
New cards

Give an example of using a theoretical approach.

Predicting if a biker will clear a ramp using physics and measurements.

10
New cards

What is a creative solution?

Thinking outside the box to solve problems where traditional methods may fail.

11
New cards

Give an example of a creative solution.

Solving trolling issues on Twitter creatively.

12
New cards

What is structured programming?

A method of writing a program using top-down analysis, modularisation, and structured code.

13
New cards

What is top-down analysis?

Breaking down a problem into modules that are easier to solve.

14
New cards

What is modularisation?

Structuring a program into modules that can be organised and reused.

15
New cards

What are the features of structured programming?

Sequence, Selection, Iteration.

16
New cards

What is a sequence?

One or more statements executed one after another.

17
New cards

What is selection?

Choosing an option using IF…THEN…ELSE or CASE statements.

18
New cards

What is iteration?

Repeating a set of steps (looping).

19
New cards

What are the three types of iteration?

Condition tested before loop (WHILE), Count controlled (FOR), Condition tested after loop (REPEAT UNTIL).

20
New cards

What is top-down design?

Dividing a program into modules and sub-tasks, where each performs a single function.

21
New cards

What do hierarchy charts show?

The overall structure of a program.

22
New cards

What does a module shown below another module mean in a hierarchy chart?

It is part of the module above.

23
New cards

How does execution occur in a hierarchy chart?

From left to right at the lowest level component.

24
New cards

Are selection and iteration shown in a hierarchy chart?

No, they are not shown.

25
New cards

Why are structured programs easier to write?

Because large programs are broken into manageable sub-tasks.

26
New cards

Can modules be tested individually?

Yes, each module can be tested on its own.

27
New cards

Can modules be reused?

Yes, they can be reused many times and saved to a library.

28
New cards

How does structured programming speed up development?

Multiple programmers can work on different modules simultaneously.

29
New cards

Are structured programs more reliable?

Yes, they have fewer errors and are easier to test and debug.

30
New cards

Are structured programs easier to maintain?

Yes, they are easier to follow and modify.

31
New cards

Do changes in one module affect others?

No, because each module is self-contained.

32
New cards

Can new features be added easily?

Yes, by adding new modules.

33
New cards

What names should be used for variables?

Meaningful names.

34
New cards

What should be added to explain each module?

Comments.

35
New cards

What should each module do?

Perform a specific task.

36
New cards

How many entry points should selection/iteration structures have?

A single entry point.

37
New cards

How should modules stay self-contained?

By passing parameters and using local variables.

38
New cards

What is an algorithm?

A set of steps to solve a problem.

39
New cards

What are the properties of a good algorithm?

Clear steps, handles valid/invalid inputs, has termination, efficient, and easy to understand.

40
New cards

What tools are used to design algorithms?

Hierarchy charts, flowcharts, pseudocode.

41
New cards

What is insertion sort good for?

Sorting a small number of elements.

42
New cards

How does insertion sort work?

A data item is picked and inserted into the correct position.

43
New cards

How does insertion sort compare to bubble sort?

It has fewer swaps and is faster.

44
New cards

When is bubble sort useful?

When only a small number of items need sorting.

45
New cards

How does bubble sort work?

Items are compared and swapped over multiple passes.

46
New cards

How many passes does bubble sort need?

n-1 passes for n items.

47
New cards

What is merge sort good for?

Sorting large data sets.

48
New cards

How does merge sort work?

It splits values and merges them in order.

49
New cards

How fast is merge sort compared to other sorting algorithms?

Much faster for large data sets.

50
New cards

How does linear search work?

It checks each item from the start of the list (brute force).

51
New cards

Does linear search require a sorted list?

No.

52
New cards

How efficient is linear search for large data sets?

It can be very slow.

53
New cards

How does binary search work?

It halves the search area each time (divide and conquer).

54
New cards

Does binary search require a sorted list?

Yes.

55
New cards

Is binary search faster for large data sets?

Yes, much faster than linear search.

56
New cards

Why are programs tested?

To reveal errors, not to prove they work.

57
New cards

What types of data should be used in testing?

Normal, boundary, and erroneous data.

58
New cards

What is module testing?

Checking if each subroutine works properly.

59
New cards

What is program testing?

Checking if each individual program works.

60
New cards

What is system testing?

Making sure the entire system works correctly and meets requirements.

61
New cards

What is a trace table used for?

Hand-tracing an algorithm and tracking variable values.

62
New cards

What goes in the first column of a trace table with a loop?

The loop condition.

63
New cards

What is decomposition?

Breaking a problem into sub-problems that perform identifiable tasks.

64
New cards

What is composition?

Combining procedures to form a compound procedure.

65
New cards

What is abstraction?

Removing non-essential details from a problem to simplify it.

66
New cards

What is an example of abstraction?

The London Underground map.

67
New cards

What is information hiding?

Hiding details of a data object that don’t define its essential characteristics.

68
New cards

What is problem abstraction?

Removing details until a solvable version of the problem is left.

69
New cards

What is procedural abstraction?

Reusing procedures without showing internal values or logic.

70
New cards

What is functional abstraction?

Calling a built-in function without knowing how it works internally.

71
New cards

What is data abstraction?

Hiding the specifics of data representation to allow abstract data structures.

72
New cards

What is automation?

Putting real-world abstractions into action through algorithms and code.

73
New cards

What does automation involve?

Creating algorithms, implementing models in data structures, and executing code.

74
New cards

What is a finite state machine?

An abstract model representing how a system changes from one state to another.

75
New cards

How many states can an FSM be in at once?

Only one.

76
New cards

What is a transition in an FSM?

A change from one state to another based on a condition or event.

77
New cards

What defines an FSM?

Its states and the conditions for each transition.

78
New cards

Where are FSMs used?

Robotics, video games, compilers, protocols, hardware, and language design.

79
New cards

What is finite state automation?

An FSM used to accept or reject inputs without producing outputs.

80
New cards

What are the key parts of finite state automation?

Start state and end/accept states.

81
New cards

When is input accepted in an FSM?

When it reaches an end/accept state.

82
New cards

How does finite state automation process input?

It starts from the start state and transitions through symbols to the target state.

83
New cards

What does a state transition table show?

The next state for any given input.