Deck 10: Data Files

ملء الشاشة (f)
exit full mode
سؤال
In the context of data processing, a C program is not usually considered data, and the term file, or data file, is typically used to refer only to external files that contain the data used in a C program.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
The internal name is the name of a file as it is known by the operating system.
سؤال
A manageable length for a filename is 24 to 30 characters, with an outside maximum of 511 characters.
سؤال
Most C compilers require a program file to have either the extension c or cc.
سؤال
The advantage of binary files is typically speed and compactness.
سؤال
It typically takes less space to store most numbers using their binary code than as individual character values.
سؤال
A file stream that receives data from a file into a program is referred to as an input file stream.
سؤال
FILE fp; correctly declares a file stream.
سؤال
Opening a file stream establishes the physical communication link between the program and the data file.
سؤال
The file open function is called open().
سؤال
Permissible file opening modes are r, w, or p, which represent reading, writing, or appending to a file.
سؤال
The only difference between a file opened in w mode and one opened in w+ mode is where the data is physically placed in the file.
سؤال
If a file opened for reading does not exist, the fopen() function returns the NULL address value.
سؤال
The exit() function is a systems call that passes its integer argument directly to the operating system and then terminates program operation.
سؤال
It is important to check the return value when making an fopen() call because the call is really a request to the operating system to open a file.
سؤال
The fflush() function breaks the link between the file's external and internal names, releasing the internal file pointer name, which can then be used for another file.
سؤال
The maximum number of files that can be opened at one time is defined by the system symbolic constant FOPEN_MAX.
سؤال
The end-of-file sentinel is never counted as part of the file.
سؤال
The functions fgetc() and fgets() return the named constant EOF when the marker is detected.
سؤال
A logical file pointer is one that references a file of related data that has been saved under a common name; that is, it "points to" a data file.
سؤال
A physical file pointer "points to" a hardware device, such as a keyboard, screen, or printer.
سؤال
stdin and stderr frequently refer to the same device.
سؤال
Most IBM or IBM-compatible personal computers assign the name prn to the printer connected to the computer.
سؤال
The standard library functions rewind(), fseek(), and ftell() can be used to provide random access to a file.
سؤال
The function prototype for ftell() is contained in stdlib.h.
سؤال
Binary files frequently require less storage space than their character-based counterparts.
سؤال
Data that is stored together under a common name on a storage medium other than the computer's main memory is called a ____.

A)database
B)data file
C)text file
D)binary file
سؤال
The maximum allowable filename in the DOS operating system is ____.

A)8 characters plus an optional period and 3-character extension
B)14 characters
C)155 characters
D)255 characters
سؤال
The maximum allowable filename in current Unix versions is ____.

A)8 characters plus an optional period and 3-character extension
B)14 characters
C)155 characters
D)255 characters
سؤال
The maximum allowable filename in the Windows 98, 2000 and XP operating system families is ____.

A)8 characters plus an optional period and 3-character extension
B)14 characters
C)155 characters
D)255 characters
سؤال
____ files store each individual character, such as a letter, digit, dollar sign, decimal point, and so on, using an individual character code.

A)Data
B)Text
C)Binary
D)ASCII
سؤال
The standard input stream is named ____.

A)stdin
B)stdout
C)instream
D)ostream
سؤال
The standard output stream is named ____.

A)stdin
B)stdout
C)instream
D)ostream
سؤال
Naming a file stream is accomplished by declaring a variable name to be of type ____.

A)FSTREAM
B)fstream
C)FILE
D)file
سؤال
Notice that each file stream name, when it is declared, is preceded by a(n) ____.

A)pipe
B)underscore
C)ampersand
D)asterisk
سؤال
The actual declaration of the FILE structure is contained in the ____ standard header file.

A)stdio.h
B)stdlib.h
C)file.h
D)stream.h
سؤال
____ creates a new file and makes the file available for output; if a file exists with the same name, the old file is erased.

A)fileOut = fopen("prices.dat","r");
B)fileOut = fopen("prices.dat","w");
C)fileOut = fopen("prices.dat","a");
D)fileOut = fopen("prices.dat","b");
سؤال
____ makes an existing file available for data to be added to the end of the file; if the file opened does not exist, a new file with the designated name is created and made available to receive output from the program.

A)fileOut = fopen("prices.dat","r");
B)fileOut = fopen("prices.dat","w");
C)fileOut = fopen("prices.dat","a");
D)fileOut = fopen("prices.dat","b");
سؤال
A file stream is closed using the ____ function.

A)exit()
B)osclose()
C)fclose()
D)close()
سؤال
____ writes a string to a file.

A)fputc()
B)fputs()
C)fwrites()
D)fprintf()
سؤال
C appends the low-value hexadecimal byte ____ as the end-of-file (EOF) sentinel when a file is closed.

A)0x00
B)0x01
C)0x99
D)0xFF
سؤال
____ reads values for the listed arguments from the file, according to the format.

A)fgetc()
B)fgets()
C)fprintf()
D)fscanf()
سؤال
The function fgets() returns ____ when it detects the end of a file.

A)0x00
B)'\N'
C)'\n'
D)'\0'
سؤال
The ____ function call requires three arguments: an address where the first character read will be stored, the maximum number of characters to be read, and the name of the input file.

A)fgetc()
B)fgets()
C)fprintf()
D)fscanf()
سؤال
____ causes the same display as the statement printf("Hello World!");.

A)fprintf(stdout,"Hello World!");
B)fprintf(stdin,"Hello World!");
C)fprintf(stderr,"Hello World!");
D)fprintf(NULL,"Hello World!");
سؤال
fputc() is the general form of ____.

A)fput()
B)putc()
C)putchar()
D)fputchar()
سؤال
The statement ____ causes the string Hello World! to be printed directly at the printer.

A)fprintf(lprn,"Hello World!");
B)fprintf("lprn","Hello World!");
C)fprintf(prn,"Hello World!");
D)fprintf("prn","Hello World!");
سؤال
When working with random access files, the ____ function resets the current position to the start of the file.

A)rewind()
B)reset()
C)fseek()
D)flush()
سؤال
When working with random access files, the ____ function returns the offset value of the next character that will be read or written.

A) rewind()
C) fseek()
B) ftell()
D) flush()
سؤال
To write to a binary file you use the ____ function.

A) fput()
C) fwrite()
B) fputb()
D) write()
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/50
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 10: Data Files
1
In the context of data processing, a C program is not usually considered data, and the term file, or data file, is typically used to refer only to external files that contain the data used in a C program.
True
2
The internal name is the name of a file as it is known by the operating system.
False
3
A manageable length for a filename is 24 to 30 characters, with an outside maximum of 511 characters.
False
4
Most C compilers require a program file to have either the extension c or cc.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
5
The advantage of binary files is typically speed and compactness.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
6
It typically takes less space to store most numbers using their binary code than as individual character values.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
7
A file stream that receives data from a file into a program is referred to as an input file stream.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
8
FILE fp; correctly declares a file stream.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
9
Opening a file stream establishes the physical communication link between the program and the data file.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
10
The file open function is called open().
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
11
Permissible file opening modes are r, w, or p, which represent reading, writing, or appending to a file.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
12
The only difference between a file opened in w mode and one opened in w+ mode is where the data is physically placed in the file.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
13
If a file opened for reading does not exist, the fopen() function returns the NULL address value.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
14
The exit() function is a systems call that passes its integer argument directly to the operating system and then terminates program operation.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
15
It is important to check the return value when making an fopen() call because the call is really a request to the operating system to open a file.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
16
The fflush() function breaks the link between the file's external and internal names, releasing the internal file pointer name, which can then be used for another file.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
17
The maximum number of files that can be opened at one time is defined by the system symbolic constant FOPEN_MAX.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
18
The end-of-file sentinel is never counted as part of the file.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
19
The functions fgetc() and fgets() return the named constant EOF when the marker is detected.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
20
A logical file pointer is one that references a file of related data that has been saved under a common name; that is, it "points to" a data file.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
21
A physical file pointer "points to" a hardware device, such as a keyboard, screen, or printer.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
22
stdin and stderr frequently refer to the same device.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
23
Most IBM or IBM-compatible personal computers assign the name prn to the printer connected to the computer.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
24
The standard library functions rewind(), fseek(), and ftell() can be used to provide random access to a file.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
25
The function prototype for ftell() is contained in stdlib.h.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
26
Binary files frequently require less storage space than their character-based counterparts.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
27
Data that is stored together under a common name on a storage medium other than the computer's main memory is called a ____.

A)database
B)data file
C)text file
D)binary file
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
28
The maximum allowable filename in the DOS operating system is ____.

A)8 characters plus an optional period and 3-character extension
B)14 characters
C)155 characters
D)255 characters
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
29
The maximum allowable filename in current Unix versions is ____.

A)8 characters plus an optional period and 3-character extension
B)14 characters
C)155 characters
D)255 characters
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
30
The maximum allowable filename in the Windows 98, 2000 and XP operating system families is ____.

A)8 characters plus an optional period and 3-character extension
B)14 characters
C)155 characters
D)255 characters
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
31
____ files store each individual character, such as a letter, digit, dollar sign, decimal point, and so on, using an individual character code.

A)Data
B)Text
C)Binary
D)ASCII
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
32
The standard input stream is named ____.

A)stdin
B)stdout
C)instream
D)ostream
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
33
The standard output stream is named ____.

A)stdin
B)stdout
C)instream
D)ostream
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
34
Naming a file stream is accomplished by declaring a variable name to be of type ____.

A)FSTREAM
B)fstream
C)FILE
D)file
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
35
Notice that each file stream name, when it is declared, is preceded by a(n) ____.

A)pipe
B)underscore
C)ampersand
D)asterisk
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
36
The actual declaration of the FILE structure is contained in the ____ standard header file.

A)stdio.h
B)stdlib.h
C)file.h
D)stream.h
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
37
____ creates a new file and makes the file available for output; if a file exists with the same name, the old file is erased.

A)fileOut = fopen("prices.dat","r");
B)fileOut = fopen("prices.dat","w");
C)fileOut = fopen("prices.dat","a");
D)fileOut = fopen("prices.dat","b");
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
38
____ makes an existing file available for data to be added to the end of the file; if the file opened does not exist, a new file with the designated name is created and made available to receive output from the program.

A)fileOut = fopen("prices.dat","r");
B)fileOut = fopen("prices.dat","w");
C)fileOut = fopen("prices.dat","a");
D)fileOut = fopen("prices.dat","b");
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
39
A file stream is closed using the ____ function.

A)exit()
B)osclose()
C)fclose()
D)close()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
40
____ writes a string to a file.

A)fputc()
B)fputs()
C)fwrites()
D)fprintf()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
41
C appends the low-value hexadecimal byte ____ as the end-of-file (EOF) sentinel when a file is closed.

A)0x00
B)0x01
C)0x99
D)0xFF
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
42
____ reads values for the listed arguments from the file, according to the format.

A)fgetc()
B)fgets()
C)fprintf()
D)fscanf()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
43
The function fgets() returns ____ when it detects the end of a file.

A)0x00
B)'\N'
C)'\n'
D)'\0'
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
44
The ____ function call requires three arguments: an address where the first character read will be stored, the maximum number of characters to be read, and the name of the input file.

A)fgetc()
B)fgets()
C)fprintf()
D)fscanf()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
45
____ causes the same display as the statement printf("Hello World!");.

A)fprintf(stdout,"Hello World!");
B)fprintf(stdin,"Hello World!");
C)fprintf(stderr,"Hello World!");
D)fprintf(NULL,"Hello World!");
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
46
fputc() is the general form of ____.

A)fput()
B)putc()
C)putchar()
D)fputchar()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
47
The statement ____ causes the string Hello World! to be printed directly at the printer.

A)fprintf(lprn,"Hello World!");
B)fprintf("lprn","Hello World!");
C)fprintf(prn,"Hello World!");
D)fprintf("prn","Hello World!");
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
48
When working with random access files, the ____ function resets the current position to the start of the file.

A)rewind()
B)reset()
C)fseek()
D)flush()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
49
When working with random access files, the ____ function returns the offset value of the next character that will be read or written.

A) rewind()
C) fseek()
B) ftell()
D) flush()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
50
To write to a binary file you use the ____ function.

A) fput()
C) fwrite()
B) fputb()
D) write()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.