XiLinx Interview Questions and Answers for 4 years Experience
- In order to align the data in memory, Â one or more empty bytes (addresses) are inserted (or left empty) between memory addresses which are allocated for other structure members while memory allocation. This concept is called structure padding.
- Architecture of a computer processor is such a way that it can read 1 word (4 byte in 32 bit processor) from memory at a time.
- To make use of this advantage of processor, data are always aligned as 4 bytes package which leads to insert empty addresses between other member’s address.
- Because of this structure padding concept in C, size of the structure is always not same as what we think.
- As per C concepts, int and float datatypes occupy 4 bytes each and char datatype occupies 1 byte for 32 bit processor. So, only 14 bytes (4 4 1 1 4) should be allocated for above structure.
- But, this is wrong. Â Do you know why?
- Architecture of a computer processor is such a way that it can read 1 word from memory at a time.
- 1 word is equal to 4 bytes for 32 bit processor and 8 bytes for 64 bit processor. So, 32 bit processor always reads 4 bytes at a time and 64 bit processor always reads 8 bytes at a time.
- This concept is very useful to increase the processor speed.
- To make use of this advantage, memory is arranged as a group of 4 bytes in 32 bit processor and 8 bytes in 64 bit processor.
1 / 6
No Discussion on this question yet!
No Tags on this question yet!
2 / 6
    For example, please consider below structure that has 5 members.
Â
struct student
{
    int id1;
    int id2;
    char a;
    char b;
    float percentage;
};..
No Tags on this question yet!
3 / 6
No Discussion on this question yet!
No Tags on this question yet!
4 / 6
No Discussion on this question yet!
No Tags on this question yet!
5 / 6
No Discussion on this question yet!
No Tags on this question yet!
6 / 6
No Discussion on this question yet!
No Tags on this question yet!
1 / 7
No Discussion on this question yet!
No Tags on this question yet!
2 / 7
No Discussion on this question yet!
No Tags on this question yet!
3 / 7
No Discussion on this question yet!
No Tags on this question yet!
4 / 7
No Discussion on this question yet!
No Tags on this question yet!
5 / 7
No Discussion on this question yet!
No Tags on this question yet!
6 / 7
No Discussion on this question yet!
No Tags on this question yet!
7 / 7
No Discussion on this question yet!
No Tags on this question yet!
1 / 13
No Discussion on this question yet!
No Tags on this question yet!
2 / 13
No Discussion on this question yet!
No Tags on this question yet!
3 / 13
No Discussion on this question yet!
No Tags on this question yet!
4 / 13
No Discussion on this question yet!
No Tags on this question yet!
5 / 13
No Discussion on this question yet!
No Tags on this question yet!
6 / 13
No Discussion on this question yet!
No Tags on this question yet!
7 / 13
No Discussion on this question yet!
No Tags on this question yet!
8 / 13
No Discussion on this question yet!
No Tags on this question yet!
9 / 13
No Discussion on this question yet!
No Tags on this question yet!
10 / 13
No Discussion on this question yet!
No Tags on this question yet!
11 / 13
No Discussion on this question yet!
No Tags on this question yet!
12 / 13
No Discussion on this question yet!
No Tags on this question yet!
13 / 13
No Discussion on this question yet!
No Tags on this question yet!
1 / 9
No Discussion on this question yet!
No Tags on this question yet!
2 / 9
No Discussion on this question yet!
No Tags on this question yet!
3 / 9
No Discussion on this question yet!
No Tags on this question yet!
4 / 9
No Discussion on this question yet!
No Tags on this question yet!
5 / 9
No Discussion on this question yet!
No Tags on this question yet!
6 / 9
No Discussion on this question yet!
No Tags on this question yet!
7 / 9
No Discussion on this question yet!
No Tags on this question yet!
8 / 9
No Discussion on this question yet!
No Tags on this question yet!
9 / 9
De-referencing a null pointer will lead to SEGV because you are trying to access a memory location which does not exist.
No Tags on this question yet!