iGET

C Programming - MCQ Practice Questions

C questions in placement tests and university exams are rarely about syntax alone. Most of what you will find here is output prediction, pointer arithmetic, arrays and strings, structures and unions, storage classes, recursion, and file handling. The explanations walk through memory behaviour step by step, which is usually where the confusion sits rather than in the code itself.

972 questions | 100% Free

Q.741Medium

Which of the following correctly reads a string from file with size limit?

Q.742Medium

A program needs to update specific bytes in the middle of a file without affecting other data. Which approach is most suitable?

Q.743Medium

What is the difference between 'rb' and 'r' modes when opening a file?

Q.744Medium

In a file opened with 'rb+' mode, what operations can be performed?

Q.745Medium

A program reads structured data: fread(ptr, sizeof(struct), count, fp). If fread() returns a value less than 'count', what could be the reason?

Q.746Hard

How can you determine the size of a file in bytes using standard C functions?

Q.747Hard

When writing binary structures with fwrite(), which precaution is essential for portability across different systems?

Q.748Hard

A program processes a file with multiple reading and writing operations without closing/reopening. What is a potential issue with file buffering?

Q.749Medium

In competitive exam file handling questions, if fseek() is called with SEEK_CUR, what does it indicate?

Q.750Medium

A C program must securely close a file and handle potential errors. What is the best approach?

Q.751Hard

Which scenario would be most problematic when using fprintf() for data that needs exact binary preservation?

Q.752Hard

For reading a configuration file line-by-line where lines may exceed 256 characters, which function is recommended for ISRO/GATE 2024 exams?

Q.753Easy

Which file opening mode allows both reading and writing without truncating existing content?

Q.754Easy

What does fseek(fp, 0, SEEK_END) accomplish?

Q.755Easy

Which function returns the current position of file pointer?

Q.756Easy

Which mode opens file in text format with write permission only?

Q.757Medium

A program needs to append 500 integers to an existing binary file. Which combination is correct?

Q.758Medium

What happens if you call fclose() on an already closed file pointer?

Q.759Medium

A program reads struct records using fread(). After reading 100 records of 64 bytes each, what is the total bytes read if successful?

Q.760Medium

Which statement correctly counts non-comment lines in a text file?