Elektrobit Automotive India
Tech Mahindra Foundation Interview Questions and Answers
Q1. Write an ISR with Accepts an Int arguement and Returns an int value
An ISR that accepts an int argument and returns an int value.
An ISR (Interrupt Service Routine) is a function that is executed in response to an interrupt.
The ISR should have a return type of int and accept an int argument.
The ISR can perform any necessary operations and return an int value.
Here's an example of an ISR in C language: int myISR(int arg) { // code goes here }
Q2. what is RAM and ROM explain the difference.
RAM and ROM are types of computer memory. RAM is volatile and used for temporary storage, while ROM is non-volatile and used for permanent storage.
RAM stands for Random Access Memory and is used for temporary storage of data and programs while the computer is running.
ROM stands for Read-Only Memory and is used for permanent storage of data and programs that cannot be changed.
RAM is volatile, meaning that its contents are lost when the computer is turned off, while ROM is non-...read more
Q3. What is the difference between STRUCTURE AND union
Structure is a user-defined data type that groups related variables of different data types. Union is a data type that allows storing different data types in the same memory location.
Structure allocates memory for all its members separately.
Union allocates memory for only one member at a time.
Structure is used when all members need to be accessed at the same time.
Union is used when only one member needs to be accessed at a time.
Structure is larger in size than union.
Union is ...read more
Q4. What is Stack
A stack is a data structure that follows the Last-In-First-Out (LIFO) principle.
Elements are added and removed from the top of the stack.
Common operations include push (add element), pop (remove element), and peek (access top element).
Stacks can be implemented using arrays or linked lists.
Example: Undo/Redo functionality in a text editor.
Q5. Conditon for Stack overflow
Stack overflow occurs when the call stack exceeds its maximum limit.
Stack overflow happens when a function calls itself indefinitely, causing the call stack to fill up.
It can also occur when a function recursively calls other functions, causing the call stack to exceed its limit.
Stack overflow can be prevented by optimizing recursive functions or increasing the maximum stack size.
Q6. Explain Maskable Interrupts
Maskable interrupts are interrupts that can be disabled or enabled by the programmer.
Maskable interrupts can be controlled by setting or clearing bits in a register.
They can be used to prioritize interrupts and prevent lower priority interrupts from interrupting higher priority ones.
Examples of maskable interrupts include keyboard interrupts and timer interrupts.
Maskable interrupts are different from non-maskable interrupts, which cannot be disabled by the programmer.
Q7. Explain Interrupts
Interrupts are signals that temporarily halt the CPU's current task to execute a higher priority task.
Interrupts are used to handle events that require immediate attention
They can be hardware or software generated
Interrupts have a priority level that determines which one is executed first
Examples include keyboard input, mouse movement, and system calls
Q8. explain volatile
Volatile is a keyword in programming that indicates a variable's value can change at any time.
Volatile is used to declare variables whose values can be changed by external factors.
It is commonly used in multi-threaded programming to ensure that the latest value of a variable is always used.
Volatile variables are not optimized by the compiler and are always read from memory.
Examples of volatile variables include hardware registers and shared memory locations.
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month