Mid-Term Chapter 1-5 Flashcards
(36 cards)
Define “Infinite Loop”
Continues to repeat until the program is interrupted
Define “Input Validation”
Process of inspecting data given to a program by the user and determining if it is valid
The while loop is especially useful for…
Validating input.
If invalid input is entered a loop can require the user reenter it as many times as necessary.
Define “Priming Read”
The read operation that takes place just before the loop.
It provides the first value for the loop to test. Subsequent values are obtained by the loop.
A “counter” is a variable that is regularly…
incremented or decremented each time a loop iterates
Sentinal controlled or sentinal value
Sentinel-controlled repetition is sometimes called indefinite repetition because it is not known in advance how many times the loop will be executed. It is a repetition procedure for solving a problem by using a sentinel value (also called a signal value, a dummy value or a flag value) to indicate “end of data entry”.
The do-while Loop is a ______ loop.
posttest loop, which means its expression is tested after each iteration.
What is the do-while format?
do
statement;
while (expression);
user-controlled loop
allows the user to decide the number of iterations (for example, again? Y/N
Use the do-while loop when you want the loop to run at least ____times
one time
The do-while loop is a good choice for repeating a _____.
menu
The for Loop is ideal for…
Performing a known number of iterations
The count-controlled (for Loop) must have what 3 elements?
- Initialize a counter variable to a starting value.
2. Test the counter variable by comparing it to a max value. When max reached, it terminates
Flowchart
diagram that shows the logical flow of a program
Pseudocode
cross between human language and a programming language
Ex
Get payroll data.
Calculate gross pay.
Display gross pay.
(provide more details even, Display: How many hours worked?
etc
Logical errors
mistakes that cause the program to produce erroneous results (trace through to see the logic of each step in a hierarchy or pseudocode)
desk-checking
programmer reads through program (or a portion) and steps through each statement. A sheet of paper is often used to jot down current contents of all variables and sketch what the screen looks like after each output operation; stepping through can catch many errors
Compiler
translates each source code statement into the appropriate machine language statements; finds syntax errors
Main Memory
RAM
Working Memory
Temporary
Memory the computer uses while it’s running a program
Secondary Memory
Permanent Memory
All programs must be loaded into ____ memory before they can be executed
All programs must be loaded into MAIN memory before they can be executed.
Why is Main Memory (RAM) considered “Volatile”?
Because it is erased when the computer is turned off or when the program terminates.
What type of software controls the internal operations of the computer’s hardware?
Operating System
Computers can do many different jobs because they can be _______.
programmed