31. | What will be the output of the program ? #include
int main()
{
FILE *fs, *ft;
char c[10];
fs = fopen("source.txt", "r");
c[0] = getc(fs);
fseek(fs, 0, SEEK_END);
fseek(fs, -3L, SEEK_CUR);
fgets(c, 5, fs);
puts(c);
return 0;
}
|
|||||||
|
32. | Identify X library function for line input and output? #include
int X(char *s, FILE *iop)
{
int c;
while (c = *s++)
putc(c, iop);
return ferror(iop) ? EOF : 0;
}
|
|||||||
|
33. | What is the output of this C code? #include
int main()
{
int n;
scanf("%d", &n);
ungetc(n, stdin);
scanf("%d", &n);
printf("%d\n", n);
return 0;
}
|
|||||||
|
34. | What will be the content of 'file.c' after executing the following program? #include
int main()
{
FILE *fp1, *fp2;
fp1=fopen("file.c", "w");
fp2=fopen("file.c", "w");
fputc('A', fp1);
fputc('B', fp2);
fclose(fp1);
fclose(fp2);
return 0;
}
|
|||||||
|
35. | What is the output of this C code? #include
int main(){
FILE *fp1,*fp2;
fp1=fopen("1.text","r");
fp2=fopen("2.txt","r");
fclose(fp1,fp2);
return 0;
}
|
|||||||
|
36. | W #include<stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
int main()
{
struct stat statbuf;
FILE *fb = fopen("/home/jeegar/","r");
if(fb==NULL)
printf("its null\n");
else
printf("not null\n");
stat("/home/jeegar/", &statbuf);
if(S_ISDIR(statbuf.st_mode))
printf("directory\n");
else
printf("file\n");
return 0;
}
|
|||||||
|
« previous
1
2
3
4
5
6
7
next »