MCQOPTIONS
Saved Bookmarks
This section includes 7 Mcqs, each offering curated multiple-choice questions to sharpen your Technical MCQs knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
malloc() allocates memory from the heap and not from the stack. |
| A. | TRUE |
| B. | FALSE |
| C. | May Be |
| D. | Can't Say |
| E. | |
| Answer» B. FALSE | |
| 2. |
malloc() returns a float pointer if memory is allocated for storing float's and a double pointer if memory is allocated for storing double's.A. |
| A. | TRUE |
| B. | FALSE |
| C. | May Be |
| D. | Can't Say |
| Answer» C. May Be | |
| 3. |
Which languages necessarily need heap allocation in the run time environment? |
| A. | Those that support recursion |
| B. | Those that use dynamic scoping |
| C. | Those that use global variables |
| D. | Those that allow dynamic data structures |
| Answer» E. | |
| 4. |
Which of the following is/are true |
| A. | calloc() allocates the memory and also initializes the allocates memory to zero, while memory allocated using malloc() has random data. |
| B. | malloc() and memset() can be used to get the same effect as calloc() |
| C. | Both malloc() and calloc() return 'void *' pointer |
| D. | All of the above |
| Answer» E. | |
| 5. |
Among 4 header files, which should be included to use the memory allocation functions like malloc(), calloc(), realloc() and free()? |
| A. | #include<string.h> |
| B. | #include<stdlib.h> |
| C. | #include<memory.h> |
| D. | Both b and c |
| Answer» C. #include<memory.h> | |
| 6. |
Which function is used to delete the allocated memory space? |
| A. | Dealloc() |
| B. | free() |
| C. | Both A and B |
| D. | None of the above |
| Answer» C. Both A and B | |
| 7. |
What is the return type of malloc() or calloc()? |
| A. | int * |
| B. | int ** |
| C. | void * |
| D. | void ** |
| Answer» D. void ** | |