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.341Medium

Which function sets the file position to a specific location?

Q.342Medium

What does feof() function check?

Q.343Medium

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

Q.344Medium

Which mode allows both reading and writing without truncating?

Q.345Medium

What does fwrite() function return?

Q.346Medium

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

Q.347Medium

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

Q.348Medium

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

Q.349Medium

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

Q.350Medium

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

Q.351Medium

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

Q.352Medium

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

Q.353Medium

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

Q.354Medium

What does ftell() function return?

Q.355Medium

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

Q.356Medium

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

Q.357Medium

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

Q.358Medium

What will be the behavior of fgets() when reading from an empty line in a file?

Q.359Medium

A program reads a text file line by line using fgets(). If a line contains more characters than the buffer size, what happens?

Q.360Medium

A file is opened in binary mode. How will fseek() behave differently compared to text mode?