WorksheetsPointer
Total questions: 8
Worksheet time: 4mins
Local variables are stored in an area called____________
Heap
Permanent storage area
Stack
Free memory
The size of both stack and heap remains the same during run time.
True
False
Which of the following is an example for non linear data type?
Array
Tree
Linked List
Stack
The advantage of using linked lists over arrays is that________________________
Linked list is an example of linear data structure
Insertion and deletion of an element can be done faster in a linked list
Linked list can be used to store a collection of homogeneous and heterogeneous data types
The size of a linked list is fixed
What is the return type of malloc() or calloc()?
Pointer of allocated memory type
void**
void*
int*
What is the problem with following code?
#include<stdio.h>
int main(){
int *p = (int *)malloc(sizeof(int));
p = NULL;
free(p);
}
Dangling pointer
The program may crash as free() is called for NULL pointer
Memory Leak
Compiler Error: free can't be applied on NULL pointer
What is the problem with following code?
#include<stdio.h>
int main(){
int *p = (int *)malloc(sizeof(int));
free(p);
}
Dangling pointer
The program may crash as free() is called for NULL pointer
Memory Leak
Compiler Error: free can't be applied on NULL pointer
Which languages necessarily need heap allocation in the run time environment?
Those that support recursion
Those that allow dynamic data structures
Those that use dynamic scoping
Those that use dynamic scoping
