iGET

C Programming - MCQ Practice Questions

Practice free C Programming multiple-choice questions with detailed answers and explanations. Perfect for competitive exam preparation.

978 questions | 100% Free

Q.1Medium

What does fgets() function do?

Q.2Medium

Which function writes formatted data to a file?

Q.3Medium

What is the purpose of ftell() function?

Q.4Medium

Which function sets the file position to a specific location?

Q.5Medium

What does feof() function check?

Q.6Medium

What is the difference between fgetc() and getc()?

Q.7Medium

Which mode allows both reading and writing without truncating?

Q.8Medium

What does fwrite() function return?

Q.9Medium

What is the purpose of rewind() function in file handling?

Q.10Medium

Consider the code: FILE *fp = fopen("data.txt", "r"); if(fp == NULL) { printf("Error"); } What does this check?

Q.11Medium

What happens when fseek() is used with SEEK_END as origin?

Q.12Medium

Which function is used to read a string from a file, including whitespace characters, up to a maximum length?

Q.13Medium

In the context of ferror() function, what does it return?

Q.14Medium

Which mode should be used if you want to read and write to a file without truncating existing content?

Q.15Medium

What is the purpose of the clearerr() function in file handling?

Q.16Medium

Consider a scenario where fopen() fails to open a file. Which of the following is the correct way to handle it?

Q.17Medium

What does ftell() function return?

Q.18Medium

Which of the following fseek() calls will position the file pointer at the end of the file?

Q.19Medium

What is the difference between text mode and binary mode when reading files?

Q.20Medium

Which function is used to read formatted data from a file, similar to scanf() but for files?