Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages
Filter by Categories
nmims post
Objective Type Set
Online MCQ Assignment
Question Solution
Solved Question
Uncategorized

1. Which of the following the 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

Answer: c [Reason:] None.

2. Which of the following cannot be used with ungetc?
a) scanf
b) getc
c) getchar
d) printf

View Answer

Answer: d [Reason:] None.

3. What does the ungetc function return for the following 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

Answer: d [Reason:] None.

4. int ungetc(int c, FILE *fp) returns
a) Either c or EOF for an error
b) Nothing
c) fp
d) None of the mentioned

View Answer

Answer: a [Reason:] None.

5. Only _____character of pushback is guaranteed per file when ungetc is used.
a) Two
b) One
c) Many
d) Zero

View Answer

Answer: b [Reason:] None.

6. ungetc may be used with
a) scanf
b) getc
c) getchar
d) all of the mentioned

View Answer

Answer: d [Reason:] None.

7. The syntax for ungetc is
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

Answer: b [Reason:] None.