C MCQ set number 00723

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);

Answer

Answer: c [Reason:] None.

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

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

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

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

Answer

Answer: b [Reason:] None.

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

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)

Answer

Answer: b [Reason:] None.

ed010d383e1f191bdb025d5985cc03fc?s=120&d=mm&r=g

DistPub Team

Distance Publisher (DistPub.com) provide project writing help from year 2007 and provide writing and editing help to hundreds student every year.