Chapters 6 & 7 Flashcards

(39 cards)

1
Q

What type is used to create userfiles?

A

FILE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

If a file does not exist what does the append mode do?

A

Creates the file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

T/F When testing files you cannot replicate some errors such as physically bad media in order to test it properly

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is considered auxiliary storage?

A

disk and tape

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the three types of standard file streams?

A

stdin, stdout, stderr

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which C library contains the prototype statements for file operations

A

stdio.h

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

If a file is opened in “r” mode, C…

A

…opens the file for reading and sets the file marker at the beginning

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

If a file is not opened successfully C…

A

…continues processing with the next statement after the open

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

what specifies the type of data that is being formatted in formatted input/output

A

conversion codes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

The two input functions that read text data and converts the data to the types specified by a format string are:

A

fscanf and scanf

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

T/F scanf implicitly casts data to match the conversion code and its corresponding address parameter.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

which function reads the next character from the standard input stream and returns it value

A

getchar

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

what happens when scanf finds invalid data in the input stream

A

it terminates the scanf function and leaves the invalid character in the input stream

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

In a pretest loop is the condition tested before or after the statement is executed?

A

before

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are the 4 steps when working with a file

A
  1. Declare the file variable
  2. Open the file
  3. Use the file
  4. Close the file
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

File command for reading the file

A

fscanf (fileIn)

17
Q

File command for writing the file

A

fscanf (fileOut)

18
Q

File command for closing the file

A

fclose (fileIn);
fclose (fileOut);

19
Q

fgetc (fileIn);

A

read, and return one character from the file

20
Q

fputc (fileOut);

A

writing one character into the file

21
Q

When opening a file, what will be returned if the file
could not be opened?

22
Q

When reading from a file, what will be returned if the
end of file is reached?

23
Q

what kind of loop is a for loop?

A

Definite loop

24
Q

what kind of loop is a while loop?

25
what kind of loop is a do-while loop?
indefinite
26
which loops are pre-test
for and while loops
27
which loops are post-test
do-while loops
28
Which three statements shouldn't have a semicolon after the statement?
For, While, If
29
How do you declare a File reference variable
FILE *fileIn FILE *fileOut
30
What does the "r" stand for in file commands?
read
31
What does the "w" stand for in file commands?
write
31
What does the "r" stand for in file commands?
32
what is recursion?
The process where a function calls itself to solve a problem.
33
what is a loop update
An action that causes the loop limit test to change from true to false
34
T/F The update for a pretest loop must be a part of the loop body.
True
35
T/F Initialization code is explicitly required in all loops.
False
36
T/F Loop updates: The number of updates always equals the number of loop iterations.
False
37
which standard measure of efficiency is considered the most efficient?
logarithmic
38