stderr, stdin, stdout are FILE pointers
What will be the content of 'file.c' after executing the following program?
#include<stdio.h> int main() { FILE *fp*fp fp1=fopen("file.c", "w"); fp2=fopen("file.c", "w"); fputc('A', fp1); fputc('B', fp2); fclose(fp1); fclose(fp2); return}
Point out the error in the program?
#include<stdio.h> #include<stdlib.h> int main() { unsigned char; FILE *fp; fp=fopen("trial", "r"); if(!fp) { printf("Unable to open file"); exit(1); } fclose(fp); return }
Which of the following statement is correct about the program?
#include<stdio.h> int main() { FILE *fp; char ch; int i= fp = fopen("myfile.c", "r"); while((ch=getc(fp))!=EOF) { if(ch == '\n') i++; } fclose(fp); return }
While calling the fprintf() function in the format string conversion specifier %s can be used to write a character string in capital letters.
A file written in text mode can be read back in binary mode.
What will be the output of the program ?
#include<stdio.h> int main() { int k= printf("%d == 1 is" "%s\n", k, k==1?"TRUE":"FALSE"); return }
#include<stdio.h> int main() { char ch; int i; scanf("%c", &i); scanf("%d", &ch); printf("%c %d", ch, i); return }
#include<stdio.h> int main() { FILE *fp; char str[11], ch; int i= fp = fopen("INPUT.TXT", "r"); while((ch=getc(fp))!=EOF) { if(ch == '\n' || ch == ' ') { str[i]='\0'; strrev(str); printf("%s", str); i= } else str[i++]=ch; } fclose(fp); return }
A text stream is an ordered sequence of characters composed into lines, each line consisting of zero or more characters plus a terminating new-line character.
#include<stdio.h> int main() { printf("%c\n", ~('C'*-1)); return}
Will the following program work?
#include<stdio.h> int main() { int n= printf("n=%*d\n", n, n); return}
#include<stdio.h> char *str = "char *str = %c%s%c; main(){ printf(str,str, 34);}"; int main() { printf(str,str, 34); return}
#include<stdio.h> int main() { int a= printf("%1d\n", a); return }
#include<stdio.h> int main() { FILE *fp; fp=fopen("trial", "r"); fseek(fp, "20", SEEK_SET); fclose(fp); return}
Point out the correct statements about the program?
#include<stdio.h> int main() { FILE *fptr; char str[80]; fptr = fopen("f1.dat", "w"); if(fptr == NULL) printf("Cannot open file"); else { while(strlen(gets(str))> { fputs(str, fptr); fputs("\n", fptr); } fclose(fptr); } return }
Offset used in fseek() function call can be a negative number.
#include<stdio.h> int main() { FILE *fp; unsigned char ch; /* file 'abc.c' contains "This is IndiaBIX " */ fp=fopen("abc.c", "r"); if(fp == NULL) { printf("Unable to open file"); exit(1); } while((ch=getc(fp)) != EOF) printf("%c", ch); fclose(fp); printf("\n", ch); return }
Can we specify a variable filed width in a scanf() format string?
What does fp point to in the program ?
#include<stdio.h> int main() { FILE *fp; fp=fopen("trial", "r"); return }
Please disable the adBlock and continue. Thank you.