Chapter Two: Input, Processing, and Output Flashcards
Programs must be designed before they are written
- ) design the program
- ) write the code
- ) correct syntax errors
- ) test the program
- ) correct logic errors
Write the code
each language has its own syntax that must be followed
Syntax means rules that dictate things such as how keywords, operators, and punctuation characters can be used
A syntax error occurs if the programmer violates any of these rules
Correct syntax Errors
If the program contains a syntax error the interpreter will display an error message.
When first writing a program, you will have syntax errors, these are almost impossible to avoid.
Once syntax errors have been corrected, the program can be compiled and translated into machine language.
Test the Program
Once the code is in executable form, it is then tested for logic errors.
A logic error is a mistake that does not prevent the program from running but causes incorrect results.
Correct Logic Errors
Of the program produces incorrect results, the programmer needs to debug the code.
To debug, means that you find and correct logic errors.
Sometimes you will find that the original design must be changed. If so, then the program development cycle starts over.
Algorithm
set of well-defined logical steps that must be taken to perform a task.
Steps in an algorithm are sequentially ordered and must be followed in sequence.
The algorithm must then be translated into code: Psuedocode Flowchart
pseudocode
fake code
Informal language that has no syntax rule.
Not meant to be compiled or executed.
Used to retake model program.
flowcharts
diagram that graphically depicts the steps in a program
Ovals are terminal symbols
Parallelograms are input and output symbols
Rectangles are processing symbols
Symbols are connected by arrows that represented the flow of the program
function
piece of prewritten code that performs an operations
print function
displays output on the screen
Example: print(‘Hello World’)
argument
data given to a function
Example: data that is printed to screen
string
sequence of characters that is used as data
string lateral
string that appears in actual code of a program.
Must be enclosed in a single (‘) or double (“) quote marks
comments
notes of explanation within a program
end-line comment
appears at the end of a lone code
Typically explains the purpose of that line