Yes / No Questions

Question 11 :

Can a structure can point to itself?

A). Yes
B). No
Answer : Option A

Explanation :

A structure pointing to itself is called self-referential structures.

Question 12 :

If a char is 1 byte wide, an integer is 2 bytes wide and a long integer is 4 bytes wide then will the following structure always occupy 7 bytes?

struct ex
    char ch;
    int i;
    long int a;

A). Yes
B). No
Answer : Option B

Explanation :

A compiler may leave holes in structures by padding the first char in the structure with another byte just to ensures that the integer that follows is stored at an location. Also, there might be 2extra bytes after the integer to ensure that the long integer is stored at an address, which is multiple of 4. Such alignment is done by machines to improve the efficiency of accessing values.