Input / Output

Q1:
Consider the following program and what will be content of t?
#include<stdio.h>

int main()
{
    FILE *fp;
    int t;
    fp = fopen('DUMMY.C', 'w');
    t = fileno(fp);
    printf('%d\n', t);
    return 0;
}

A The handle associated with "DUMMY.C" file

B Garbage value

C size of "DUMMY.C" file

D Error in fileno()

ANS:A - size of "DUMMY.C" file

fp = fopen('DUMMY.C', 'w'); A file DUMMY.C is opened in write mode and returns the file pointer to fp t = fileno(fp); returns the handle for the fp stream and it stored in the variable t printf('%d\n', t); It prints the handle number.



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.