Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Home
»
C Programming
»
Input / Output
Which of the following operations can be performed on the file "NOTES.TXT" using the below code? FILE *fp; fp = fopen("NOTES.TXT", "r+");
Reading
Writing
Appending
Read and Write
Correct Answer:
Read and Write
Explanation:
r+
Open an existing file for update (reading and writing).
← Previous Question
Next Question→
More Questions from
Input / Output
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; }
What will be the output of the program? #include
int main() { int k=1; printf("%d == 1 is" "%s\n", k, k==1?"TRUE":"FALSE"); return 0; }
What will be the output of the program? #include
int main() { FILE *ptr; char i; ptr = fopen("myfile.c", "r"); while((i=fgetc(ptr))!=NULL) printf("%c", i); return 0; }
What will be the output of the program? #include
int main() { float a=3.15529; printf("%2.1f\n", a); return 0; }
What will be the output of the program? #include
int main() { int a=250; printf("%1d\n", a); return 0; }
What will be the output of the program? #include
int main() { FILE *fp; char ch, str[7]; fp=fopen("try.c", "r"); /* file 'try.c' contains "This is Nagpur" */ fseek(fp, 9L, SEEK_CUR); fgets(str, 5, fp); puts(str); return 0; }
What will be the output of the program if value 25 given to scanf()? #include
int main() { int i; printf("%d\n", scanf("%d", &i)); return 0; }
What will be the output of the program? #include
int main() { FILE *fp; unsigned char ch; /* file 'abc.c' contains "This is CuriousTab " */ 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 0; }
What will be the output of the program? #include
int main() { printf("%c\n", ~('C'*-1)); return 0; }
What will be the output of the program? #include
int main() { char *p; p="%d\n"; p++; p++; printf(p-2, 23); return 0; }
Discussion & Comments
No comments yet. Be the first to comment!
Name:
Comment:
Post Comment
Join Discussion
Discussion & Comments