GATE CSE 2017 Session 2 Q12: Match C declarations with their memory meaning
- Programming and Data Structures
- 1 mark
- MCQ
- −1/3 if wrong
Syllabus topic: Programming in C
Question
Match the following:
| Column I | Column II |
|---|---|
| (P) static char var; | (i) Sequence of memory locations to store addresses |
| (Q) m = malloc(10); m = NULL; | (ii) A variable located in data section of memory |
| (R) char *ptr[10]; | (iii) Request to allocate a CPU register to store data |
| (S) register int var1; | (iv) A lost memory which cannot be freed |
Try it: multiple choice: exactly one correct option
Show answer and explanation
Answer: A (official GATE 2017 final answer key)
Concept used: C storage classes and pointers: static variables live in the data section, overwriting the only pointer to heap memory leaks it, an array of pointers stores addresses, and register requests a CPU register.
First step: For each declaration ask where the object lives or what happens to memory, starting with the malloc followed by NULL assignment.
Full step-by-step solution
Loading…
Answer from the official final answer key. Found a mistake? Use Report issue and we will fix it.
More questions on Programming in C
Every PYQ on this topic →Share this question
Source: official GATE 2017 Session 2 CS question paper and final answer key, organised by IIT Roorkee. Question paper · Answer key
More Programming and Data Structures PYQs
- 2026 Session 1 · Q23Non-leaf indices in a 1-indexed binary heap with n odd
- 2026 Session 1 · Q24Empty slots after linear-probing inserts with h(x) = (x+7) mod 11
- 2026 Session 1 · Q33Maximum height of a full binary tree with 23 nodes
- 2026 Session 1 · Q34Output of a C function with a shadowed block variable
- 2026 Session 1 · Q39Recursive length of a non-empty singly linked list
- 2026 Session 1 · Q40Third insertion that can never yield a complete BST of 1..15