Chapters 6 & 7 Flashcards

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?

A

NULL

22
Q

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

A

EOF

23
Q

what kind of loop is a for loop?

A

Definite loop

24
Q

what kind of loop is a while loop?

A

indefinite

25
Q

what kind of loop is a do-while loop?

A

indefinite

26
Q

which loops are pre-test

A

for and while loops

27
Q

which loops are post-test

A

do-while loops

28
Q

Which three statements shouldn’t have a semicolon after the statement?

A

For, While, If

29
Q

How do you declare a File reference variable

A

FILE *fileIn
FILE *fileOut

30
Q

What does the “r” stand for in file commands?

A

read

31
Q

What does the “w” stand for in file commands?

A

write

31
Q

What does the “r” stand for in file commands?

A
32
Q

what is recursion?

A

The process where a function calls itself to
solve a problem.

33
Q

what is a loop update

A

An action that causes the loop limit test to change from true to false

34
Q

T/F The update for a pretest loop must be a part of the loop body.

A

True

35
Q

T/F Initialization code is explicitly required in all loops.

A

False

36
Q

T/F Loop updates: The number of updates always equals the number of loop iterations.

A

False

37
Q

which standard measure of efficiency is considered the most efficient?

A

logarithmic

38
Q
A