Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

25 Best Embedded Systems Interview Questions and Answers

http://placement.freshersworld.com/redpine-placement-
papers/electronics-communication-engineering-
ece/33133052
1. What is watchdog timer?
A watchdog timer (or computer operating properly timer) is a computer hardware
timing device that triggers a system reset if the main program, due to some fault
condition, such as a hang, neglects to regularly service the watchdog. The intention is to
bring the system back from the hang state into normal operation

2. What is semaphore?
In computer science, a semaphore is a protected variable(signaling mechanism) or abstract
data type which constitutes the classic method for restricting access to shared resources such
as shared memory in a parallel programming environment. A counting semaphore is a
counter for a set of available resources, rather than a locked/unlocked flag of a single
resource.
3. What is mutex?
Mutual exclusion (often abbreviated to mutex) algorithms are used in concurrent
programming to avoid the simultaneous use of a common resource, such as a global variable,
by pieces of computer code called critical sections.

4. Can structures be passed to the functions by value?


yes structures can be passed by value. But unnecessary memory wastage.

5. Why cannot arrays be passed by values to functions?


When a array is passed to a function, the array is internally changed to pointer. And pointers
are always passed by reference.
6. Advantages and disadvantages of using macro and inline functions?
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?


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’?
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 t
10. 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.
11. What is difference between using a macro and a inline 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.

12. 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.
13. 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.

14. 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:
a] The binary semaphore which can take only 0,1 values. (used when there is contention for a
single resource entity)
b]The counting semaphore which can take incremental values to certain limit (used when
number of resources is limited).
15. What are recursive functions? Can we make them in line?
The recursive functions refer to the functions which make calls to itself before giving out the
final result. These can be declared as in-line functions and the compiler will allocate the
memory space intended for the first call of the function.
16. What is the size of the int, char and float data types?
The size of the char and int are always dependent on the underlying operating system or
firmware. This is limited to the number of address lines in the address bus.
The int usually takes up a value of 2 bytes or 4 bytes. The char can take up a space of 1 or 2
bytes. The float data type takes up a value of 4 bytes.
17. What does malloc do? What will happen if we have a statement like
malloc(sizeof(0))?
Malloc is the function that is used for dynamically allocating memory to the different
variables. The malloc returns a memory pointer of void type (void *). The statement
malloc(sizeof(0)) returns a valid integer pointer because sizeof(0) represents the size of
memory taken up by the integer value of 0. The memory allocated by malloc is not
automatically cleaned up by the compiler after execution of the functions and should be
cleaned up by the programmer using the free() function.
18.What is meant by a forward reference in C?
The forward reference refers to the case when we point an address space of a smaller data
type with a pointer of a bigger data type This can be pictured as allocating memory in single
bytes and accessing it with integer pointer as chunks of 4.
19. Explain the properties of a Object oriented programming language.
A]Encapsulation: The data that are related to the specific object are contained inside the
object structure and hidden from the other entities of the environment
B] Polymorphism: The mechanism by which the same pointer can refer to different types of
objects, which are basically linked by some generic commonality.
C] Abstraction: Hiding the data and implementation details from the real objects. The
framework of reference is still present to be used by the other objects.
D] Inheritance: The way to take out the common features and have them as separate object
entities only to be reused by the other objects in a modular fashion.
20. What do you mean by interrupt latency?

Visit More Questions & Answers: www.skills9.com

You might also like