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
Which scenario represents a use-after-free error?
For storing variable-length strings dynamically in a competitive program, what's the safest approach?
What potential issue occurs with this code in a large-scale system? while(1) { int *arr = malloc(1000000); }
In graph algorithms with dynamic adjacency lists, what's the memory requirement for a sparse graph with V vertices and E edges?
What is the advantage of dynamic allocation over static allocation in competitive programming?
Which function should be used to allocate memory for an array of 50 structures of size 'sizeof(struct Node)' and initialize to zero?
What happens when you try to free a pointer that was not allocated by malloc/calloc/realloc?
Which of the following correctly deallocates a 2D dynamically allocated array created as int **arr?
What happens when realloc() is called on a pointer allocated by malloc() with a larger size?
For implementing a dynamic circular buffer of size n, how many pointers are minimally required?
Which scenario is most likely to cause a segmentation fault in dynamic memory?
In competitive programming for graph problems, if adjacency list uses dynamic arrays, what is the time complexity of adding an edge?
What is the correct way to store variable-length strings dynamically?