Log In Register

Units


Ungetc - Questions and Answers

 

Practice these Ungetc under C Programming walk-in interview Questions/ examination questions with best tricks and short cuts with solution. Student (candidate) who want to crack the walk in interview, competitive exams and want to find short cuts and tricks to solve questions on Ungetc for following purpose.


– Anyone who is wishing to increase their perfect knowledge of Ungetc of C Programming.
– Anyone who is preparing for aptitude test and increase his in depth aptitude knowledge C Programming specifically Ungetc.
– Anyone who is preparing for interviews (competitive examinations, govt examinations and bank examinations, off-campus or on campus interviews, walk-in interview and company interviews) having questions on Ungetc under C Programming.

– Anyone who is preparing for aptitude test or competitive exam or entrance exam.
– Anyone who is preparing for entrance examinations and other competitive examinations.
– All Experienced, Freshers and Students.

Here is list of Questions and Answers covering all key area of  Ungetc topic of C Programming:

 

1.

ungetc is used

Answer: Option B

Explanation:

2.

Which of the following is the correct syntax for calling function ungetc?
    Assume int c and FILE *fp

Answer: Option C

Explanation:

3.

int ungetc(int c, FILE *fp) returns

Answer: Option C

Explanation:

4.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         char n[20];
  5.         fgets(n, 19, stdin);
  6.         ungetc(n[0], stdin);
  7.         scanf("%s", n);
  8.         printf("%s\n", n);
  9.         return 0;
  10.     }

Answer: Option A

Explanation:

5.

How many characters for pushback is guaranteed per file while using
    ungetc(c, fp);

Answer: Option C

Explanation:

6.

The syntax for ungetc is

Answer: Option C

Explanation:

7.

Which of the following cannot be used with ungetc?

Answer: Option A

Explanation:

8.

Which of the following the is the correct declaration for ungetc?

Answer: Option B

Explanation:

9.

ungetc can be used only with getc.

Answer: Option C

Explanation:

10.

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

Answer: Option C

Explanation:

11.

Which character of pushback is guaranteed per file?

Answer: Option D

Explanation:

12.

ungetc may be used with

Answer: Option D

Explanation:

13.

What is the output of this code considering user typed jkl?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         char n[20];
  5.         fgets(n, 19, stdin);
  6.         ungetc(n[0], stdin);
  7.         printf("%s\n", n);
  8.         return 0;
  9.     }

Answer: Option D

Explanation:

14.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         int n;
  5.         scanf("%d", &n);
  6.         ungetc(n, stdin);
  7.         scanf("%d", &n);
  8.         printf("%d\n", n);
  9.         return 0;
  10.     }

Answer: Option C

Explanation:

15.

What does the ungetc function return for the following expression?
    ungetc(c, fp);//where declarations are int c and FILE *fp

Answer: Option B

Explanation: