Tuesday 3 February 2015

Real-Time Embedded Systems Interview Questions and Answers (Part2)

6.Advantages and disadvantages of using macro and inline functions?
Ans : Advantage: Macros and Inline functions are efficient than calling a normal function. The times spend in calling the function is saved in case of macros and inline functions as these are included directly into the code.
Disadvantage: Macros and inline functions increased the size of executable code.
Difference in inline functions and macro
1) Macro is expanded by preprocessor and inline function are expanded by compiler.
2) Expressions passed as arguments to inline functions are evaluated only once while _expression passed as argument to inline functions are evaluated more than once.
More over inline functions are used to overcome the overhead of function calls. Macros are used to maintain the readability and easy maintenance of the code.

7.What happens when recursion functions are declared inline?
It is illegal to declare a recursive function as inline. Even a function is declared as inline compiler judges it to be inline or not. Many compilers can also inline expand some recursive functions; recursive macros are typically illegal.

8.Scope of static variables?
Ans:Scope of static variable is within the file if it is static global. Scope of static variable is within the function if variable is declared local to a function.
But the life time is throughout the program

9. What is the difference between a ‘thread’ and a ‘process’?
Ans:
process
In computing, a process is an instance of a computer program that is being sequentially executed by a computer system that has the ability to run several computer programs concurrently.
Thread
A single process may contain several executable programs (threads) that work together as a coherent whole. One thread might, for example, handle error signals, another might send a message about the error to the user, while a third thread is executing the actual task of the..

10. What is a Inode?
Ans:
In computing, an inode is a data structure on a traditional Unix-style file system such as UFS. An inode stores basic information about a regular file, directory, or other file system object.
More Questions & Answers :-
Part1  Part2  Part3  Part4  Part5  Part6  Part7

No comments:

Post a Comment