Array and Pointer: GATE CS Previous Year Questions

Array and Pointer · Programming in C

54 questions · asked in 22 of 27 years (2000–2026)

MCQ 39 · MSQ 1 · NAT 141-mark 34 · 2-mark 20

2000Questions per year2026

Questions 51–54 of 54

Q51GATE 20001 markMCQ−0.33 if wrong
Consider the following C declaration:
 struct { 
    short x[5];  
    union { 
        float y; 
        long z; 
    } u;
 } t;

Assume that the objects of the type short, float and long occupy 2 bytes, 4 bytes and 8 bytes, respectively. The memory requirement for variable t, ignoring alignment consideration, is:

Q52GATE 20001 markMCQ−0.33 if wrong
Aliasing in the context of programming languages refers to

Q53GATE 20001 markMCQ−0.33 if wrong
The most appropriate matching for the following pairs is:

X:m = malloc(5); m = NULL;1:using dangling pointersY:free(n); n -> value = 5;2:using uninitialized pointersZ:char *p , *p = ’a’ ; 3:lost memory\begin{array}{|ll|ll|}\hline X: & \text{m = malloc(5); m = NULL;} & 1: & \text{using dangling pointers} \\\hline Y: & \text{free(n); n -> value = 5;} & 2: & \text{using uninitialized pointers} \\\hline Z: & \text{char *p , *p = 'a' ; } & 3: & \text{lost memory} \\\hline \end{array}

Q54GATE 20001 markMCQ−0.33 if wrong
The following C declarations:
 struct node { 
    int i;
    float j;
 };
 struct node *s[10];
define s to be:

Keep practising

Topics in Programming in C

All CS topics ›