1.

What is the output of this program?
#include <iostream>
int main ()
{
int k;
FILE * ptr;
char buff[10];
ptr = fopen ("Sample.txt", "w+");
for ( k = 'A' ; k <= 'D' ; k++)
fputc ( k, ptr);
rewind (ptr);
fread (buff, 1, 5, ptr);
fclose (ptr);
buff[3] = ' 0';
puts (buff);
return 0;
}

A. ABC
B. EFTLM
C. ABCDE
D. ABCD
E. None of these
Answer» B. EFTLM


Discussion

No Comment Found

Related MCQs