A file opened with 'r+b' mode has pointer at position 100. After fwrite(buffer, 1, 50, fp), the pointer is at:
Which approach correctly implements a file copy function for both text and binary files?
A program crashes after reading a file. What's most likely the cause if error checking is minimal?
For a file with 1000 records, which approach minimizes I/O operations?
A program needs to read and write to the same file alternately. Which file mode is most appropriate?
Advertisement
What will be the output of fseek(fp, -10, SEEK_END) in a file of 100 bytes?
In a data structure serialization scenario, what is returned by fwrite() on successful completion?
A competitive exam question requires processing a 500MB CSV file line by line. Which approach is most efficient in terms of memory?
What is the critical issue if ferror(fp) returns non-zero during file operations in a banking application?
What will be the output of the following code?
int *ptr = malloc(sizeof(int));
if(ptr == NULL) printf("Failed");
else printf("Success");
What is a memory leak in C?
What happens when you try to access memory after calling free()?
What is the purpose of realloc() function?
Which of the following is correct for dynamic array allocation?
What is double free error?
Analyze this code:
char *str = malloc(5);
strcpy(str, "Hello");
How many bytes should malloc allocate for safety?
What is the output?
int *p = malloc(sizeof(int) * 3);
p[0] = 1; p[1] = 2; p[2] = 3;
printf("%d", *(p+2));
Which of the following correctly allocates memory for an array of 5 strings (each max 20 characters)?
What is the purpose of typecasting in malloc()?
int *p = (int*)malloc(sizeof(int));
Analyze the memory leak in this code:
void func() {
int *p = malloc(100);
if(condition) return;
free(p);
}