This set of C Multiple Choice Questions & Answers (MCQs) focuses on “Ungetc – 2”.
Pre-requisite for this C MCQ set: Advanced C Programming Video Tutorial.
1. 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);
View Answer
Explanation: None.
2. Which of the following cannot be used with ungetc()?
a) scanf
b) getc
c) getchar
d) printf
View Answer
Explanation: None.
3. What does the ungetc function return for the following C expression?
ungetc(c, fp);//where declarations are int c and FILE *fp
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 error
View Answer
Explanation: None.
4. What will be the output of the following C statement?
int ungetc(int c, FILE *fp)
a) Either c or EOF for an error
b) Nothing
c) fp
d) None of the mentioned
View Answer
Explanation: None.
5. Only _____character of pushback is guaranteed per file when ungetc is used.
a) Two
b) One
c) Many
d) Zero
View Answer
Explanation: None.
6. ungetc() may be used with ________
a) scanf
b) getc
c) getchar
d) all of the mentioned
View Answer
Explanation: None.
7. 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)
View Answer
Explanation: None.
Sanfoundry Global Education & Learning Series – C Programming Language.
To practice all areas of C language, here is complete set of 1000+ Multiple Choice Questions and Answers.
- Apply for C Internship
- Practice Computer Science MCQs
- Practice BCA MCQs
- Check C Books
- Check Computer Science Books