Explore topic-wise MCQs in C Programming.

This section includes 9 Mcqs, each offering curated multiple-choice questions to sharpen your C Programming knowledge and support exam preparation. Choose a topic below to get started.

1.

What is the meant by a in the following C operation?fp = fopen("Random.txt", "a");

A. Add
B. Attach
C. Append
D. Apprehend
E. None of these
Answer» D. Apprehend
2.

What will be the output of the following C code?#include <stdio.h> int main() { FILE *fp = stdin; int num; fprintf(fp, "%d", 55); }

A. 55
B. Compilation error
C. Runtime Error
D. Nothing
E. None of these
Answer» E. None of these
3.

What does the following segment of C code do?fprintf(fp, "Interview Mania!");

A. It writes as well as reads Interview Mania! to and from the file and prints it
B. It writes Interview Mania! into the file pointed by fp
C. It reads Interview Mania! from the file and prints on display
D. All of above
E. None of these
Answer» C. It reads Interview Mania! from the file and prints on display
4.

What will be the output of the following C code?#include <stdio.h> #include <stdlib.h> int main() { FILE *fp = stdout; int num; fprintf(fp, "%d", 102); }

A. Nothing
B. Compilation Error
C. Garbage value
D. 102
E. None of these
Answer» E. None of these
5.

What will be the output of the following C code?#include <stdio.h> int main() { FILE *fp = stdout; int m; fprintf(fp, "%d ", 55); fflush(stdout); fprintf(stderr, "%d", 85); return 0; }

A. Nothing
B. 85 55
C. Compilation Error
D. 55 85
E. 85
Answer» E. 85
6.

What will be the output of the following C code?#include <stdio.h> int main() { FILE *fp = stdout; int num; fprintf(fp, "%d ", 105); fprintf(stderr, "%d ", 99); return 0; }

A. Compilation Error
B. 99 105
C. 105 99
D. Garbage value
E. None of these
Answer» D. Garbage value
7.

What does the following segment of C code do?

A. It writes as well as reads Interview Mania! to and from the file and prints it
B. It writes Interview Mania! into the file pointed by fp
C. It reads Interview Mania! from the file and prints on display
D. All of above
E. None of these
Answer» C. It reads Interview Mania! from the file and prints on display
8.

Which type of files can t be opened using fopen()?

A. .c
B. .bin
C. .txt
D. All of above
E. None of these
Answer» F.
9.

What is the meant by a in the following C operation?

A. Add
B. Attach
C. Append
D. Apprehend
E. None of these
Answer» D. Apprehend