Memory Allocation MCQ
Test your knowledge with important Memory Allocation MCQ and their applications. These MCQs are beneficial for competitive exams too. Explore 30+ more Memory Allocation MCQs on Bissoy. Bissoy App
-
The incorrect statement with respect to dangling pointers is . . . . . . . .
-
The advantage of using linked lists over arrays is that . . . . . . . .
-
The number of arguments taken as input which allocating memory dynamically using malloc() is . . . . . . . .
-
The type of linked list in which the node does not contain any pointer or reference to the previous node is . . . . . . . .
-
Queue data structure works on the principle of . . . . . . . .
-
Suppose we have a one dimensional array, named 'x', which contains 10 integers. Which of the following is the correct way to allocate memory dynamically to the array 'x' using malloc()?
-
Garbage collector frees the programmer from worrying about . . . . . . . .
-
In the function realloc(), if the new size of the memory block is larger than the old size, then the added memory . . . . . . . .
-
What will happens if the statement free(a) is removed in the following C code?<br><pre><code class="c-program">#include<stdio.h>#include<stdlib.h>main(){ int *a; a=(int*)malloc(sizeof(int)); *a=100; printf("*a%d",*a); free(a); a=(int*)malloc(sizeof(int)); *a=200; printf("a%p",a); *a=200; printf("a%d",*a);}</code></pre>
-
What will be the error (if any) in the following C code?<br><pre><code class="c-program">#include<stdio.h>#include<stdlib.h>#include<string.h>int main(){ char *p; *p = (char)calloc(10); strcpy(p, "HELLO"); printf("%s", p); free(p); return 0;}</code></pre>
-
A condition where in memory is reserved dynamically but not accessible to any of the programs is called . . . . . . . .
-
If malloc() and calloc() are not type casted, the default return type is . . . . . . . .
-
The following C code is an example of . . . . . . . .<br><pre><code class="c-program">#include<stdio.h>#include<stdlib.h>#include<string.h>main(){ char *p,*q; p=(char*)malloc(3*sizeof(char)); q=p; strcpy(p,"hello"); printf("p=%s",p); printf("q=%s",q); free(q); q=NULL; gets(p); gets(q); printf("%s",p); printf(“%s”,q);}</code></pre>
-
If the space in memory allocated by malloc is not sufficient, then an allocation fails and returns . . . . . . . .
-
Local variables are stored in an area called . . . . . . . .
-
When the pointer is NULL, then the function realloc is equivalent to the function . . . . . . . .
-
The free() function frees the memory state pointed to by a pointer and returns . . . . . . . .
-
Array is preferred over linked list for the implementation of . . . . . . . .
-
With every use of a memory allocation function, what function should be used to release allocated memory, which is no longer needed?
-
The number of arguments for realloc() function is/are:
-
What is a memory fragment in C?
-
In C, what is the purpose of the 'realloc' function?
-
Which function is used to release all dynamically allocated memory in C?
-
What is the difference between 'free' and 'delete' in C?
-
Which function is used to allocate memory for a structure in C?
-
What is the primary advantage of using dynamic memory allocation in C?
-
What happens if you attempt to free the same block of memory twice in C?
-
In C, which function is used to allocate memory from the stack?
-
What is the difference between 'malloc' and 'calloc' in C?
-
What is the maximum number of bytes that can be allocated using 'malloc' in C?