Tuesday 3 February 2015

Basic embedded systems interview questions and answers (Part3)

11. What is pass by value and pass by reference? How are structure passed as arguments?
The parameter to a function can be a copy of a value that is represented by variable or can be a reference to a memory space that stores value of variable. The former is referred to as pass by value and the latter is referred to as pass by reference. The difference is that when parameters are passed by value the changes made to the variable value within the function is not reflected in the caller function, but when passed as reference changes are reflected outside the called function. The structures are always passed by reference.

12. What is difference between using a macro and a in line function?
The macro are just symbolic representations and cannot contain data type differentiations within the parameters that we give. The in line functions can have the data types too defined as a part of them. The disadvantage in using both is that the inclusion of condition checks may lead to increase in code space if the function is called many times.

13. What is the volatile keyword used for?
The volatile keyword is used to represent variables that point to memory in other mapped devices. In such a case the value of the variable can be changed outside of a program. The compiler does not do additional optimizations to the code if there is volatile keyword.

14. What are hard and soft Real time systems?
The hard real time systems are the once that depend on the output very strictly on time. Any late response or delay cannot be tolerated and will always be considered a failure. The soft real time systems on the other are not very rigid as the hard real time systems. The performance of the system degrades with the lateness of response, but it is bearable and can be optimized to a certain level for reuse of the result.

15. What is a semaphore? what are the different types of semaphore?
The semaphore is an abstract data store that is used to control resource accesses across the various threads of execution or across different processes. There are
two types of semaphores:
• The binary semaphore which can take only 0,1 values. (used when there is contention for a single resource entity)
• The counting semaphore which can take incremental values to certain limit (used when number of resources is limited).
More Questions & Answers :-
Part1  Part2  Part3  Part4  Part5  Part6  Part7

No comments:

Post a Comment