Question: 1) #include 2) #define BUFSIZE 100 3) main() 4) { 5) char buf[BUFSIZE]; 6) char filename[20]; 7) FILE *fp; 8) puts(Enter text file to open:
1) #include
2) #define BUFSIZE 100
3) main()
4) {
5) char buf[BUFSIZE];
6) char filename[20];
7) FILE *fp;
8) puts("Enter text file to open: ");
9) gets(filename);
10) if ((fp = fopen(filename, "r"))==NULL)
11) {
12) fprintf(stderr, "Error opening file.");
13) return(1);
14) }
15)
16) while ( !feof(fp) )
17) {
18) fgets(buf, BUFSIZE, fp);
19) printf("%s",buf);
20) }
21) fclose(fp);
22) }
Illustration 5:
54)In Illustration 5 which line declares a file pointer?
A) 18
B) 1
C) 10
D) 7
55)In Illustration 5 which line opens a file for text input?
A) 7
B) 18
C) 13
D) 10
56)In Illustration 5 which line outputs to stdout
A) 9
B) 10
C) 18
D) 19
57)In Illustration 5 which line 16 uses feof that returns what if the input file has been completely read in?
A) Yes
B) False
C) True
D) No
58)In Illustration 5 which line gets a file name from stdin?
A) 6
B) 18
C) 9
D) 8
59)In Illustration 5 in line 21, fclose calling argument is what?
A) pointer
B) value
C) file name
D) structure
60)In Illustration 5 which line closes stdout?
A) 21
B) none
C) 19
D) 7
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
