Question 180Asked in DSSSB TGT Computer Science, 25 Jun 2023, Shift 3 (4:30 PM)

What is the main difference between a dynamic array and a static array in C programming?

  1. AStatic arrays are stored in the stack, while dynamic arrays are stored in the heap.
  2. BDynamic arrays can be resized during runtime, while static arrays have a fixed size.
  3. CStatic arrays can be resized during runtime, while dynamic arrays have a fixed size.
  4. DDynamic arrays are stored in the stack, while static arrays are stored in the heap.
Show answerHide answer

Correct answer: (B) Dynamic arrays can be resized during runtime, while static arrays have a fixed size.

Explanation

A static array's size is fixed at compile time. A dynamic array (created with malloc or realloc) can be resized at runtime.

From DSSSB TGT Computer Science PYQ, 25 Jun 2023, Shift 3 (4:30 PM)

This is question 180 of DSSSB TGT Computer Science PYQ, 25 Jun 2023, Shift 3 (4:30 PM). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.