OA. free
Free
Qualcomm Embedded Systems & Hardware Embedded Systems & Hardware Medium

Which one of the given options is not possible statically in C?

Qualcomm technical mcq question, verified with a worked answer. Free to practise - no sign-up.

Which one of the given options is not possible statically in C?

Choose one option.
Show answer & explanation
Answer: C. Jagged Array

In C, static array declarations require fixed dimensions known at compile time. Multidimensional, cuboidal, and rectangular arrays all use contiguous memory with fixed row and column sizes. Jagged arrays (arrays of arrays with varying row lengths) require dynamic allocation or pointer arithmetic, making them impossible to declare as a true static structure in pure C without pointer indirection.

Step-by-step Derivation:
Static array declarations in C:

  1. Multidimensional: int arr[3][4]; — rectangular block, all rows same size ✓
  2. Cuboidal: int arr[2][3][4]; — 3D block, all dimensions fixed ✓
  3. Rectangular: int arr[5][10]; — 2D block, rows × columns ✓
  4. Jagged: Would need int *arr[3]; with dynamic allocation for each row — NOT static ✗

Jagged arrays require pointer-based dynamic memory allocation because each row can have a different length, violating the compile-time fixed-size requirement of static arrays.