COSC-1337 Chapter 5 Flashcards
(29 cards)
What is the first line of a while loop called?
while(condition) {
}
Loop header
Each execution of a loop is known as an?:
Iteration
What is a variable that controls the number of times a loop iterates called?
Loop control variable
What type of loop is the while loop?
It is a “pre-test loop” this is because the condition is tested BEFORE each iteration
What is the “first read” called right before the input is tested by a while loop for input validation?
Priming read
The “++” and “–” operators can only work on what types of values/data?
They can only work with “lvalues” AKA a variable.
What is a “counter”?
It is a variable that increments each time a loop iterates
What is a “sentinel”?
It is a special value or character that is used to mark the end of a list of values
What type of loop terminates when the sentinel is entered?
A “sentinel-controlled loop”
What type of loop is the “do-while loop”?
It is a post-test loop. This means that AFTER each iteration the condition is then tested.
What file header must you include to use “toupper()” and “tolower()”?
cctype
What type of loop is the “for loop”?
It is a pretest loop THAT IS COUNT CONTROLLED
What is a loop inside of another loop called?
A “nested loop”
What is the name for saving data to a file called?
“Writing data” to a file
What is the name of a file that data is “written” to?
Output file
What is the process of retrieving data from a file called?
Reading data
What term is used to describe the file that data is input from?
Input file. It is called this because a program is getting input from this file
What are the two general types of files?
Text and binary files
What is another name for “direct access file”?
Random access file
How are files on a disk identified?
By their “filename”
What is a file stream object?
It is an OBJECT that is associated with a SPECIFIC file on the computer’s disk. This object is created in a program in order for the program to be able to work with the file.
Why does “file stream object” have the word “stream” in it?
Because it enables streams of data to be copied to memory from a file, and from a file to memory.
What type of operations can we perform on a file object of the data type?
We can open the file and read its contents
What type of operations can we perform on a file object of the data type?
We can create a file and write and save data to it.