Embedded Hardware Design Development Interview Questions and Answers

Embedded Hardware Design Development Interview Questions and Answers

Last updated on 05th Oct 2020, Blog, Interview Question

About author

Krishnan (Sr Technical Manager )

He is Highly Experienced in Respective Technical Domain with 6+ Years, Also He is a Respective Technical Trainer for Past 5 Years & Share's This Important Articles For us.

(5.0) | 16234 Ratings 1578

If you’re looking for Hardware Design Development Interview Questions & Answers for Experienced or Freshers, you are at right place. There are lot of opportunities from many reputed companies in the world. According to research Hardware Design Development has a market share of about 5.7%. So, You still have opportunity to move ahead in your career in Hardware Design Development. ACTE offers Advanced Hardware Design Development Interview Questions 2020 that helps you in cracking your interview & acquire dream career as Hardware Design Developer.

1.What Are The Different Adder Circuits You Studied?

Ans:

Adders are generally of five types:

Ripple Carry Adder: The Ripple carry adder(RCA) consists of a building block named Half Adder(HA) which is cascaded to form a Full Adder(FA). These building blocks HAs and FAs are also the building blocks of all types of adders. The n full adders are cascaded to form n bit RCA. The full adder has three input pins(input Ai, input Bi, carrying Ci) and two output pins(Sum and Ci+1). 

Its equations are:

Sum=Ai^Bi^Ci

Ci+1=Ai.Bi+Bi.Ci+Ai.Ci

Carry Lookahead Adder: The Carry Lookahead Adder(CLA) reduces the delay like that in RCA. Let

Gi=Ai.Bi, and Pi=Ai^Bi, then Ci+1=Gi+Pi.Ci.

The expressions for Sum and Ci+1 are then defined completely in terms of input pins rather than wait for input carry to appear.

Carry Select Adder: The carry select adder uses duplicate modules for each combination of input carry(i.e. 1 and 0). The multiplexers then select the appropriate sum and carry output according to the carry output of the preceding stages.

2.Explain what real-time embedded systems?

Ans:

Real-time embedded systems are computer systems that monitor, respond, or control an external environment. This environment is connected to the computer system through actuators, sensors, and other input-output interfaces.

3.What Are Hard and Soft Real-Time Systems?

Ans:

The hard real-time Embedded Systems are the one that depends 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.processor that can be used as an embedded system.

4.Mention what is the difference between microprocessor and microcontroller?

Ans:

Microprocessor is managers of the resources (I/O, memory) which lie outside of its architecture

Microcontroller have I/O, memory, etc. built into it and specifically designed for control

5.What does the DMA address deal with?

Ans:

DMA addresses deal with physical addresses. It is a device which directly drives the data and address bus during data transfer. So, it is purely a physical address.

6.Explain what is interrupt latency? How can you reduce it?

Ans:

Interrupt latency is a time taken to return from the interrupt service routine post handling a specific interrupt.  By writing minor ISR routines, interrupt latency can be reduced.

7.Mention what are buses used for communication in an embedded system?

Ans:

For embedded system, the buses used for communication includes

  • I2C: It is used for communication between multiple ICS
  • CAN: It is used in automobiles with centrally controlled network
  • USB: It is used for communication between CPU and devices like mice, etc.
  • While ISA, EISA, PCI are standard buses for parallel communication used in PCs, computer network devices, etc.

8.List out various uses of timers in an embedded system?

Ans:

Timers in the embedded system are used in multiple ways

  • Real-Time Clock (RTC) for the system
  • Initiating an event after a preset time delay
  • Initiating an even after a comparison of preset times
  • Capturing the count value in timer on an event
  • Between two events finding the time interval
  • Time slicing for various tasks
  • Time-division multiplexing
  • Scheduling of various tasks in RTOS

9.Explain what a Watchdog Timer is?

Ans:

A watchdog timer is an electronic device or electronic card that executes a specific operation after a certain time period if something goes wrong with an electronic system.

10.Explain what is the need for an infinite loop in embedded systems?

Ans:

Embedded systems require infinite loops for repeatedly processing or monitoring the state of the program.  For instance, the case of a program state continuously being verified for any exceptional errors that might just happen during run-time such as memory outage or divide by zero, etc.

11.List out some of the commonly found errors in Embedded Systems?

Ans:

Some of the commonly found errors in embedded systems are

  • Damage of memory devices static discharges and transient current
  • Address line malfunctioning due to a short in circuit
  • Data lines malfunctioning
  • Due to garbage or errors some memory locations being inaccessible in storage
  • Inappropriate insertion of memory devices into the memory slots
  • Wrong control signals

12.Explain what semaphore is?

Ans:

A semaphore is an abstract data type or variable that is used for controlling access, by multiple processes to a common resource in a concurrent system such as a multiprogramming operating system.  Semaphores are commonly used for two purposes

To share a common memory space

To share access to files

13.Explain what is the difference between mutexes and semaphores?

Ans:

  • A mutex object enables one thread into a controlled section, forcing other threads which try to gain access to that section to wait until the first thread has moved out from that section while for Semaphore allows multiple access to shared resources
  • A mutex can only be released by the thread which has acquired it.A semaphore can be signaled from any other thread or process.
  • A mutex will always have a known owner While for semaphore you won’t know which thread we are blocking on
  • A mutex is also a tool that is used to provide deadlock-free mutual exclusion (either consumer or producer can have the key and proceed with their work) while for Semaphore is a synchronization tool to overcome the critical section problem
  • Mutexes by definition are binary semaphores, so there are two states locked or unlocked while for Semaphores are usually referred to counted locks

14.When one must use a recursion function? Mention what happens when recursion functions are declared inline?

Ans:

Recursion function can be used when you are aware that the number of recursive calls is not excessive. Inline functions property says whenever it will be called, it will copy the complete definition of that function. A recursive function declared as inline creates the burden on the compiler’s execution.

15.Explain whether we can use semaphore or mutex or spinlock in interrupt context in Linux Kernel?

Ans:

Semaphore or Mutex cannot be used for interrupt context in the Linux Kernel. While spinlocks can be used for locking in interrupt context.

Subscribe For Free Demo

Error: Contact form not found.

16.What Are Set-Up Time & Hold Time Constraints? What Do They Signify? Which One Is Critical For Estimating Maximum Clock Frequency Of A Circuit?

Ans:

  • Suppose your flip-flop is a positive edge triggered. The time for which data should be stable prior to a positive edge clock is called setup time constraint.
  • Time for which data should be stable after the positive edge of the clock is called as a hold time constraint.
  • If any of these constraints are violated then flip-flop will enter in a metastable state, in which we cannot determine the output of flip-flop.

There are two equation:

  • Tcq + Tcomb> Tskew + Thold
  • Tcq + Tcomb<Tskew +T – Tsetup
  • There is a time delay when data enters the flip-flop and data comes at output of flip flop.
  • The tomb is the logic delay between two flip flops.
  • Askew is the delay of the clock to flip flop: suppose there are two flip flop if clock reaches first to source flip flop and then after some delay to destination flip flop, it is positive skew and if vice versa then negative skew.
  • so if you take 2 eq you will see that setup time is the determining factor of the clock’s time period.

17.Give A Circuit To Divide Frequency Of Clock Cycle By Two?

Ans:

You can divide the frequency of a clock by just implementing T Flip flop.

Give clock as clock input and tie the T input to logic 1.

18.How Do You Detect If Two 8-bit Signals Are Same?

Ans:

XOR each bit of A with B (for eg A[0] xor B[0] ) and so on. the o/p of 8 xor gates are then given as i/p to an 8-i/p nor gate. if o/p is 1 then A=B.

19.Give Two Ways Of Converting A Two Input Nand Gate To An Inverter?

Ans:

One way is shorting the two inputs of the NAND gate and passing the input.

truth table:

  • A B output
  • 1 1 0
  • 0 0 1

The second way is passing the input to only one input(say A) of the NAND gate. Since the other input(say B) is floating, it is always a logical one.

truth table:

  • A B output
  • 1 1 0
  • 0 1 1

20.Design A Divide-by-3 Sequential Circuit With 50% Duty Cycle?

Ans:

Take a smiths counter with 3 f/f’s that is to say with 6 states(2*3) now double the i/p clock frequency to the counter the o/p of the 3rd f/f is divide by 6 of the i/p with 50% duty cycle so effectively u got to divide by 3 freq with 50% duty cycle

21.Give The Truth Table For A Half Adder. Give A Gate Level Implementation Of The Same?

Ans:

TRUTH TABLE FOR HALF ADDER:

  • A B SUM CARRY
  • 0 0 0 0
  • 0 1 1 0
  • 1 0 1 0
  • 1 1 0 1

IMPLEMENTATION:

For SUM, The two inputs A and B are given to the XOR gate.

For Carry, The two inputs A and B are given to AND gate.

22.What type of registers contain 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.

23.Differentiate the microprocessor and microcontroller?

Ans:

  • The key difference in both of them is the presence of external peripherals, where microcontrollers have RAM, ROM, EEPROM embedded in it while we have to use external circuits in case of microprocessors.As all the peripherals of the microcontroller is on a single chip it is compact while the microprocessor is bulky.
  • 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.
  • The processing speed of microcontrollers is about 8 MHz to 50 MHz, but in contrast processing speed of general microprocessors is above 1 GHz so it works much faster than microcontrollers.
  • 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.

24.What is a Preprocessor?

Ans:

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 depends on the nature of the preprocessor.

25.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

26.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.

27.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 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 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.

28.What is Dirac delta function and its Fourier transform and its importance?

Ans:

Dirac delta function is a continuous-time function with unit area and infinite amplitude at t=0.

The Fourier transform of 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.

29.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

30.#define cat(x,y) x##y concatenates x to y. But a 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.

Course Curriculum

Get Embedded Hardware Design Development Training By MNC Experts

  • Instructor-led Sessions
  • Real-life Case Studies
  • Assignments
Explore Curriculum

31.What is DMAC in ES?

Ans:

Direct memory access (DMA) is a feature of computer systems that allows certain hardware subsystems to access main system memory (random-access memory) independent of the central processing unit (CPU).  DMA is also used for intra-chip data transfer in multi-core processors.

32.What is the need for DMAC in ES?

Ans:

  • Direct memory access is mainly used to overcome the disadvantages of interrupt and program controlled I/O.
  • DMA modules usually take control over from the processor and perform the memory operations and this is mainly because to counteract the mismatch in the processing speeds of I/O units and the processor. This is comparatively faster.
  • It is an important part of any embedded systems, and the reason for their use is that they can be used for bursty data transfers instead of single-byte approaches.
  • It has to wait for the systems resources such as the system bus in case it is already in control of it.

33.What is the Endianness of a system and how do different systems communicate with each other?

Ans:

  • Endianness basically refers to the ordering of the bytes within words or larger bytes of data treated as a single entity.
  • When we consider a several bytes of data say for instance 4 bytes of data, XYZQ the lower byte if stored in a Higher address and others in successively decreasing addresses, then it refers to the Big Endian and the vice versa of this refers to Little Endian architecture.
  • Intel 80×86 usually follows Little Endian and others like IBM systems follow Big Endian formats.
  • If the data is being transmitted care has to be taken so as to know as to which byte, whether the higher or the lower byte is being transmitted.
  • Hence a common format prior to communication has to be agreed upon to avoid wrong interpretation/calculations.
  • Usually, layer modules are written so as to automate these conversions in Operating systems.

34.How are macros different from inline functions?

Ans:

  • Macros are normally used whenever a set of instructions/tasks have to be repeatedly performed. They are small programs to carry out some predefined actions.
  • We normally use the #define directive in case we need to define the values of some constants so in case a change is needed only the value can be changed and is reflected throughout.

define mul(a,b)(a*b)

  • 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 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 shortcodes.
  • Inline float add(float a, float b)
  • {
  • Return a+b;
  • }

Inline is just a request to the compiler and it is up to the compiler whether to substitute the code at the place of invocation or perform a jump based on its performance algorithms.

35.What could be the reasons for a System to have gone blank and how would you Debug it?

Ans:

Possible reasons could be:

  • PC being overheated.
  • Dust has been accumulated all around.
  • CPU fans not working properly .
  • Faulty power connections.
  • Faulty circuit board from where the power is being drawn.
  • Support Drivers not being installed.

Debugging steps which can be taken are:

  • Cleaning the system thoroughly and maintaining it in a dust-free environment. Environment that is cool enough and facilitates easy passage of air should be ideal enough.
  • By locating the appropriate support drivers for the system into consideration and having them installed.

36.Explain interrupt latency and how can we decrease it?

Ans:

  • Interrupt latency basically refers to the time span an interrupt is generated and is being serviced by an appropriate routine defined, usually the interrupt handler.
  • External signals, some conditions 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 the use of inappropriate APIs.

37.How to create a child process in linux?

Ans:

  • Prototype of the function used to create a child process is pid_t fork(void);
  • The fork is the system call that is used to create a child process. It takes no arguments and returns a value of type pid_t.
  • If the function succeeds it returns the pid of the child process created to its parent and the child receives a zero value indicating its successful creation.
  • On failure, a -1 will be returned in the parent’s context, no child process will be created, and errno will be set.
  • The child process normally performs all its operations in its parents context but each process independently of one another and also inherits some of the important attributes from it such as UID, current directory, root directory, and so on.

38.Significance of watchdog timer in Embedded Systems.

Ans:

  • Watchdog timer is basically a timing device that is set for a 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.

39.If you buy some RTOS, what are the features you look for in?

Ans:

  • Deterministic operating system having guaranteed worst-case interrupt latency and context-switch times.
  • Documentation provides for the minimum, average, and maximum number of clock cycles required by each system call.
  • Interrupt response times should be very minute.
  • Context switch time should be very low.
  • Compatibility with several plugin devices.
  • Overall it should be very reliable.

40.Why is java mostly used in embedded systems?

Ans:

  • Java was mainly designed and conceptualized for code that can work on different platforms without any hassles and also for being secure enough so as to not harm or corrupt other modules of code.
  • Features like exception handling, simple syntax and Automatic Garbage collection all work in its favor as the language for use in ES’s.
  • Also that it is widely used in the form of Java applets makes it very popular confining it to the limits of JVM. It is Dynamic in nature.
  • Its use is also being exploited in enterprise systems in the form of J2EE, J2SE, J2ME in case of mobile applications.

41.Differentiate between mutexes vs semaphores.

Ans:

  • Semaphores is a synchronization tool to overcome the critical section problem.A semaphore S is basically an integer variable that apart from initialization is accessed only through atomic operations such as wait() and signal().Semaphore object basically acts as a counter to monitor the number of threads accessing a resource.
  • A mutex is also a tool that is used to provide deadlock free mutual exclusion. It protects access to every critical data item. If the data is locked and is in use, it either waits for the thread to finish or awakens to release the lock from its inactive state.

42.What is the need for having multibyte data input and output buffers in case of device ports?

Ans:

  • It’s normally the case that some devices transfer the output either in a bursty or a sequential manner and also during input entry. If we take the example of keyboards, all the data entered is stored in a buffer and given at a time or one character at a time.
  • In case of networking there may be several requests to access the same resource and all these are queued in a buffer and serviced in the order they are received. Hence to avoid the input/output units from getting overloaded with requests, we use multibyte buffers.

43.What is read modify write technique?

Ans:

  • Read modify write is a technique used to access the ports.
  • Here is a single instruction, all three actions are combined.
  • Here initially the data is read from the port then modified .
  • At last the value is written back on the port.
  • This feature saves many lines of code and makes the process easier.

44.In which addressing mode is the DPTR register used?

Ans:

Data pointer register is used in the indexed addressing mode.

It is used in accessing data from the look-up table entries stored in ROM.

syntax:

  • MOVC A, @A+DPTR

Here c means the code (shows data elements are stored in code space of ROM).

The contents of A are added to 16-bit DPTR to form the 16-bit address of the needed data.

45.Which registers are used for register indirect addressing mode if data is on-chip?

Ans:

  • R0 and R1 are the only registers used for register indirect addressing mode.
  • These registers are 8 bit wide.
  • Their use is limited to accessing only internal RAM.
  • When these registers hold addresses of RAM, they must be preceded by a @ sign.
  • In the absence of this sign, it will use the contents of the register than the contents of memory location pointed by the same register.

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

Ans:

  • 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.

47.Explain the parallel address space.

Ans:

  • The two physically separate memories using the same addresses from the parallel address space.
  • Here the two memories are accessed using different access modes.
  • This parallel addressing is generally used in 8052(enhanced version of 8051) having extra 128 bytes of RAM with addresses 80 to FFH and memory is called as upper memory.
  • This distinguishes it from lower 128 bytes 00to 7FH.
  • To access lower bytes direct addressing mode is used and for higher bytes, indirect addressing mode is used.

48.Which port in 8051 performs a dual role?

Ans:

The port 3 can be used as a simple input /output port or provides signals like interrupts.

P3.0 and p3.1 are used for serial communication.

P3.2 and P3.3 are used as external interrupts.

P3.4 and P3.5 are used for timers.

P3.6 and P3.7 are used as read-write signals of external memory.

49.Explain high-end embedded processor.

Ans:

  • The microcontroller & processor can be interchangeably used here.
  • It forms a general purpose processor.
  • High-end stands for a system of greatest power.
  • Here when a microcontroller cannot do a specific task the processor does the same with higher power

Example: ADM 64

50.Which 8051 version is using UV-EPROM?

Ans:

  • Ultraviolet EPROM is used in version 8751.
  • Here it becomes easier to erase the data using uv rays.
  • It takes around 20 minutes to erase the data.
  • To overcome this shortcoming flash ROM versions of 8751 available.
Course Curriculum

Best Practical Oriented Embedded Hardware Design Development Course

Weekday / Weekend BatchesSee Batch Details

51.Which 8051 version uses Flash ROM?

Ans:

  • Atmel Corporation is manufacturing flash ROM
  • The 89C51 chip of Atmel is using flash ROM.
  • Here no Rom eraser is needed.
  • The erasing process is done by the PROM burner itself.
  • To avoid use of PROM burner the 8052 version supports in-system programming.

52.In which registers the immediate values cannot be directly loaded?

Ans:

  • The general purpose registers named A,B, R0-R7 can not accept the immediate data.
  • To indicate an immediate value pound sign is used before it.
  • These registers accept 8-bit data preceding a pound sign.
  • There are registers present in 8051 used to store data temporarily.

53.What are the pros and cons of using assembly in embedded systems?

Ans:

Pros of using assembly language in embedded systems:

  • These programs are hardware-oriented.
  • The code is portable as long as the same processor is used.
  • The execution of instructions is fast.
  • Insertions and deletions can be made easily.

Cos of using assembly language:

  • The programs are long and can get complicated.
  • The programs are not easily run on systems smaller in size.
  • The code cannot be run on systems of different processor designs.
  • There is no provision of a System Development Kit.

54.What are some automated tools to test embedded systems?

Ans:

Some automated tools for testing embedded systems are Parasoft, Tessy, TestPlant, and Klocwork.

55.How are unions useful in embedded systems?

Ans:

Unions are used in embedded systems for applications that have different modes of operation. Then the data that is specific to a model can be placed in a structure, and these structures can be placed in a union. This helps in-memory optimization.

56.What is interrupt latency in embedded systems?

Ans:

An interrupt latency is a latency that occurs while handling the interrupts. It is the amount of time that elapses between the arrival of an external interrupt and the processing of the interrupt.

57.What are actuators in embedded systems?

Ans:

An actuator is a device that is used to control the movements of systems and machines. It uses sources of power like electric current or hydraulic fluid. After receiving a control signal, it converts the signal’s energy into mechanical motion.

58.What is the reentrant function in embedded systems?

Ans:

A reentrant function is used in embedded systems for executing multiple tasks together without any data corruption issues. This function can be paused at any time and restarted again based on the requirements. It protects local data and preserves global data by creating a local copy of that data. It must not call functions that are non-reentrant.

59.Explain What Are The Different Qualifiers In C?

Ans:

  • Volatile: A variable should be declared volatile whenever its value could change unexpectedly. In practice, only three types of variables could change:
  • Memory-mapped peripheral registers
  • Global variables modified by an interrupt service routine
  • Global variables within a multi-threaded application
  • Constant: The addition of a ‘const’ qualifier indicates that the (relevant part of the) program may not modify the variable.

60.Explain What Are The 5 Different Types Of Inheritance Relationship?

Ans:

5 level types are as under:

  • single: B derived from A.
  • multilevel: derived from B and B derived from A.
  • multiple: C derived from A and B.
  • Hierarchical: B derived from A and C derived from A.
  • hybrid: combination of the above types.

61. Explain What Will This Return Malloc(sizeof(-10))?

Ans:

It will return a 4-byte address value.

Because -10 is a signed integer(varies from compiler to compiler).

62.Explain Can Structures Be Passed To The Functions By Value?

Ans:

Yes, structures can be passed to functions by value. Though passing by value has two disadvantages:

The charges by the calling function are not reflected.

It’s slower than the pass by the reference function call.

63.Explain Can We Have Constant Volatile Variable?

Ans:

Const and volatile keywords should not be used together because both are opposite in nature. A variable is declared as “const” means it’s value is not able to be changed but if it is declared as “Volatile” then it is not under control.

64.Explain What Are The Different Storage Classes In C?

Ans:

Four types of storage classes are there in c.

  • Auto
  • Register
  • Static
  • Extern or Global

65.Explain What Is Forward Reference W.r.t. Pointers In C?

Ans:

Pointer used to refer to value a into int a=10 to memory add this value and 10 is added p value-added this data in memory location for p.

66.How Is Function Itoa() Written In C?

Ans:

  • #include<stdlib.h>
  • #include<stdio.h>
  • int main()
  • {
  • int n = 6789;
  • char p[20];
  • itoa(n,s,10);
  • printf(“n=%d,s=%s”,n,s);
  • return 0;
  • }

67.How To Define A Structure With Bit Field Members?

Ans:

You can define struct bit field members with Dot operators.

EXAMPLE:

  • #include <stdio.h>
  • int main()
  • {
  • Struct bit_field
  • {
  • Int x.4; // it allocates only 4 bits to x
  • Char C.6; // it allocates only 6 bits to C;
  • };
  • return 0;
  • }

68.What Is The Difference Between Fifo And The Memory?

Ans:

Fifo(First In Last Out) is a memory structure where data can be stored and retrieved (in the order of its entry only). This is a queue, whereas Memory is a storage device that can hold data dynamically or at any desired location and can be retrieved in any order.

69.Is It Necessary To Start The Execution Of A Program From The Main() In C?

Ans:

“Normally you are at liberty to give functions whatever names you like, but “main”‘ is special – your program begins executing at the beginning of main. This means that every program must have a main somewhere.” 

70.What Is An Anti Aliasing Filter? Why Is It Required?

Ans:

Anti-aliasing filter reduces errors due to aliasing. If a signal is sampled at 8 kS/S, the max frequency of the input should be 4 kHz. Otherwise, aliasing errors will result. Typically a 3.4kHz will have an image of 4.6 kHz, and one uses a sharp cut off filter with a gain of about 1 at 3.4kHz and gain of about 0.01 at 4.6 kHz to effectively guard against aliasing. Thus one does not quite choose max frequency as simply fs/2 where fs is the sampling frequency. One has to have a guard band of about 10% of this max and chooses max signal frequency as 0.9*fs/2.

Embedded-Hardware-Design-Development Sample Resumes! Download & Edit, Get Noticed by Top Employers! Download

71.How To Implement A Fourth Order Butterworth Lp Filter At 1khz If Sampling Frequency Is 8 kHz?

Ans:

A fourth order Butterworth filter can be made as a cascade of two-second order LP filters with a zeta of 0.924 and 0.383. One can use a bilinear transformation approach for realizing second order LP filters. Using this technique described well in many texts, one can make two second-order LP filters and cascade them.

72.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.

73.What Is The Role Of Segment Register?

Ans:

In the x86 processor architecture, memory addresses are specified in two parts called the segment and the offset. One usually thinks of the segment as specifying the beginning of a block of memory allocated by the system and the offset as an index into it. Segment values are stored in the segment registers. There are four or more segment registers: CS contains the segment of the current instruction (IP is the offset), SS contains the stack segment (SP is the offset), DS is the segment used by default for most data operations, ES (and, in more recent processors, FS and GS) is an extra segment register. Most memory operations accept a segment override prefix that allows the use of a segment register other than the default one.

74.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.

75.What Is the PLC System?

Ans:

Programming logical control system

76.What Is The Use Of A Volatile Keyword?

Ans:

The C’s volatile keyword is a qualifier that tells the compiler not to optimize when applied to a variable. By declaring a variable volatile, we can tell the compiler that the value of the variable may change any moment from outside of the scope of the program. A variable should be declared volatile whenever its value could change unexpectedly and beyond the comprehension of the compiler.

In those cases it is required not to optimize the code, doing so may lead to erroneous results and load the variable every time it is used in the program. Volatile keyword is useful for memory-mapped peripheral registers, global variables modified by an interrupt service routine, global variables accessed by multiple tasks within a multi-threaded application.

77.Can A Variable Be Both Const And Volatile?

Ans:

The const keyword makes sure that the value of the variable declared as const can’t be changed. This statement holds true in the scope of the program. The value can still be changed by outside intervention. So, the use of const with a volatile keyword makes perfect sense.

78.Can A Pointer Be Volatile?

Ans:

If we see the declaration volatile int *p, it means that the pointer itself is not volatile and points to an integer that is volatile. This is to inform the compiler that pointer p is pointing to an integer and the value of that integer may change unexpectedly even if there is no code indicating so in the program.

79.What Is Size Of Character, Integer, Integer Pointer, Character Pointer?

Ans:

The size of the character is 1 byte.

The size of the integer is 4 bytes.

The size of integer pointer and character is 8 bytes on a 64-bit machine and 4 bytes on a 32-bit machine.

80.What Is Null Pointer And What Is Its Use?

Ans:

The NULL is a macro defined in C. Null pointer actually means a pointer that does not point to any valid location. We define a pointer to be null when we want to make sure that the pointer does not point to any valid location and not to use that pointer to change anything. If we don’t use the null pointer, then we can’t verify whether this pointer points to any valid location or not.

81.What Is Void Pointer And What Is Its Use?

Ans:

The void pointer means that it points to a variable that can be of any type. Other pointers point to a specific type of variable while void pointer is a somewhat generic pointer and can be pointed to any data type, be it standard data type(int, char etc) or user-defined data type (structure, union, etc.). We can pass any kind of pointer and reference it as a void pointer. But to dereference it, we have to type the void pointer to correct the data type.

82.What Is ISR?

Ans:

An ISR(Interrupt Service Routine) is an interrupt handler, a callback subroutine which is called when an interrupt is encountered.

83.What Is Return Type Of Isr?

Ans:

ISR does not return anything. An ISR returns nothing because there is no caller in the code to read the returned values.

84.Can We Use Any Function Inside ISR?

Ans:

We can use functions inside ISR as long as that function is not invoked from other portions of the code.

85.Can We Use Printf Inside Isr?

Ans:

Printf function in ISR is not supported because the print function is not reentrant, thread-safe and uses dynamic memory allocation which takes a lot of time and can affect the speed of an ISR up to a great extent.

86.Can We Put Breakpoint Inside Isr?

Ans:

Putting a breakpoint inside ISR is not a good idea because debugging will take some time and a difference of half or more second will lead to different behavior of hardware. To debug ISR, definitive logs are better.

87.Can Static Variables Be Declared In A Header File?

Ans:

A static variable cannot be declared without defining it. A static variable can be defined in the header file. But doing so, the result will be having a private copy of that variable in each source file which includes the header file. So it will be wise not to declare a static variable in the header file unless you are dealing with a different scenario.

88.Is Countdown To Zero Loop Better Than Count_up_loops?

Ans:

Countdown to zero loops are better. Reason behind this is that at loop termination, comparison to zero can be optimized by the compiler. Most processors have instructions for comparing to zero. So they don’t need to load the loop variable and the maximum value, subtract them, and then compare to zero. That is why countdown to zero loops is better.

89.Can we call any function inside ISR?Explain them with examples.

Ans:

Yes, you can call a function within the ISR but it is not recommended because it can increase the interrupt latency and decrease the performance of the system. If you want to call a nested function within the ISR, you need to read the datasheet of your microcontroller because some vendors have a limit to how many calls can be nested.

One important point needs to be remembered that the function that is called from the ISR should be re-entrant. If the called function is not re-entrant, it could create issues.

For example,

If the function is not reentrant and supposes that it is called by another part of the code beside the ISR. So the problem will be invoked when the ISR calls the same function which is already invoked outside of the ISR?

90.What is a nested interrupt?

Ans:

In a nested interrupt system, an interrupt is allowed at any time, and anywhere even an ISR is being executed. But, only the highest priority ISR will be executed immediately. The second highest priority ISR will be executed after the highest one is completed.

91.What is NVIC in ARM Cortex?

Ans:

The Nested Vector Interrupt Controller (NVIC) in the Cortex-M processor family is an example of an interrupt controller with extremely flexible interrupt priority management. It enables programmable priority levels, automatic nested interrupt support, along with support for multiple interrupt masking, whilst still being very easy to use by the programmer.

The Cortex-M3 and Cortex-M4 processors the NVIC supports up to 240 interrupt inputs, with 8 up to 256 programmable priority levels

92.Can we change the interrupt priority level of the Cortex-M processor family?

Ans:

Yes, we can.

93.Why is “C” language mostly preferred than assembly language?

Ans:

C helps programmers focus on the structure of the code rather than the low-level demands of the CPU. They can organize code into components, such as functions and files and they have ways of managing the complexity of a project; without thinking about the nitty-gritty of issues such as how function calls work.

Since C is a portable language, code can be organized into general-purpose libraries that can be used on any platform, often with no modification. It is a great weapon against ‘reinventing the wheel.

94.What is the start-up code?

Ans:

A start-up code is called prior to the main function, it creates a basic platform for the application. It is a small block of code that is written in assembly language.

There are the following parts of the start-up code.

  • Declaration of the Stack area.
  • Declaration of the Heap area.
  • Vector table.
  • Reset handler code.
  • Other exception handler code. 

95.What are the start-up code steps?

Ans:

Start-up code for C programs usually consists of the following actions, performed in the order described:

  • Disable all interrupts.
  • Copy any initialized data from ROM to RAM.
  • Zero the uninitialized data area.
  • Allocate space for and initialize the stack.
  • Initialize the processor’s stack pointer.
  • Create and initialize the heap.
  • Enable interrupts.
  • Call main.

96.What is meant by structure padding?

Ans:

In the case of structure or union, the compiler inserts some extra bytes between the members of structure or union for the alignment, these extra unused bytes are called padding bytes and this technique is called padding.

Padding has increased the performance of the processor at the penalty of memory. In structure or union data members aligned as per the size of the highest bytes member to prevent the penalty of performance.

97.What is endianness?

Ans:

The endianness is the order of bytes to store data in memory and it also describes the order of byte transmission over a digital link. In the memory data store in which order depends on the endianness of the system, if the system is big-endian then the MSB byte store first (means at lower address) and if the system is little-endian then LSB byte store first (means at lower address) 

98.What is big-endian and little-endian?

Ans:

Suppose, 32 bits Data is 0x11223344.

endian-example

Big-endian

The most significant byte of data stored at the lowest memory address.

big-endian

Little-endian

The least significant byte of data stored at the lowest memory address.

little-endian

99.What is static memory allocation and dynamic memory allocation?

Ans:

Static memory allocation:

Static Allocation means, an object has an external or internal linkage or declared with static storage-class. It’s initialized only once, prior to program startup and its lifetime is throughout the execution of the program. A global and static variable is an example of static memory allocation.

Dynamic memory allocation:

In C language, there are a lot of library functions (malloc, calloc, or realloc,..) which are used to allocate memory dynamically. One of the problems with dynamically allocated memory is that it is not destroyed by the compiler itself; that means it is the responsibility of the user to deallocate the allocated memory.

When we allocate the memory using the memory management function, they return a pointer to the allocated memory block and the returned pointer is pointing to the beginning address of the memory block. If there is no space available, these functions return a null pointer.

100.What Is an Inode?

Ans:

In computing, an inode is a data structure on a traditional Unix-style file system such as UFS. An inode stores basic information about a regular file, directory, or other file system object.

Are you looking training with Right Jobs?

Contact Us

Popular Courses