Machine-translated by Google. Questions are authored in English.
Top

Typedef Questions and Answers

61.

Which of the following is an example of static memory allocation?

Answer: D

Correct answer: Array

An array declared with a fixed size has its storage settled at compile time, in the stack frame or the data segment according to where it is declared. Nothing is requested at run time and nothing is freed.

The other three are dynamic structures built from nodes obtained with malloc as they are needed. A stack and a queue can be implemented over a fixed array, but as abstract structures they grow and shrink, which is what places them on the dynamic side of the distinction.

Please log in or register to report this question.

62.

Array is preferred over linked list for the implementation of ________

Answer: C

When we try to implement binary search using linked list, the traversal steps per element increases in order to find the middle element. Thus, this process is slow and inefficient. This process is much faster using an array, hence it is preferable to use an array for the implementation of binary search.

Please log in or register to report this question.

Answer: B

Correct answer: Insertion and deletion of an element can be done at any position in a linked list

A linked list stores each element with a pointer to the next, so inserting or removing one is a matter of adjusting two pointers rather than shifting every following element as an array requires. The other options fail: both structures are linear, both hold homogeneous data, and it is the array whose size is fixed while the list grows as needed.

Please log in or register to report this question.

Loading…

Other Subjects

Tags: Typedef Questions and Answers || Typedef MCQ Questions and Answers || Typedef GK Questions and Answers || Typedef GK MCQ Questions || Typedef Multiple Choice Questions and Answers || Typedef GK || GK on Typedef || C Programming Questions and Answers || C Programming MCQ Questions and Answers || C Programming GK Questions and Answers || GK on C Programming