iGET

C Programming - MCQ Practice Questions

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

972 questions | 100% Free

Q.141Hard

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

Q.142Hard

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

Q.143Hard

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

Q.144Hard

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

Q.145Hard

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

Q.146Hard

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

Q.147Hard

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

Q.148Hard

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

Q.149Hard

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

Q.150Hard

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

Q.151Hard

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

Q.152Hard

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

Q.153Hard

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

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

Q.155Hard

Which statement about dynamic memory is TRUE?

Q.156Hard

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

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

Q.158Hard

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

Q.159Hard

What is a common mistake in this code? void func() { int *ptr; ptr = malloc(sizeof(int) * 5); func2(ptr); free(ptr); } void func2(int *p) { free(p); }

Q.160Hard

What is the risk in this code? char *str = malloc(5); strcpy(str, "Hello World");