Mid-Term Chapter 1-5 Flashcards
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
The job of the ______ is to fetch instructions, carry out the operations commanded by the instructions, and produce some outcome or resultant information.
CPU
Internally, the CPU consists of the ____ and the ____.
Control Unit and ALU (arithmetic and logic unit)
Arithmetic and Logic Unit (of CPU)
performs the math operations
Control Unit (of CPU)
Coordinates all of the computer’s operations
A ______ is an example of a secondary storage device.
Disk
The two general categories of software are _____ and _____.
System software and Application software.
Words or names defined by the programmer are called …
Programmer defined identifiers
A ________ is a named storage location
variable
You can force an integer to be stored as a long integer by placing the letter __ at the _____ of the number.
L at the end. Example: int amount; amount = 32L; Literal is treated as a long.
On any computer, which data type uses more memory, an integer or an unsigned integer?
They use the same amount of memory.
Is there an unsigned floating-point data type? If yes, what is it?
No.
How would the followin number in scientific notation be representing in E notation?
6.31 x 10 (to the 17th)
6.31E17