Pages

Thursday, February 23, 2023

C File Management Important MCQs

C Programming File Management Important MCQs


1. Which function is used to open a file in C programming language?

(a) fopen()

(b) open()

(c) read()

(d) close()


2. What is the correct syntax of the fopen() function?

(a) fopen("filename", "mode");

(b) fopen("mode", "filename");

(c) fopen("filename", "access");

(d) fopen("access", "filename");


3. Which mode is used to open a file for reading in C programming language?

(a) r

(b) w

(c) a

(d) x


4. Which mode is used to open a file for writing in C programming language?

(a) r

(b) w

(c) a

(d) x


5. What is the syntax of the fclose() function?

(a) fclose();

(b) fclose(file);

(c) fclose("filename");

(d) fclose(filename);


6. Find the purpose of the fseek() function in C File Management.

(a) To move the file pointer to a specific position in the file

(b) To close a file

(c) To read a file

(d) To write to a file


7. What is the purpose of the remove() function in C File Management?

(a) To rename a file

(b) To delete a file

(c) To create a new file

(d) To close a file


8. What is the syntax for opening a file in C programming?

(a) FILE *fp = fopen("filename", "mode");

(b) file fp = fopen("filename", "mode");

(c) FILE *fp = fopen("mode", "filename");

(d) none of these

< Check your ANSWER Here >


No comments:

Post a Comment