Home
MCQS
C/C MCQ Quiz Hub
C Programming - MCQ Questions Set 5
Choose a topic to test your knowledge and improve your C/C skills
1. stdout, stdin and stderr are ___
Structure
File pointers
File descriptors
Streams
2. Which of the following statements about stdout and stderr are true?
Same
Both connected to screen always
Both connected to screen by default
stdout is line buffered but stderr is unbuffered
3. Within main, return expr statement is equivalent to _______
abort(expr)
exit(expr)
ferror(expr)
none of the mentioned
4. stderr is similar to?
stdin
stdout
both stdout and stdin
none of the mentioned
5. Which of the following function can be used to terminate the main function from another function safely?
return(expr);
exit(expr);
abort();
both exit(expr); and abort();
6. Which of the following causes an error?
Trying to read a file that doesn’t exist
Inability to write data in a file
Failure to allocate memory with the help of malloc
All of the mentioned
7. What is the purpose of the C function? int ferror(FILE *fp)
They check for input errors
They check for output errors
They check for all types of errors
They check for error in accessing the file
8. stderr is similar to?
stdin
stdout
Both stdout and stdin
None of the mentioned
9. What will be the output of the following C statement? fprintf(stderr, "error: could not open filen");
The diagnostic output is directly displayed in the output
The diagnostic output is pipelined to the output file
The line which caused error is compiled again
The program is immediately aborted
10. Which of the following function can be used to terminate the main() function from another function safely?
return(expr);
exit(expr);
abort();
both exit(expr); and abort();
11. Which of the following causes an error?
Trying to read a file that doesn’t exist
Inability to write data in a file
Failure to allocate memory with the help of malloc
All of the mentioned
12. What is the purpose of the C function? int ferror(FILE *fp)
They check for input errors
They check for output errors
They check for all types of errors
They check for error in accessing the file
Submit