Dynamic Memory Allocation MCQ

31. Local variables are stored in an area called ___________

A. Heap
B. Permanent storage area
C. Free memory
D. Stack

View Answer

32. Choose the statement which is incorrect with respect to dynamic memory allocation.

A. Memory is allocated in a less structured area of memory, known as heap
B. Used for unpredictable memory requirements
C. Execution of the program is faster than that of static memory allocation
D. Allocated memory can be changed during the run time of the program based on the requirement of the program

View Answer

33. 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

View Answer

34. 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

View Answer

35. Which of the following is an example for non linear data type?

A. Tree
B. Array
C. Linked list
D. Queue

View Answer

36. If malloc() successfully allocates memory it returns the number of bytes it has allocated.

# include<stdio.h>
void fun(int *a)
    a = (int*)malloc(sizeof(int));
int main()
    int *p;
    *p = 6;

A. May not work
B. Works and prints 6
C. Compiler Error
D. Runtime error

View Answer

37. 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

View Answer

38. Why to use fflush() library function?

A. To flush all streams and specified streams
B. To flush only specified stream
C. To flush input/output buffer
D. Invalid library function

View Answer

39. Why is calloc() function used for?

A. allocates the specified number of bytes
B. allocates the specified number of bytes and initializes them to zero
C. increases or decreases the size of the specified block of memory and reallocates it if needed
D. calls the specified block of memory for execution.

View Answer

40. Which is the correct sequence of compilation process?

A. Assembler -> Compiler -> Preprocessor -> Linking
B. Compiler -> Assenbler -> Preprocessor -> Linking
C. Preprocessor -> Compiler -> Assembler -> Linking
D. Assembler -> Compiler -> Linking -> Preprocessor

View Answer

Also check :


* You must be logged in to add comment.