C Language File Selection Question (the answer is at the end) 1The function of standard library function fgets (s, n, f) is A) Read a string of length n from file f and store it in the memory indicated by pointer s B) Read strings from file f that are not longer than n-1 and store them in memory as indicated by pointer s C) Read n strings from file f and store them in the memory indicated by pointer s D) Read a string of length n-1 from file f and store it in the memory indicated by pointer s 2In C, access to files is in units of A) Record B) bytes C) Element D) Cluster 3The following variables represent file pointer variables A) FILE*fp B) FILE FP C) FILER * FP D) file * FP 4In C, the following description of the document is correct A) Files opened in "r" mode can only write data to files B) Files can also be opened in "R" mode C) A file opened in "w" mode can only be used to write data to a file, and the file may not exist. D) Open non-existent files in "a" mode 5In C, when the file pointer changes FP to "end of file", the value of the function feof (fp) is A) t. B) F. C) 0 D) 1 6In C, the system automatically defines three file pointers stdin, stdout and stderr, respectively. The functions of the function fputc (ch, stdout) are: terminal input, terminal output and standard error output. A) Enter a character from the keyboard to the character variable Ch B) Output the value of the character variable ch on the screen C) Write the value of the character variable into the file stdout D) assign the value of the character variable ch to stdout 7The functions of the following sections are # include < stdio.h > Main () {char S1; S1 = putc (getc (stdin), stdout);} A) Enter a character from the keyboard to the character variable S1 B) Enter a character from the keyboard and then output it to the screen. C) Input a character from the keyboard and assign the variable S1 to the screen at the same time as output. D) Output the stdout value on the screen 8In C, it is common to open a file as follows If ((fp = fopen ("file1.c", "r")= = NULL) {printf ("cannot open this file\ n"); exit (0);} The function exit (0) serves as A) Withdrawal from the C environment B) Complex statement where exit occurs C) Close all files and terminate the process being invoked when the file does not open properly D) Terminate the calling process when the file opens normally 9To execute the following procedures # include < stdio.h > FILE *fp; FP = fopen ("file", "w"); The full name of the file generated on disk is A) File B) File.c C) file. dat D) file. TXT 10In the case of frequent data exchange between memory and disk, the best function for reading and writing disk files is A) fscan F, fprintf B) fread, fwrite C) getc, putc D) putchar, getchar 11In C, if the files are divided according to the format of the data, they can be divided into two parts. A) Program files and data files B) Disk files and device files C) Binary and Text Files D) Sequential and Random Files 12If FP is a pointer to a file and has read the end of the file, then the C language function feof (fp) The return value is A) EOF B) - 1 C) Non-zero D) NULL 13In C, buffer file system means A) Buffers are created automatically by the system. B) Buffers are created automatically by the system. D) Buffers are determined by file size D) Buffers are determined by memory size 14In C, the file pointer is A) A character pointer variable B) A structured pointer variable C) A Common Pointer Variable D) An Enumerated Pointer Variable 15In C, the standard output device refers to A) Keyboard B) Mouse C) Hard Disk D) Light Pen 16In C, standard output devices and standard error output devices refer to monitors and their corresponding pointer names. Respectively A) stdin, stdio B) STDOUT, STDERR C) stdout, stderr D) stderr, stdout 17In C, all disk files must be opened before operation. The calling format of open file function is as follows: Fopen (file name, file operation mode); Where the file name is the full name of the file to be opened, it can be: A) Character variable name, string constant, character array name B) Character constants, string variables, pointer variables to strings C) String constants, array names for storing strings, pointer variables to strings D) Character array name, main name of file, string variable name 18In C, the correct section to open a file is A) #include <stdio.h> B #include <stdio.h> FILE * fp; FILE fp; FP = fopen ("file1.c", "WB"); FP = fopen ("file1.c", "w"); C) #i

docxDoc C Language File Selection Question

Professional Docs > Common > Other > Preview
7 Pages 0 Downloads 73 Views 3.0 Score
Tips: If the document is garbled or fails to read, please download the document
C Language File Selection Question Page 1 C Language File Selection Question Page 2 C Language File Selection Question Page 3 C Language File Selection Question Page 4 C Language File Selection Question Page 5
Download documents to your computer for easy access
2pages left for preview,Continue
Uploaded by admin on 2019-10-15 12:00:43
Rate
You can enter 255 characters
What is my domain?( answer:www.45doc.com )
comments
  • No comments yet