Explore topic-wise MCQs in C Programming.

This section includes 6 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 syntax of ungetc()?

A. void ungetc(int c, FILE *fp)
B. int ungetc(int c, FILE *fp)
C. int ungetc(String c, FILE *fp)
D. int getc(int c, FILE *fp)
Answer» C. int ungetc(String c, FILE *fp)
2.

ungetc() may be used with ________

A. scanf
B. getc
C. getchar
D. all of the mentioned
Answer» E.
3.

Only _____character of pushback is guaranteed per file when ungetc is used.

A. Two
B. One
C. Many
D. Zero
Answer» C. Many
4.

What does the ungetc function return for the following C expression?

A. It returns character c
B. It returns EOF for an error
C. Both returns character c and returns EOF for an error
D. Either returns character c or returns EOF for an errorView Answer
Answer» E.
5.

Which of the following cannot be used with ungetc()?

A. scanf
B. getc
C. getchar
D. printf
Answer» E.
6.

Which of the following is the correct declaration for ungetc?

A. int ungetc(int c, FILE fp);
B. int ungetc(int *c, FILE fp);
C. int ungetc(int c, FILE *fp);
D. int ungetc(int *c, FILE *fp);
Answer» D. int ungetc(int *c, FILE *fp);