Embedded Systems Interview Questions

Many top companies are offering jobs in various roles in Embedded Testing. So, there is a huge scope for professionals in the job market. We at Mindmajix, have prepared a bunch of top interview questions in this blog that covers the basics of the embedded systems. We hope you will benefit from these questions and clear your interview easily.

 Categories of Embedded Interview Questions

Q1) What is an embedded system? 

Ans: An embedded system is part of a more extensive electrical or mechanical system dedicated to a specific task. It is a microcontroller or microprocessor-based. 

Q2) What does the embedded system architecture consist of? 

Ans: An embedded system has typically 3 components: 

  • Hardware: It includes processor, memory, timers, I/O circuits, and system application-specific circuits 

  • Software: It ensures the availability of system memory and processor speed. 

  • Real-Time Operating System (RTOS): It supervises the application software. 

Q3) What are the fundamental characteristics of an embedded system? 

Ans:

  • Performs a specialized operation and repeats the same. 

  • Tight constraints on design metrics. 

  • Continually reacts to changes in the system’s environment. 

  • Based on microprocessors or microcontrollers. 

  • Software is for flexibility. Hardware is for performance and security. 

 

Q4) What are the types of embedded systems? 

Ans: Based on performance and functional requirements, there are four types: 

  1. Real-time embedded systems

    1. Soft real-time embedded systems 

    2. Hard real-time embedded systems 

  2. Stand-alone embedded systems 

  3. Networked embedded systems 

  4. Mobile embedded systems 

Based on performance and microcontroller, there are three types: 

  1. Small-scale embedded systems 

  2. Medium-scale embedded systems 

  3. Sophisticated or Complex embedded systems.

Q5) Differences between Serial and Parallel I/O devices? 

Ans: Serial: 

Type 

Input 

Output 

Synchronous 

Audio/Video signal 

Audio/Video signal 

Asynchronous 

Keypad, mouse, modem 

Printer, modem 

Parallel: 

Type 

Input 

Output 

Single-bit 

Rotation, threshold sensors 

Pulses to an external circuit 

Multi-bit 

Vp from ADC, sensors 

LCD, printer 

Q6) What are some applications of embedded systems? 

Ans:

  • Identify rash driving on highways and alarm the traffic authorities through a speed-checker device. 

  • Detect vehicle movement on highways and control street lights. 

  • A density-based traffic signal system controls the signal timing according to the traffic density at junctions. 

  • To find the exact location of a vehicle using a GPS modem. 

  • For a home automation system with the Android application based remote control. 

Q7) What are real-time embedded systems? 

Ans: Real-time embedded systems are computer systems that monitor, respond, or control external environments. 

Q8) What is a microcontroller? 

Ans: Microcontrollers are self-contained systems inserted in devices to control the actions and features of a product. They are also called embedded controllers.

Q9) What is interrupt latency? How can it be reduced? 

Ans: Interrupt latency is the time taken to return from a disrupted service to regular functioning. 

Interrupt latency is reduced by: 

  • Keeping ISRs short and straightforward 

  • Immediate servicing of interrupts 

  • Avoiding instructions that increase the latency period 

  • Prioritizing interrupts over threads. 

  • Avoiding inappropriate APIs. 

Q10) Types of Buses used by embedded systems?

Ans:

TYPE 

DESCRIPTION 

Memory Bus 

It is related to the processor connected to the memory. 

Multiplexed Address/Data Bus 

It reads and writes in the memory, but it decreases the performance because of the time consumed in the memory. 

De-multiplexed Bus 

It consists of two wires on the same bus. One wire has the address, and the other one has the data. 

Input/Output Bus 

It uses multiplexing techniques to multiplex the same input and output signals. 

Q11) What are the uses of timers? 

Ans: The different uses of timers in embedded systems are: 

  • Real-Time Clock (RTC) for the system 

  • To initiate an event after a preset time delay. 

  • To capture the count value on an event. 

  • To find the time interval between two events. 

  • To reduce the time spent on various tasks. 

  • To schedule tasks in RTOS 

Q12) What is a Watchdog timer? 

Ans: A watchdog timer is an electronic device that is dedicated to a specific operation after a particular time if something goes wrong with a system. 

Q13) Why are infinite loops used in embedded systems? 

Ans: Embedded systems use infinite loops to process or monitor the state of a program repeatedly. For example, in a customer support telephone system, a pre-recorded audio file is played in case the dialer is on hold. 

Q14) What are the common errors in Embedded systems? 

Ans: Some of the common errors found in an embedded system are: 

  • Data lines malfunctioning 

  • Address line malfunctioning because of a short in the circuit 

  • Some memory locations become inaccessible. 

  • Wrong control signals 

  • Damage of memory devices  

Q15) Differences between mutexes and semaphores?

Ans:

MUTEXES 

SEMAPHORES 

Only the acquired thread releases it. 

Another thread or process can signal it.  

Mutexes always have a known owner. 

The thread is not known. 

It provides deadlock-free mutual exclusion. 

It is a synchronization tool that overcomes that critical section problem. 

Mutexes are binary semaphores. Two states are locked or unlocked. 

Semaphores are counter locks. 

Q16) What are recursive functions? 

Ans: A recursive function is used when it is known that the number of recursive calls is not excessive. It can be declared inline if required. 

Q17) What is a memory leak? 

Ans: A memory leak is the accumulation of uncleared memory. It stalls the execution of the system if it reaches adequate space. 

Q18) What are the advantages and disadvantages of embedded systems? 

Ans: Advantages: 

  • It is faster to load and is small in size. 

  • It is dedicated to one specific task. 

  • It is easy to manage. 

  • It is cost-effective. 

  • Fewer resources are needed, like memory and microprocessors. 

  • It has good performance because the operating system is only for one device.

Disadvantages: 

  • It is difficult to upgrade. 

  • Settings need to be reset if there is any problem. 

  •  It is not scalable. 

  • Limited hardware. 

  • It is difficult to troubleshoot. 

  • It is difficult to transfer data from one system to the other. 

Q19) What are the reasons for a system to go blank? What are the steps to debug it? 

Ans: Reasons a system could go blanks are: 

  • Overheated PC 

  • Accumulated dusk 

  • Malfunctioning of CPU fans 

  • Faulty power connections 

Steps to debug are: 

  • Cleaning the system and maintaining a dust-free environment. 

  • Creating a cool environment for easy passage of air. 

  • Locating the appropriate support drivers and installing them. 

Q20) What is the automotive embedded system? 

Ans: The automotive embedded system is a computer system for electronic devices that controls the mechanism of data and devices. 

Embedded C Interview Questions

Q21) What is an embedded C? 

Ans: Embedded C is an extension of the C programming language. It is used to develop applications based on micro-controllers such as device drivers (camera device drivers, WiFi device drivers, etc.) 

Q22) What are the causes of segmentation fault error? 

Ans: Segmentation fault error is a runtime error that occurs due to a few of the following reasons: 

  • A pointer may not have a valid address or a memory location to point. 

  • If the user tries to access a read-only memory area. 

  • If the user tries to free a memory (using a pointer) which is already freed. 

Q23) What is a stack overflow error in C? 

Ans: Stack overflow error occurs if the program accesses the memory beyond its available limit. When this error occurs, the program terminates and does not execute further instructions. 

Q24) Why is a ‘volatile’ keyboard used in C? 

Ans: When a variable is used often, the compiler optimizes it and keeps the variables in its memory. Therefore, volatile prevents the compiler from any optimization. 

Q25) How do you write an infinite loop code? 

Ans: An infinite loop is coded by using while (1) and for(;;).

The syntax for an infinite loop using while(1) 

The syntax for an infinite loop using for(;;) 

Embedded systems testing interview questions

Q26) What are the levels of testing in embedded systems? 

Ans: There are four levels of testing in embedded systems: 

  • Unit testing 

  • Integration testing 

  • System testing 

  • User acceptance testing 

Q27) What are the phases of the Software Development Life Cycle? 

Ans: There are five main stages of the software development life cycle: 

  1. Requirement: In this phase, the customer fills a requirement form to write what they actually need from the product. 

  2. Analysis: In this phase, the requirements are converted into documents and cover all the functional requirement specifications.

  3. Design: In this phase, the design of the product is prepared. The requirements are converted into architecture design. This phase includes: 

    1. Low-Level Design Documentation (LLD) 

    2. High-Level Design Documentation (HLD) 

  4. Coding: In this phase, the requirements are converted into a coded form. 

  5. Testing: In this phase, the software under development is tested for product quality. This includes 2 types: 

    1. Static testing 

    2. Dynamic testing 

  6. Maintenance: In this phase, the maintenance of the product is implemented. 

Q28) What is software quality assurance? 

Ans: Software testing refers to the software developing process: 

  • Monitoring and improving the process 

  • Ensuring that standards and procedures are followed 

  • Ensuring are problems are found and rectified. 

Q29) What is equivalence partitioning? 

Ans: Equivalence partitioning involves designing a test case to uncover a group or a class of error. 

Q30) What are some of the common testing tools? 

Ans: Some of the common testing tools are: 

  • Quick Test Professional (QTP) 

  • WinRunner 

  • LoadRunner 

  • TestDirector 

  • Silk Test 

Q31)How does a combination of functions reduce memory requirements in embedded systems?

Ans: The amount of code that has to be dealt with is reduced thus easing the overhead and redundancy is eliminated in case if there is anything common among the functions.

Memory allocation is another aspect that is optimized and it also makes sense to group a set of functions related in some way as one single unit rather than having them to be dispersed in the whole program.

Q32) How does, taking the address of local variables to result in unoptimized code?

Ans: The most powerful optimization for the compiler is register allocation. That is it operates the variable from the register, then a memory.

Generally, local variables are allocated in registers. However, if we take the address of a local variable, the compiler will not allocate the variable to register.

Q33) What is a pure function in ARM terminology?

Ans: Pure functions are those which return a result which depends only on their arguments.

They can be thought of as mathematical functions: they always return the same result if the arguments are the same. To tell the compiler that a function is pure, use the special declaration keyword __pure.

__pure int square(int x)

{

return x * x;

}

The compiler does optimization for pure functions. For example, the values which are allocated to memory can be safely cached in registers, instead of being written to memory before a call and reloaded afterward.

Microprocessor and Microcontroller Interview Questions

Q34) Is 8085 an embedded system?

Ans: It’s not an embedded system. Because it will be a part of an embedded system and it does not work on any software.

Q35) What is the role of the segment register?

Ans: In the 8086 processor architecture, memory addresses are specified in two parts called the segment and the offset. Segment values are stored in the segment registers. There are four or more segment registers: Code Segment (CS) contains a segment of the current instruction (IP is the offset), Stack segment (SS) contain a stack of the segment (SP is the offset), DS is the segment used by default for most data operations; ES is an extra segment register.

Q36)What type of registers contains an INTEL CPU?

Ans: Special function registers like accumulator, program controller (PC), data pointer (DPTR), TMOD and TCON (timing registers), 3 register banks with r0 to r7, Bit addressable registers like B.

Q37) Differentiate microprocessors and microcontrollers?

Ans: As now you are fundamentally familiar with what is a microcontroller And microprocessor, it is easy to recognize the significant contrasts between a microcontroller and microprocessor.

1. Key difference in both of them is the presence of external peripheral, where microcontrollers have RAM, ROM, EEPROM embedded in it while we have to use external circuits in the case of microprocessors.

2. As all the peripheral of microcontrollers are on the single-chip it is compact while the microprocessor is bulky.

3. Microcontrollers are made by using complementary metal-oxide-semiconductor technology so they are far cheaper than microprocessors. In addition, the applications made with microcontrollers are cheaper because they need lesser external components, while the overall cost of systems made with microprocessors is high because of the high number of external components required for such systems.

4. Processing speed of microcontrollers is about 8 MHz to 50 MHz, but on the contrary processing speed of general microprocessors is above 1 GHz so it works much faster than microcontrollers.

5. Generally microcontrollers have a power-saving system, like idle mode or power-saving mode so overall it uses less power, and also since external components are low overall consumption of power is less. While in microprocessors generally there is no power saving system and also many external components are used with it, so its power consumption is high in comparison with microcontrollers.

Q38) What is Preprocessor?

Ans: A preprocessor is a Program That processes its input data to produce output that is used as input to another program. The output is said to be a preprocessed form of the input data, which is often used by some subsequent programs like compilers. The amount and kind of processing done depend on the nature of the preprocessor.

Some Pre-processors Are Only Capable Of Performing Relatively Simple Textual Substitutions And Macro Expansions, while others have the power of full-fledged programming languages.

A Common Example From Computer programming is the processing performed on source code before the next step of compilation. In some computer languages (e.g., C and PL/I) there is a phase of translation known as preprocessing. It can also include macro processing, file inclusion, and language extensions.

Q39) Which is better a char, short, or int type for optimization?

Ans: Where possible, it is best to avoid using char and short as local variables. For the types, char and short the compiler needs to reduce the size of the local variable to 8 or 16 bits after each assignment. This is called sign-extending for signed variables and zero extending for unsigned variables.

It is implemented by shifting the register left by 24 or 16 bits, followed by a signed or unsigned shift right by the same amount, taking two instructions (zero-extension of an unsigned char takes one instruction).

These shifts can be avoided by using int and unsigned int for local variables. This is particularly important for calculations that first load data into local variables and then process the data inside the local variables.

Even if data is input and output as 8- or 16-bit quantities, it is worth considering processing them as 32-bit quantities

Q40) What are inline functions?

Ans: The ARM compilers support inline functions with the keyword __inline.

These results in each call to an inline function being substituted by its body, instead of a normal call.

This results in faster code, but it adversely affects code size, particularly if the inline function is large and used often.

Q41) Why do we need virtual device drivers when we have physical device drivers?

Ans: Device drivers are basically a set of modules/routines so as to handle a device for which a direct way of communication is not possible through the user's application program and these can be thought of as an interface thus keeping the system small providing for minimalistic of additions of code if any.

Physical device drivers can’t perform all the logical operations needed in a system in cases like IPC, Signals, and so on...

The main reason for having virtual device drivers is to mimic the behavior of certain hardware devices without it actually being present and these could be attributed to the high cost of the devices or the unavailability of such devices.

These basically create an illusion for the users as if they are using the actual hardware and enable them to carry out their simulation results.

Examples could be the use of virtual drivers in the case of Network simulators, also the support of virtual device drivers in case a user runs an additional OS in a virtual box kind of software.

Q42) What are the Dirac delta function and its Fourier transform and its importance?

Ans: Dirac delta function is a continuous-time function with units are and infinite amplitude at t=0.

The Fourier transform of the Dirac delta function is 1.

Using Dirac delta as an input to the system, we can get the system response. It is used to study the behavior of the circuit. We can use this system behavior to find the output for any input.

Q43) Differentiate testing and verification?

Ans: Verification is a front-end process and testing is a post-silicon process. Verification is to verify the functionality of the design during the design cycle. Testing is to find manufacturing faults.

{

a &= ~BIT3;

}

Some people prefer to define a mask together with manifest constants for the set and clear values. This is also acceptable. The element that I'm looking for is the use of manifest constants, together with the |= and &= ~ constructs

Q44) #define cat(x,y) x##y concatenates x to y. But cat(cat(1,2),3) does not expand but gives preprocessor warning. Why?

Ans: In this case, the cat(x,y) is the macro which is defined by using the preprocessor directive, this will be substituted only at the place where it is called in this example it happens like this

cat(1,2)##3 which will once again become 1##2##3

here if we use ## in between we can join or concatenate only two variables that why it gives a preprocessor warning.

Q45)What Does Malloc Do?

Ans: 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 the size of(0) represents the size of memory taken up by the integer value of 0. The memory allocated by memory is not automatically cleaned up by the compiler after the execution of the functions and should be cleaned up by the programmer using the free () function.

Q46) What Are Hard and Soft Real-Time Systems?

Ans: The hard real-time Embedded Systems are the ones 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.