C-Library-Functions


  1. ungetc() may be used with ________











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    All of above


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











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    Zero



  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    int num;
    scanf("%d", &num);
    ungetc(num, stdin);
    scanf("%d", &num);
    printf("%d\n", num);
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    Undefined behaviour


  1. What will be the output of the following C code considering user typed ajit?
    #include <stdio.h>
    int main()
    {
    char num[26];
    fgets(num, 25, stdin);
    ungetc(num[0], stdin);
    printf("%s\n", num);
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    ajit



  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    char num[25];
    fgets(num, 24, stdin);
    ungetc(num[0], stdin);
    scanf("%s", num);
    printf("%s\n", num);
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    First character of whatever user types first time and whatever user types second time