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.141Hard

A program writes binary data using fwrite() but reads it back with fprintf(). What will happen?

Q.142Hard

A program uses fgetc() to read 100,000 characters from a file sequentially. Which alternative would be more efficient?

Q.143Hard

A large binary file of 10GB is being processed. Reading entire file into memory is impossible. Which approach is best?

Q.144Hard

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

Q.145Hard

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

Q.146Hard

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

Q.147Hard

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

Q.148Hard

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

Q.149Hard

What does rewind(fp) accomplish compared to fseek(fp, 0, SEEK_SET)?

Q.150Hard

A program processes encrypted binary data with fread(). Why might using 'r' mode instead of 'rb' cause corruption?

Q.151Hard

For competitive exam file validation: A 2GB file must be processed without loading entirely in memory. Which strategy is optimal?

Q.152Hard

When implementing a log file writer with concurrent access, what's the critical issue with standard fopen()?

Q.153Hard

A program reads serialized objects using fread(). What's the primary risk when file format changes between versions?

Q.154Hard

For implementing a file locking mechanism in a competitive exam environment, which approach correctly handles concurrent file access in POSIX systems?

Q.155Hard

In a program that processes binary files with variable-length records, what could cause fread() to return fewer items than requested without reaching EOF?

Q.156Hard

What will happen if malloc() fails and returns NULL but code doesn't check?

Q.157Hard

Which statement about dynamic memory is TRUE?

Q.158Hard

What is the issue in this code? void func() { int *p = malloc(sizeof(int)); *p = 5; } int main() { func(); // p is not accessible here return 0; }

Q.159Hard

What is the correct way to allocate memory for 2D dynamic array (3x4)?

Q.160Hard

What does this realloc() call do? int *p = malloc(5 * sizeof(int)); p = realloc(p, 10 * sizeof(int));