Chapter 2: Problem Solving Flashcards
What are the 3 basic structures?
Iteration
Sequence
Selection
What are the benefits of structured programming?
- modules can be tested separately
- modules can be grouped into libraries and reused
- larger programs can be split into modules = easier to read, maintain and debug
What programming constructs should you avoid?
Break
GOTO
Global variables
What is a top down design?
Program divided into modules (functions, procedure)
Hierarchy chart
What makes a good algorithm?
- efficient
- clear set of steps
- correct output for any input
- easy to follow
- should allow for invalid inputs
- must terminate at some point
- understandable to other programmers
What is the purpose of testing programs?
- reveals errors (not to prove a system works)
- don’t need to know how the code works to test it
What are the 3 stages of testing?
- Module testing - individual subroutines
- Program testing - all the code as a whole
- System Testing - on the actual hardware
What are 4 test types?
Normal
Boundary
Erroneous
Invalid
What is the difference between black box testing and white box testing?
Black box - cannot see the code you’re testing
White box - can see
What is abstraction?
Process of omitting unnecessary details from a problem to simplify the problem
What is information hiding?
Process of hiding all details of an object that do not contribute to its essential characteristics
What is decomposition?
Breaking down a problem into smaller parts so each task completes an unidentifiable task
What is procedural abstraction?
Breaking down a complex model into a series of reusable procedures
The actual values used in computation are abstracted away and a computational method is achieved
What is functional abstraction?
Abstracting further after procedural abstraction so the particular method of a procedure is disregarded and a function remains
What is data abstraction?
Specific details of how data is actually represented are abstracted away allowing new kinds of data structure to be created from previously defined data structures
What is a finite state machine (FSM)?
A computational model for a model for a machine that is:
- always in a fixed state
- each FSM has a finite number of states
- can only ever be in one state at a point in time
What does a state look like?
Just a circle
What does the starting state look like?
Circle with an arrow from the left to the circle
What is an acceptable state?
Circle inside a circle
How do you represent transitions?
Arrows to and from states
What is an algorithm?
Sequence of steps that can be followed to complete a task and always terminates
What is a state transition diagram?
Used by computer scientists as a visual representation of a FSM