Tuesday, 3 February 2015

Interview Questions | Embedded System Basics (Part6)

26. What is a memory leak? What is a segmentation fault?
The memory leak refers to the uncleared memory mat builds up across me lifetime of the process. When it comes to a huge value me system stalls its execution due to me unavailability of the memory. The segmentation fault on the other hand refers to me condition when our program tries to access a memory space that has already been freed up.

27. What is ISR? Can they be passed any parameter and can they return a value?
ISR refers to the Interrupt Service Routines. These are procedures stored at specific memory addresses which are called when certain type of interrupt occurs. The ISRs cannot return a value and they cannot be passed any parameters.

28. a=7; b=8; x=a++-b; printf(“%d”, x ); What does this code give as output?
The compiler understands the statement expression a--b by taking off as much operators as it makes sense to a variable. So (a++) is taken as a parameter and then the expression becomes 8-8 which in turn gives the x value as 0. Thus the output value is 0.

29. What are little endian and big endian types of storage? How can you identify which type of allocation a system follows?
The little endian memory representation allocates the least address to the least significant bit and the big endian is where the highest significant bit takes up the least addressed memory space. We can Identify the system’s usage by defining an integer value and accessing it as a character.
int p=0x2;
if(* (char *) &p == 0x2) printf (“little endian\n”); else printf (“big endian\n”);

30. What is the scope of a function that is declared as static?
The static function when declared within a specific module is scoped only in that module and can only be accessed from it.
More Questions & Answers :-
Part1  Part2  Part3  Part4  Part5  Part6  Part7

No comments:

Post a Comment