Embedded – Interview Questions

What are static variables?

What are volatile variables?

What do you mean by const keyword ?

What is interrupt latency?

  • The time interval between the occurrence of interrupt and start of execution of the ISR is called interrupt latency. or Interrupt latency is the time between the generation of interrupt and the time for interrupt handler to process it.

How you can optimize interrupt latency?

  • We may use polling and message passing for interrupt to handle interrupt immediately.

What is size of character, integer, integer pointer, character pointer?

  • Character – 1 Byte
  • Integer – 2 byte or 4 byte
  • Integer Pointer (The size of a pointer is platform-dependent)
    • 64 bit computer 8 byte
    • 32 bit computer 4 byte
  • Character Pointer
    • Character pointer is platform dependent, in a 32 bits system it’s 4 bytes.

What is NULL pointer and what is its use?

A pointer pointing to nothing is called so. NULL pointer is always initialized. NULL pointer assignment :  char <em>q=0;</em>  (or) char *q=(char)0;  (or) char *p=NULL;

  • Example
    • What is (void*)0 ? //Representation of NULL pointer
  • NULL Macro is defined in locale.h , stddef.h , stdio.h , stdlib.h , string.h , time.h , and wchar.h

What is void pointer and what is its use?

  • When we do not know what type of the memory address the pointer variable is going to hold, then we declare a void pointer for such.
  • If a function is defined like: int func (void *a); , It can take any type of pointer

What is ISR?

  • ISR is an interrupt service routine. Which is a short routine used to handle interrupt. When interrupt occurs time this service will be enable and do the action of the interrupt functions.

What is return type of ISR?

  • ISR does not return anything, also it does not have parameter
  • Example : void timer0 (void) ;  // ISR interrupt Function Defination.

Can we use any function inside ISR?

  • If a function could be re-entrant, then we could use it. Since during the ISR, another interrupt may occur.
  • If the interrupts are turned off, then I think we could call other functions.

Can we use printf inside ISR?

  • Generally we dont want to use printf, since it’s not valid for reentrant, also ISR is supposed to be short, but printf takes too much time.

Can we put breakpoint inside ISR?

  • Yes, we can.  But I think we can only set breakpoint in emulator where hardware is emulated. Since during the process of ISR, it will occupy the CPU resource.

How to decide whether given processor is using little endian format or big endian format ?

  • Little endian means store the least significant bit in smaller address.
    To test it we can do this:


What is Top half & bottom half of a kernel?

  • When handling interrupt, we divide the routine into two half. Top half will respond quickly, and call bottom half which will continue to handle the interrupt.

Difference between RISC and CISC processor.

  • RISCReduced Instruction Set Computer
  • CISCComplex Instruction Set Computer

What is RTOS?

  • RTOS – Real Time Operating System

What is the difference between hard real-time and soft real-time OS?

  • ard real-time system has strict limit on the deadline, while soft real-time OS has comparably loose requirement

What type of scheduling is there in RTOS?

  • There are many types: static and dynamic. Earliest deadline first, round robin etc

What is priority inversion?

  • It means a task with lower priority will run in front of the task with higher priority in some circumstances.

What is priority inheritance?

How many types of IPC mechanism you know?

  • Share memory,
  • Procedure call,
  • Semaphore,
  • Message passing.

What is semaphore?

What is spin lock?

  • It’s like busy waiting, it will check condition continuously in a while loop until the condition is met. This is resource wasting.

What is difference between binary semaphore and mutex?

  • Binary semaphore only has two state its upper limit is 1. Mutex has higher limit up to a point, but the lower is the same binary semaphore which is 0.

What is virtual memory?

  • the program will view the memory as if it has the whole memory space. It’s indirect access, the OS will keep a mapping which maps virtual memory address to physical memory address.

What is kernel paging?

  • Ideally, kernel will put all its routine inside the memory, so that they could be fetched quickly which they are called. But sometimes the memory does not have enough space, so the kernel will swap part of the services to hard drive, and fetches them if they are needed.

Can structures be passed to the functions by value?

  • Yes, structures can be passed by value.

Why cannot arrays be passed by values to functions?

  • The array name represents the first element in the array.

Advantages and disadvantages of using macro and inline functions?

  • Macro does not have type checking. Inline function is replaced to the entire function by the compiler.

What happens when recursion functions are declared inline?

  • It depends some compiler will expand it up to a limit, others will simply not expand it.

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

  • cat(cat(1,2),3) will be replaced to 1##2##3, ## could only concatenate two arguments.

What is the output of printf("\nab\bcd\ref"); ?

  • Output is ef
  • \n  means new line
  • \b  means backspace
  • \r means delete to the beginning of the line, so it will delete 'acd'

is the output correct??  a+++b  ->  (a++)+b 

Can you have constant volatile variable?

  • Yes, you can have a volatile pointer

++*ip increments what?

  • it increments what ip points to

Operations involving unsigned and signed

  • Unsigned will be converted to signed

malloc(sizeof(0)) will return

  • valid pointer

What is the output?



  • will print 8 times.

Array of pointer to functions?

  • void (*fptr[10])()  Array of pointer to functions is useful, when function with similar functionality, but different parameters could be stored in an array and called like element in the array.

Which way of writing infinite loops is more efficient than others?

  • there are 3ways.
    • while(1) ;
    • for(;;);
    • goto
  • I think goto  is the most efficient

Who to know whether system uses big endian or little endian format and how to convert
among them?

What is forward reference w.r.t. pointers in c?

  • Forward reference means a reference is used before its declaration.
    There are only two cases:

    • structure and
    • goto statement


How is generic list manipulation function written which accepts elements of any kind?


What is the difference between embedded systems and the system in which RTOS is running?

  • RTOS requires much more constraint on the time and scheduling

How can you define a structure with bit field members?

How do you write a function which takes 2 arguments – a byte and a field in the byte and returns the value of the field in that byte?

  • We can move the number using shift operator (>>)

Which parameters decide the size of data type for a processor ?

What is job of preprocessor, compiler, assembler and linker ?

What is the difference between static linking and dynamic linking ?

How to implement a WD timer in software ?

What is Embedded System?

  • Embedded system is combination of software + hardware.
  • Example : Air-Conditioner, Washing machine, TV, Mobile phone, etc.

What is the need for an infinite loop in Embedded systems?

Embedded systems need infinite loops for repeatedly processing/monitoring the state of the program

  • Example:  While(Boolean True) OR for(;;); { //Code }
  • For e.g.
    • Customer care Telephone systems where in a pr-recorded audio file is played in case the dialer is put on hold..
    • Also circuits being responsible for indicating that a particular component is active/alive during its operation by means of LED’s.

What is the use of #progma  keyword

  • This is a  pr-processor directive that can be used to turn on or off certain features.
  • It is of two types #pragma startup  , #pragma exit  and #pragma warn  .
    • #pragma startup allows us to specify functions called upon program startup.
    • #pragma exit  allows us to specify functions called upon program exit.

How are macros different from inline functions?

Macros :

  • Its used for when the set of instruction/function/task repeatedly run again&  again. Macros is defined by #define macro_name
  • Example : Add the two numbers using macros #define add(a,b) (a+b) , Here the add is the macro name perform the two number addition functionality.
  • The major disadvantage of macros is that they are not really functions and the usual error checking and stepping through of the code does not occur.

Inline :

  • Inline functions are expanded whenever it is invoked rather than the control going to the place where the function is defined and avoids all the activities such as saving the return address when a jump is performed. Saves time in case of short codes.
  • Example : inline float add(float a,float b) { return a+b; }
  • Inline is just a request to the compiler and it is upto to the compiler whether to substitute the code at the place of invocation or perform a jump based on its performance algorithms.

What is the use of bit wise operators in embedded system?

  • The bit-wise shift operators are used to move all of the operand left or right a given number of times.

Explain interrupt latency and how can we decrease it?

  • Interrupt latency basically refers to the time span an interrupt is generated and it being serviced by an appropriate routine defined, usually the interrupt handler.
  • External signals, some condition in the program or by the occurrence of some event, these could be the reasons for generation of an interrupt.
  • Interrupts can also be masked so as to ignore them even if an event occurs for which a routine has to be executed.
  • Following steps could be followed to reduce the latency
    • ISRs being simple and short.
    • Interrupts being serviced immediately
    • Avoiding those instructions that increase the latency period.
    • Also by prioritizing interrupts over threads.
    • Avoiding use of inappropriate APIs.

Of the 128-byte internal RAM how many bytes are bit addressable?

  • Only 16 bytes of the 128 bytes of RAM are bit addressable.
  • The bit addressable RAM locations are 20H to 2FH.
  • They are addressed as 0 to 127 (decimal) or 00 to 7F.
  • Also the internal RAM locations 20 to 2FH are both byte and bit addressable.
  • These 16 bytes can be by single bit instructions using only direct addressing mode.

Significance of watchdog timer in Embedded Systems.

  • Watchdog timer is basically a timing device that is set for predefined time interval and some event should occur during that time interval else the device generates a time out signal.
  • One application where it is most widely used is when the mobile phone hangs and no activity takes place, in those cases watchdog timer performs a restart of the system and comes to the rescue of the users.
  • It is used to reset to the original state whenever some inappropriate events take place such as too many commands being given at the same time or other activities that result in malfunctioning of the GUI. It is usually operated by counter devices.

Difference Between Mutex and Semaphore

  • Mutex – Mutexes are typically used to serialise access to a section of  re-entrant code that cannot be executed concurrently by more than one thread. A mutex object only allows one thread into a controlled section, forcing other threads which attempt to gain access to that section to wait until the first thread has exited from that section
  • Semaphore – A semaphore restricts the number of simultaneous users of a shared resource up to a maximum number. Threads can request access to the resource (decrementing the semaphore), and can signal that they have finished using the resource (incrementing the semaphore)

Difference between Harvard and Von Neumann computer architectures

  • There are basically two types of digital computer architectures. The first one is called Von Neumann architecture and later Harvard architecture was adopted for designing digital computers.

Von Neumann Architecture:

 What is MicroController ?

What is the work of compiler?

Compiler – Source code to Binary code

What is called 8,16,32,64 Bit microcontrollers?

  • 8Bit Operations

  What is SPIFFS?

  • SPIFFS – Serial Peripheral Interface Flash File System

What is configuration management?

It is a system Engineering process for establishing and maintaining consistency of a products performance, functional and  physical attributes with its requirements, design and optional information throughout its life . See more

  • SCM (Software Configuration Management)
  • HCM (Hardware Configuration Management)

Refer Website :