MCQOPTIONS
Saved Bookmarks
This section includes 63 Mcqs, each offering curated multiple-choice questions to sharpen your Memory Allocation knowledge and support exam preparation. Choose a topic below to get started.
| 51. |
The advantage of using linked lists over arrays is that ________ |
| A. | Linked list is an example of linear data structure |
| B. | Insertion and deletion of an element can be done at any position in a linked list |
| C. | Linked list can be used to store a collection of homogenous and heterogeneous data types |
| D. | The size of a linked list is fixed |
| Answer» C. Linked list can be used to store a collection of homogenous and heterogeneous data types | |
| 52. |
The type of linked list in which the node does not contain any pointer or reference to the previous node: |
| A. | Circularly singly linked list |
| B. | Singly linked list |
| C. | Circular doubly linked list |
| D. | Doubly linked list |
| Answer» C. Circular doubly linked list | |
| 53. |
What is the output of this program? #include #include int main() { struct test { int i; float f; char c; }; struct test *ptr; ptr = (struct test *)malloc(sizeof(struct test)); ptr ->f = 5.5f; printf("%f", ptr->f); return 0; } |
| A. | 5.5 |
| B. | 5 |
| C. | 5.5 |
| Answer» D. | |
| 54. |
Can we increase the size of statically allocated array? |
| A. | Yes |
| B. | No |
| C. | May Be |
| D. | Can't Say |
| Answer» C. May Be | |
| 55. |
If malloc() successfully allocates memory it returns the number of bytes it has allocated. |
| A. | TRUE |
| B. | FALSE |
| C. | May Be |
| D. | Can't Say |
| Answer» C. May Be | |
| 56. |
Where does the uninitialized data gets stored in memory? |
| A. | Code segment |
| B. | Data segment |
| C. | BSS- Block started by symbol |
| D. | Heap |
| Answer» D. Heap | |
| 57. |
During preprocessing, the code #include gets replaced by the contents of the file stdio.h. Which is true? |
| A. | During linking the code #include replaces by stdio.h |
| B. | Yes |
| C. | During execution the code #include replaces by stdio.h |
| D. | During editing the code #include replaces by stdio.h |
| Answer» C. During execution the code #include replaces by stdio.h | |
| 58. |
If malloc() successfully allocates memory it returns the number of bytes it has allocated. # include #include void fun(int *a) { a = (int*)malloc(sizeof(int)); } int main() { int *p; fun(p); *p = 6; printf("%dn",*p); return(0); } |
| A. | May not work |
| B. | Works and prints 6 |
| C. | Compiler Error |
| D. | Runtime error |
| Answer» B. Works and prints 6 | |
| 59. |
malloc() returns a NULL if it fails to allocate the requested memory. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 60. |
malloc() allocates memory from the heap and not from the stack. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 61. |
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. | True |
| B. | False |
| Answer» C. | |
| 62. |
void * malloc(size_t n) returns: |
| A. | Pointer to n bytes of uninitialized storage |
| B. | NULL if the request cannot be satisfied |
| C. | Nothing |
| D. | Both a & b are true |
| Answer» E. | |
| 63. |
calloc initialises memory with all bits set to zero. |
| A. | true |
| B. | false |
| C. | Depends on the compiler |
| D. | Depends on the standard |
| Answer» B. false | |