Chapters 6 & 7 Flashcards
What type is used to create userfiles?
FILE
If a file does not exist what does the append mode do?
Creates the file
T/F When testing files you cannot replicate some errors such as physically bad media in order to test it properly
True
What is considered auxiliary storage?
disk and tape
What are the three types of standard file streams?
stdin, stdout, stderr
Which C library contains the prototype statements for file operations
stdio.h
If a file is opened in “r” mode, C…
…opens the file for reading and sets the file marker at the beginning
If a file is not opened successfully C…
…continues processing with the next statement after the open
what specifies the type of data that is being formatted in formatted input/output
conversion codes
The two input functions that read text data and converts the data to the types specified by a format string are:
fscanf and scanf
T/F scanf implicitly casts data to match the conversion code and its corresponding address parameter.
False
which function reads the next character from the standard input stream and returns it value
getchar
what happens when scanf finds invalid data in the input stream
it terminates the scanf function and leaves the invalid character in the input stream
In a pretest loop is the condition tested before or after the statement is executed?
before
What are the 4 steps when working with a file
- Declare the file variable
- Open the file
- Use the file
- Close the file
File command for reading the file
fscanf (fileIn)
File command for writing the file
fscanf (fileOut)
File command for closing the file
fclose (fileIn);
fclose (fileOut);
fgetc (fileIn);
read, and return one character from the file
fputc (fileOut);
writing one character into the file
When opening a file, what will be returned if the file
could not be opened?
NULL
When reading from a file, what will be returned if the
end of file is reached?
EOF
what kind of loop is a for loop?
Definite loop
what kind of loop is a while loop?
indefinite
what kind of loop is a do-while loop?
indefinite
which loops are pre-test
for and while loops
which loops are post-test
do-while loops
Which three statements shouldn’t have a semicolon after the statement?
For, While, If
How do you declare a File reference variable
FILE *fileIn
FILE *fileOut
What does the “r” stand for in file commands?
read
What does the “w” stand for in file commands?
write
What does the “r” stand for in file commands?
what is recursion?
The process where a function calls itself to
solve a problem.
what is a loop update
An action that causes the loop limit test to change from true to false
T/F The update for a pretest loop must be a part of the loop body.
True
T/F Initialization code is explicitly required in all loops.
False
T/F Loop updates: The number of updates always equals the number of loop iterations.
False
which standard measure of efficiency is considered the most efficient?
logarithmic