Which of the following is not a stream associated with C files? a) stdin b) stdo
ID: 3810825 • Letter: W
Question
Which of the following is not a stream associated with C files? a) stdin b) stdout c)stdchar d) stderr C views each file simply as a sequential stream ___ a) bits b) bytes c) fields d) records Function tool ___ a) forces an end of file condition b) determine whether the end-of-file indicator is set for a file c) sets the end-of-file indicator for a file d) flushes the contents of the file from the current position to the end a) Function fprintf is equivalent to printf. b) Function fprintf is equivalent to printf except that fprintf also receives as an argument a file pointer for the file to which the data will be written. c) Function fprintf is equivalent to printf except that printf also receives as an argument a file control block for the file to which the data will be written. d) Function fprintf is equivalent to printf except that fprintf also disables the file end-of-file indicator. If a file is not closed explicitly by a program ___. a) the operating system normally will close the file when program execution terminates b) the file will be left open when the pro0gram terminates, creating a possible security breach c) the operating system will query the user to determine if he or she wishes to close the file when the program terminates d) the operating system will not allow the owner of that program to run other programs Arrays are data structures consisting of related data items of the same ___. a) sort order b) subscript c) type d) elementExplanation / Answer
Question 1)
Answer : c) stdchar
stdin, stdout and stderr are three standard file streams opened for a process.
stdin : File associated with standard input
stdout: File associated with standard output
stderr : File associated with standard error
Question 2)
Answer : b) bytes
Bytes contains the smallest unit of data that can be processed in the system. Bits are even smaller units but the system doesn't provide any way to directly access individual bits and to do manipulation over it (A possible reason could be performance issue, accessing individual bits in a big file can seriously hamper the system performance.
Question 3)
Answer : b) determine whether the end of file indicator is set for a file.
All files end with a special character called end of file character. feof() is a function provided in the standard library to determine that.
Question 4)
Answer : b) funtion fprintf() is equivalent to printf() except that fprintf also receives as an argument the file pointer for the file to which the data will be written.
Before prinitng to any file we have to determine which file needs to be written to. If we wish to write to standard output (in general it is the terminal on the screen) we can directly use the printf() funtion. printf() always write to standard output.
Incase the file is other than standard output the we need to use fprintf() funtion provided in the standard library and pass the FILE pointer to it designating the file to be written to.
fprintf prototype :
int fprintf(FILE* stream, const char* format , ...);
Question 5)
Answer : A) The Operating system will normally close the file when program execution terminates.
The standard action taken by an operating system is to flush the data in the buffer associated with the file and close it.
Question 6)
Answer : c) type
Arrays are user defined data types. It uses the other basic data types to define itself. The limitation with array is that it can only hold data with same data type .
e.g :
int arr[10] ; // This declares a collection of 10 integers having contiguous memory.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.