InstructionsTotal Questions: 20Total Minutes: 20This ExamTray Free Online Exam or MCQ Quiz tests your C File Read Write Modes, Functions like FOPEN, FCLOSE, FPRINTF, FSCANF, FGETS,FPUTS. Examples are given as questions and answers. Easily Attend Competitive Exams and Job Interview Questions. Go though C Theory Notes on File Handling before taking this test. All the Best Challenge SCORE0 / 20Take This Exam 1*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16*17*18*19*20*Q Buttons 1) What is the need for a File when you can store anything in memory.? A) Memory (RAM) is limited in any computer. B) A file is stored on Hard Disk which can store Gigabytes of data. C) File stored on Hard Disk is safe even if PC is switched off. But Memory or RAM contents are cleared when PC is off. D) All the above 2) What is the keyword used to declare a C file pointer.? A) file B) FILE C) FILEFP D) filefp 3) What is a C FILE data type.? A) FILE is like a Structure only B) FILE is like a Union only C) FILE is like a user define int data type D) None of the above 4) Where is a file temporarily stored before read or write operation in C language.? A) Notepad B) RAM C) Hard disk D) Buffer 5) Choose a correct statement about C file operation program.? int main() { FILE *fp; char ch; fp=fopen("readme.txt","r"); while((ch=fgetc(fp)) != EOF) { printf("%c",ch); } } A) FOPEN opens a file named readme.txt in Read Mode ("r). B) EOF is End Of File. ch==EOF checks for end of file and while loop stops or exits. C) FGETC(fp) is a function that returns one character and cursor goes to next character. D) All the above 6) What is the need for closing a file in C language.? A) fclose(fp) closes a file to release the memory used in opening a file. B) Closing a file clears Buffer contents from RAM or memory. C) Unclosed files occupy memory and PC hangs when on low memory. D) All the above 7) If a FILE pointer is NULL what does it mean.? FILE *fp; fp=fopen("abc.txt","w"); A) Unable to open a file named abc.txt B) abc.txt is not available on disk C) Hard disk has hard ware problems. D) All the above Ad 8) Choose a correct statement about FGETS in C program.? int main() { FILE *fp; char str[80]; fp=fopen("readme.txt","r"); while(fgets(str,80,fp) != NULL) { printf("%s",str); } fclose(fp); } A) str in fgets() is a like a user buffer that can store 80 characters each time B) FGETS returns null if no characters are left C) fgets() reads content from File. FPUS writes content back to File. D) All the above 9) Choose a correct statement about C file "R" mode operation using fopen. fopen("abc.txt","r"); A) If the file abc.txt is found, fopen returns a FILE pointer. B) If the file abc.txt is not found, fopen returns NULL or 0. C) File abc.txt is only opened in Read Mode. Now write operation is performed. D) All the above 10) Choose a correct statement about File Write Mode "w". File *fp; fp=fopen("abc.txt","w"); A) If the file abc.txt is not found File abc.txt is created on disk. B) If the file abc.txt is found, fopen() returns a FILE pointer as usual. Every time, contents of abt.txt are overwritten in "w" mode. C) Read operation is not allowed in "w" mode. D) All the above 11) Choose a correct statement about C File Mode "w+". FILE *p; p=fopen("abc.txt","r+"); A) r+ mode allows reading of existing contents of file abc.txt only if file is found. B) If file is not found, NULL is returned by fopen(). C) You can read existing contents, edit existing content and add new content. D) All the above 12) Choose a correct statement about C file mode "w+". FILE *fp; fp=fopen("abc.txt","w+"); A) Like "w" mode, "w+" mode creates a new file abc.txt if not found. NULL is only returned if some other problems in PC exist in opening a file. B) w+ mode allows you to read the file also. Only after writing, you can read contents if any written. Before writing existing contents are emptied. C) w+ mode always makes a file contents empty like w mode. D) All the above 13) Choose a correct statement about C file mode "a". FILE *fp; fp=fopen("abc.txt","a"); A) "a" is for append operation. You can append or add new content to the existing contents. B) If file is not found, new file is created. C) You can not write read file contents. D) All the above 14) Choose a correct statement about C file mode "a+". FILE *fp; fp=fopen("abc.txt","a+); A) a+ mode always appends new data to the end of existing content B) a+ mode creates a new file if not found or existing. C) a+ mode allows reading also. mode "a" allows only appending not reading. D) All the above Ad 15) Choose a correct statement about opening a file in binary mode for reading. FILE *fp; fp=fopen("abc.txt","rb"); A) rb mode opens the file in binary mode B) Binary mode is just reading or writing in bytes instead of integers, characters or strings. C) Binary mode saves memory occupied by contents. D) All the above 16) What is the syntax for writing a file in C using binary mode.? FILE *fp; A) fp=fopen("abc.txt","wr"); B) fp=fopen("abc.txt","wb"); C) fp=fopen("abc.txt","wbin"); D) fp=fopen("abc.txt","b"); 17) What are the C functions used to read or write a file in Text Mode.? A) fprintf(), fscanf() B) fread(), fwrite() C) fprint(), fscan() D) read(), write() 18) What are the C functions used to read or write a file in Binary Mode.? A) fprintf(), fscanf() B) fread(), rwrite() C) readf(), writef() D) printf(), scanf() 19) What is the C function used to move current pointer to the beginning of file.? FILE *fp; A) rev(fp) B) rewind(fp) C) rew(fp) D) wind(fp) 20) Choose a correct syntax for FSCANF and FPRINTF in c language.? A) fprintf("format specifier",variables, fp); fscanf("format specifier",variables, fp); B) fprintf(fp,count,"format specifier",variables); fscanf(fp,count,"format specifier",variables); C) fprintf(fp,"format specifier",variables); fscanf(fp,"format specifier",variables); D) None of the above FINISH EXAM 1*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16*17*18*19*20*PREVC Program Build Process Online Test NEXTC Bitwise Operators Online Test 1 Certification Group ID 3864