Embedded Systems Interview Questions of 2019
Q1. What Is Pass via Value and Pass by using Reference? How Are Structure Passed As Arguments?
Ans: The parameter to a feature can be a replica of a price this is represented through variable or may be a reference to a memory space that stores price of variable. The former is referred to as skip via price and the latter is called bypass with the aid of reference. The distinction is that once parameters are passed via value the changes made to the variable fee in the function is not reflected within the caller feature, but when passed as reference modifications are meditated out of doors the called characteristic. The structures are continually passed through reference.
Q2. What Is The Volatile Keyword Used For?
Ans: The unstable keyword is used to represent variables that factor to reminiscence in other mapped devices. In this sort of case the value of the variable may be changed outside of a application. The compiler does not do additional optimizations to the code if there is unstable keyword.
Q3. What Is A Semaphore? What Are The Different Types Of Semaphore?
Ans: The semaphore is an abstract facts store that is used to govern useful resource accesses throughout the numerous threads of execution or throughout special tactics. There are styles of semaphores:
The binary semaphore which can take handiest 0, 1 values. (used when there may be rivalry for a unmarried useful resource entity).
The counting semaphore which could take incremental values to sure restriction (used whilst range of resources is restrained).
Q4. What Is Meant By A Forward Reference In C?
Ans: The forward reference refers to the case while we factor an deal with area of a smaller facts kind with a pointer of a larger statistics type. This can be pictured as allocating reminiscence in single bytes and getting access to it with integer pointer as chunks of four.
Q5. What Does Malloc Do? What Will Happen If We Have A Statement Like Malloc(sizeof(zero));
Ans: Malloc is the feature that is used for dynamically allocating reminiscence to the exclusive variables. The malloc returns a memory pointer of void type (void *). The statement malloc(sizeof(0)) returns a valid integer pointer because sizeof(zero) represents the scale of reminiscence taken up by the integer price of zero. The memory allotted by using reminiscence isn't mechanically cleaned up by the compiler after execution of the features and should be cleaned up by using the programmer the usage of the unfastened () function.
Q6. What Is Difference Between Using A Macro And Inline Function?
Ans: The macro are simply symbolic representations and cannot comprise facts kind differentiations inside the parameters that we supply. The inline functions may have the records types too described as a part of them. The disadvantage in using both is that the inclusion of situation assessments might also result in growth in code space if the feature is known as generally.
Q7. What Are Hard and Soft Real Time Systems?
Ans: The hard real time Embedded Systems are the only that depend upon the output very strictly on time. Any overdue response or put off cannot be tolerated and could constantly be considered a failure. The soft real time systems on the other are not very inflexible because the tough real time systems. The performance of the machine degrades with the lateness of reaction, but it is bearable and may be optimized to a positive stage for reuse of the result.
Q8. What Are Recursive Functions? Can We Make Them Inline?
Ans: The recursive functions seek advice from the features which make calls to it earlier than giving out the very last end result. These can be declared as in-line capabilities and the compiler will allocate the memory area intended for the primary call of the function.
Q9. What Is The Size Of The Int, Char And Float Data Types?
Ans: The length of the char and int are usually dependent on the underlying working system or firmware. This is confined to the number of cope with strains within the deal with bus. The int commonly takes up a price of 2 bytes or four bytes. The char can take up a space of one or 2 bytes. The waft records kind takes up a price of 4 bytes.
Q10. What Is The Use Of Having The Const Qualifier?
Ans: The const qualifier identifies a particular parameter or variable as examine-simplest attribute to the characteristic or to the whole software. This can are available on hand when we are handling static statistics interior characteristic and in a software.
Q11. Can A Pointer Be Volatile?
Ans: Yes, even though this is not very commonplace. An instance is when an interrupt provider routine modifies a pointer to a buffer.
Q12. What Is Loop Unrolling?
Ans: Small loops can be unrolled for higher performance, with the disadvantage of elevated code size. When a loop is unrolled, a loop counter desires to be up to date less regularly and fewer branches are accomplished. If the loop iterates only some times, it could be absolutely unrolled, so that the loop overhead completely disappears.
Q13. What Is The Order Of Calling For The Constructors And Destructors In Case Of Objects Of Inherited Classes?
Ans: The constructors are called with base elegance first order and the destructors are referred to as in the child first order. That is, the if we've got 2 stages of inheritance A (base)-> B (inherit 1)-> C (inherit 2) then the constructor A is referred to as first observed via B and C. The C destructor is known as first followed through B and A.
Q14. What Typecast Is Applied When We Have A Signed And An Unsigned Int In An Expression?
Ans: The unsigned int is typecast into the signed fee.
Q15. How Are Variables Mapped Across To The Various Memories By The C Compiler?
Ans: The compiler maintains the symbol desk which has the associated records of all of the variable names along with the length of the allotted area, the get entry to unit period for the pointer (type of pointer) and the beginning address of the reminiscence space.
Q16. What Is A Memory Leak? What Is A Segmentation Fault?
Ans: The reminiscence leak refers to the uncleared memory may additionally builds up throughout lifetime of the method. When it comes to a big price gadget stalls its execution due to unavailability of the memory. The segmentation fault however refers to circumstance while our software attempts to get right of entry to a reminiscence space that has already been freed up.
Q17. What Are Little Endian And Big Endian Types Of Storage? How Can You Identify Which Type Of Allocation A System Follows?
Ans: The little endian memory illustration allocates the least address to the least extensive bit and the big endian is in which the best good sized bit takes up the least addressed reminiscence space. We can become aware of the machine’s utilization by way of defining an integer cost and gaining access to it as a man or woman.
if(* (char *) &p == 0x2) printf (“little endiann”);
else printf (“massive endiann”);
Q18. Explain The Properties Of A Object Oriented Programming Language.
Encapsulation: The data that are associated with the specific item are contained in the object structure and hidden from the opposite entities of the environment.
Polymorphism: The mechanism by which the equal pointer can refer to unique styles of items, which might be basically connected by a few prevalent commonality.
Abstraction: Hiding the information and implementation information from the actual gadgets. The framework of reference is still gift to be used by the opposite items.
Inheritance: The way to take out the commonplace features and feature them as separate item entities handiest to be reused by the other items in a modular style.
Q19. What Do You Mean By Interrupt Latency?
Ans: Interrupt latency refers to the time taken for the system to begin the handler for the particular interrupt. The time from the time of arrival of interrupt to the time it's far being dealt with.
Q20. What Is The Scope Of A Function That Is Declared As Static?
Ans: The static feature while declared inside a specific module is scoped simplest in that module and might simplest be accessed from it.
Q21. What does DMA cope with will deal with?
Ans: DMA address deals with physical addresses. It is a tool which without delay drives the statistics and deal with bus all through statistics transfer. So, it's far in simple terms bodily cope with.
Q22. Mention what are buses used for communique in embedded machine?
Ans: For embedded device, the buses used for verbal exchange includes
I2C: It is used for communication between multiple ICs
CAN: It is utilized in automobiles with centrally managed community
USB: It is used for communique among CPU and gadgets like mouse, and so forth.
While ISA, EISA, PCI are fashionable buses for parallel communication used in PCs, laptop network gadgets, and so forth.
Q23. Why embedded device is beneficial?
Ans: With embedded system, it's miles possible to replace dozens or maybe extra of hardware common sense gates, enter buffers, timing circuits, output drivers, and so on. With a highly reasonably-priced microprocessor.
A watchdog timer is an electronic device or electronic card that execute specific operation after certain term if something goes wrong with an electronic device.
Q25. Explain what is semaphore?
Ans: A semaphore is an abstract datatype or variable that is used for controlling access, by using more than one methods to a not unusual resource in a concurrent gadget along with multiprogramming working device. Semaphores are commonly used for 2 purposes:
To percentage a not unusual reminiscence area.
To proportion access to files.
Q26. When one should use recursion feature? Mention what occurs while recursion features are declared inline?
Ans: Recursion characteristic may be used whilst you are aware about the quantity of recursive calls isn't always excessive. Inline features belongings says on every occasion it'll known as, it's going to reproduction the whole definition of that feature. Recursive function declared as inline creates the load at the compilers execution.
Q27. Explain what is the need for an infinite loop in embedded structures?
Ans: Embedded systems require countless loops for time and again processing or monitoring the state of this system. For example, the case of a application nation constantly being tested for any incredible errors that might just occur at some point of run-time along with memory outage or divide through 0, and so on.
Q28. List out a number of the normally found mistakes in Embedded Systems?
Ans: Some of the generally discovered mistakes in embedded structures are:
Damage of memory devices static discharges and transient contemporary.
Address line malfunctioning due to a short in circuit.
Data strains malfunctioning.
Due to garbage or mistakes some memory places being inaccessible in storage.
Inappropriate insertion of memory devices into the memory slots.
Wrong control indicators.
Q29. Explain what are real-time embedded structures?
Ans: Real-time embedded systems are laptop systems that monitor, reply or manipulate an external surroundings. This environment is hooked up to the pc device through actuators, sensors, and other enter-output interfaces.
Q30. List out various uses of timers in embedded gadget?
Ans: Timers in embedded gadget are used in multiple methods:
Real Time Clock (RTC) for the system
Initiating an occasion after a preset time put off
Initiating an excellent after a assessment of preset instances
Capturing the count number value in timer on an occasion
Between activities finding the time c program languageperiod
Time cutting for numerous obligations
Time department multiplexing
Scheduling of various duties in RTOS