Monday, May 18, 2015



C++ questions:

13.What is copy constructor and a default constructor and write a copy constructor and explain shallow copy with memory diagram.
14.Is it necessary to have const for a reference in copy constructor
15.Explain the stack over flow condition when pass by value is done in copy constructor.
16.Memory layout of a program and explain the different segements when a function call happen.
17. Explain the difference between static variable and local variable
18. what are the different storage classes present and explain the differnces between them.
19.Polymorphism and virtual concepts
20.Why a virtual destructor is needed explain with a scenario what happens when a virtual destructor is not defined.
21.What is a smart pointer and why it is needed?
22.Difference between smart pointer and auto pointer and write the code for autp ptr implementation.
23.exception handling in c++
24.what is stack unwinding?
25.Difefrence between vector and list.
26.Templates and function templates.
27.what is operator overloading  ? implememt how to overload ++ operator and "insertion" operator.
28. What is memory leak and memory corruption and explain the scenario for memory leaks and memory corruption with a sample code.
29.What is factory pattern? why factory pattern is needed?
30.What is builder pattern pattern ? write a sample code for the same.
31.What is a singleton pattern and write the code for the same.
32. How can you retain the values of a local variable without using a  static variable.
33.What happens when a function is made inline?
34. why inline functions are needed and in what scenario the inlines are needed?

35..Find the first non repeated value in the array by iterating only once.

Thursday, March 5, 2015

Linux Device Driver,Embedded C Interview Questions

Below are the collection of interview questions for positions in Embedded,Linux Device Drivers,QNX BSP Kernel Programming, C language,System programmer.


**************************************************************************************
Telephonic :nvidia
> What are types of ARM exceptions
//http://osnet.cs.nchu.edu.tw/powpoint/Embedded94_1/Chapter%207%20ARM%20Exceptions.pdf
> What is data aboard,do you know this,which ARM exception does this comes in to.
> How an exception was raised when encountered any mallicious code
> How the malloc internally work
> When an unallocated pointer is derefrenced ,who will check that this is invailid instructoin.
> Does the translations ,page tables ,virtual to physical translations all these are done in s/w or h/w
> About voltile keyword,how volatile ensure that to read current updated value.
> As you wokred in USB skeletion driver ,and about controller driver reads the deive descriptors.
  How does controller driver reads the device descriptors if it via buffers,how does buffers are manged

  like any DMA things to be taken care,like cache.
**************************************************************************************
1st Round Questions:ScanDisk

1. What is your role in J6 board bring-up
2. How you initialized EMMC in J6 board
3. What are the difference between EMMC version V1 and V2?
4. Any board bring-up sequence?
5. How to find the given number is power of 2?(Explain the logic how N & N-1)
6. Set a bit / Clear a bit / Toggle a bit?
7. Thread related Question?
8. Write a program for PWM using 2 threads and both the threads should start at same time?
a. (1st thread square wave  0 1 0 1 0 1 0 1 0)
b. (2nd thread square wave 00 11 00 11 00 11 00)
9. Regarding memory speed for file transfer.
            Requirement:1. Having 2000 files with 6MB size each
                                  2. Time is 2 min
How much speed we need to transfer the data to copy the complete files into  emmc/ any other?
10. What are the difference between SPI and I2C ?
11. What are the different speeds in I2C and explain the number of slaves connection and how the address formation will be?
12. What is the maximum speed of SPI?
13. How to find the given linked list is palindrome or not? (logic is required)
14.   How many loops are required to find the given linked list is Palindrome or not?
15. Explain your project architecture and where is your contribution?
2nd Round:ScanDisk

1. Write a program to find little endian or Big endian?
2. Write a program to find the number of bit’s set in a given number?
3. Write a program to delete a node in linked list(Any kind of linked list)
4. Write a program  for set clear toggle a bit and find the given bit is set or not?
5. Types of storage classes?
6. Explain each and every storage class? And where Register storage class variable will save when registers are full?
7. Static key word usage and limitations and scope and where it is usefull?
8. Extern key word and what is the use of extern and gloable keyword?
9. Why we need Extern when we have Global value to access throughout the program?
10. IPC Mechanism? Types of IPC?
11. Write a program for shared memory?
12. Difference between Mutex and semaphore?
13. Where to use mutex and semaphore?
14. Regarding Deadlock situation and how to avoid deadlocs?
15. Does Preemption is required if there is a deadlock situation?
16. What is critical section? What mechanism is required to lock the shared resource in threads?
17.  Structure padding and use of structure bit fields and how is save in memory location?
18. Is it possible to declare a function in structure?
19. How we can declare if we want?
20. What is volatile keyword? And where we can use?
21. Does synchronization technics are required for Volatile variable?
22. How you will analyze a crash without having any info (Kernel crash)?
23. Which are the information required to analyze crash?
24. Do you know panic and oops errors in kernel crash?
25. Major and minor number ?
26. write a character driver ?

3rd round:ScanDisk
1.Explain Boot up sequence and project which you worked?
2.Related to memory questions?

4th round:ScanDisk
        1.Do you know about the company?
2.      2.What is the use of emmc?
3.     3.How you will proceed to bring up the board?
4.     4.What all  things you need when you are bring up the board?
5.     5.How you will bring up the board if we replace the original EMMC with our own EMMC?
6.      6.Do you know about how android will launch?
7.      7.Previous project related questions?
8.      8.How fastboot will work?
9.      9.How you will communicate with kernel if you don’t have access?
10.How you will debug the memory issues?
11.Do you know about flash memory?
12.What  is the difference between NAND and NOR?



Mirafra Interview Questions for QNX OS for Automotive Domain(Client : Qualcomm)
Round-1
1.Write a macro to swap the nibbles in the word ?
Ex:0x1234 output:2143

2.Differance between macro & micro Kernel.

3.what you observed difference between QNX & Linux

4.Difference between Semaphore & Mutex

5.Write a programme to delete a given node number in Single linked list.

6.difference between processes and thread

7.diffrence b/w RTOS & GPOS

8.code base query :
Need the out put to be printed as 10.
int a=10;
main()
{
                int a=20;
                printf("%d",a);
}

Round-2
1.What are the projects you worked and breif them

2.What is the difference between I2C & SPI

3.How will you chosse which protocal to be used on board communicaiton

4.How the communication difference b/w I2C & SPI

5.Sceanrio based query:
Had 4 sensors on board,which communicaiton you will chose to establish communicaiton b/w the sensors

6.Code base query:
what is the output.
main()
{
                int *p= &a;
                int a= 5;
                printf("%d %d",*p,a);
}

7.Diff types of storage classes and details of each storage class

8.Detailed discussion on Static like storage ,default ,scope,life time.

9.Code based query:
what is the output.
main()
{
                int a= 5;
                int *p= &a;
                printf("%d %d",*p,a);
}


main()
{
                int a= 5;
                int *p= &a;
                *p++;
                p--;
                printf("%d %d",*p,a);
}

main()
{
                int a= 5;
                int *p= &a;
                (*p)++;
                p--;
                printf("%d %d",*p,a);
}

10.
const volatile int *ptr;
*const volatile int ptr;
What is the diff .

11.
which pointer value we can  modify.
const volatile int *ptr;
*const volatile int ptr;

12.different IPC mechanisms in QNX & Linux

13.Discussion on Shared Memory

14.Roles & Responsibilities in the project

15.What is greb loader

16.Embedded board Booting sequence

17.Diff b/w MLO & IPL.

18.Who will provide MBR and is it possible to modify.

19.Debugging techniques.

Round-3

1.Why are you leaving the company, what are the reasons.

2. Write a macro to swap the nibbles in the word ?
Ex:0x1234 output:2143

3. Thread locked a resource ,before releasing the resource an Interrupt got triggred ,here interrupt is also using the same resource.
  How will you handle this scenario.

4.Having Three resources and 10 Threads,
out of 10 ,3 threads acquired the resources, How will handle the reaming 7 threads
which thread has  to come first to take the release resources
Which type of mechanism will you use for synchronization.

5.Diff b/w Semphore & Mutex /binaru sema & Mutex.Is it possible to use the counting semaphore for above scenario

6.What is Bit Binding in I2C protocol

7.Multimaster & single slave communication
m1: 0001 0000
m2: 0101 1010
m3: 0000 1111
Which master will acquire I2C Bus

8.What is i2c clock stretching

9.Is clock stretching is for Master or Slave in I2C protocol

10.How Multiple Threading is handled in single CPU.
**************************************************************************************
Panasonic America Automotive for BSP Role for QNX OS
*************************************************************************************************************
1.Is const volatile possible ?
2.Where a const volatile variable is used?
3.What is booting sequence of linux?
4.Booting Sequence of a board ?
5.Why primary boot loader and secondary boot loader required?
6.What are types of boot loader?
7.How a user mode is transferred to kernel mode?


What part of kernel driver worked. Explain
Difference between kernerl/user space
How system call causes change from user to kernel space
Which RTOS worked on. Difference between various OS/RTOS
How to chose RTOS for a consumer product
Measure of performance of OS. Define performance
How to debug crash. Gdb
What is object file, how its used in crash
What are the various code optimization techniques used
memory leak deduction and various ways of handling
How to write own malloc call
How to proceed if system is sluggish
How to determine if some high prio task is hogging CPU
How debug prints/system trace could help solve above issues
Important things to look for in code reviews
Experrience with Oscilloscope, logic analyzer, i2C sniffer
Understanding of schematics
Why driver code in not written in C++/Java
How to debug while system is running
Run Time optimization
Estimate the requirement in BSP domain
How to define the process of QNX/Arch delivery integration
How many years of experience in BSP domain


What part of kernel driver worked. Explain
Difference between kernerl/user space
How system call causes change from user to kernel space
Which RTOS worked on. Difference between various OS/RTOS
How to chose RTOS for a consumer product
Measure of performance of OS. Define performance
How to debug crash. Gdb
What is object file, how its used in crash
What are the various code optimization techniques used
memory leak deduction and various ways of handling
How to write own malloc call
How to proceed if system is sluggish
How to determine if some high prio task is hogging CPU
How debug prints/system trace could help solve above issues
Important things to look for in code reviews
Experrience with Oscilloscope, logic analyzer, i2C sniffer
Understanding of schematics
Why driver code in not written in C++/Java
How to debug while system is running
Run Time optimization
Estimate the requirement in BSP domain
How to define the process of QNX/Arch delivery integration
How many years of experience in BSP domain
what is repeate sequence in I2C?
How this signal will look on CRO?
How many lines required for SPI communication?
Do you need to change Clock polarity and phase for SPI?
Who has control of SPI clock?
What is deadlock?
How to come out of deadlock?
what is difference between mutex and semaphore?
Explain board bring up.
What is the difference between inline and macro?
Write program toreset bit in register if address of register is given
 reset (int address, int bit)
How do you implement malloc ?
How to know size of memory allocated by malloc using pointer?
What is the problem in following code
char * p = 'a';
How to fix it?
Explain cinit and bss section


Asked on what are optimisation that I have done in my previous project
how will you verify I2C communication?How will you know if there was a software or hw problem?
How will you know if the I2C lines are noisy?
Have you worked in crash dump?
How will you solve memory crash, what steps would you take if a crash occurs?
Diff between mutex and semaphore? Can semaphore be used for data synchronisation purpose?
Data sharing between ISR and threads?
Whats the boot loading process from powerup? They wanted a detailed answer to this asking for detailed explanation for every step?
what is NAND and NOR flash, diff between them?
What execution in place?
What monitoring tools have you used like I2C sniffer
How many years of experience in BSP domain
Details of performance related optimisation?

HARMAN Automotive :
*************************************************************************************************************
1.What  memcopy do? implement your own memcopy function?with optimization(less usage of variables?)
2. int *i
     char *c
     void *v
tell me the sizes ?
sizeof(*i)
sizeof(i)
sizeof(*c)
sizeof(c)
sizeof(*v)
sizeof(v)

3.What is big endian and little endian?
     implement a function changes the endians
4.what is cache coherence? 
5.what is critical section?
6.what is protection mechanism?
7.Can a scheduler can be locked?
8.How are the compiler optimization techniques?
9.what is user space and kernel space?
10.Main Advantages and disadvantages of having separate user space and kernel space?
11.what is scheduler?
12.who schedules the scheduler?
13.At what frequency scheduler looks for threads/processes ready for schedule?
14.what is tick?
15.what actually does a system does in a tick?
16.what is DMA?
17.When cahche is enabled in a operating system ,DMA is enabled,how does DMA access the cache?
18.what is scheduler algoritham?
19.How interrupts are generated?
20. write a programe which includes the variables should cover all the segments ?
21.Local Const variables reside in which segment?
22.Global const variables reside in which segment?
23. How many stack will present?
24.does each processes has it own stack ?
25.does each thread has its own stack?
26.what is context switch ?
27.when their context switch from thread t1 To thread t2 where does the stack information of t1 gets stored?
28.What is advantage of virtual memory?
why not directly the physical address?
29.What is MMU?
30.what is a page fault?
31.What is instruction pipelining?
32.What is page write back?

  1. Memory map of RAM
  2. Where do const variables get stored? (literal segment)
  3. Static, auto, etc
  4. Write a program to change endianness
  5. What is structure padding?
    Why does the compiler perform padding?
    How to send information over network? (structure packing)
  6. Declare an array of 10 integer pointers
  7. Volatile variable in-depth (definition, use case, impact, when to avoid, etc)
  8. Where does dynamic memory allocation get stored?
    What are the pros and cons of using dynamic memory allocation versus static memory allocation?
    If you had to allocate 1MB of memory that needs to be used for only a short time, which type of allocation would you use?
  9. Different types of schedulers (round robin, pre-emptive)
  10. Timeslice, jiffy
  11. Priority inversion, priority inheritance, priority ceiling
  12. Difference between semaphores & mutexes
  13. Write a program to implement memcopy.
    Optimize it such that it uses NO stack space at all
  14. How to handle situation when a program is too large for code space? (edit linker file)


1.Difference btwn Process and Thread
2.Diff btwn mutex & semaphore
3.Bit operations
4.C program for factorial, prime number with recursion  
5.About Booting process
6.Questions on Pointers
7.What is Process preemption
8.About priority inversion & priority inheritance
9.How priority inheritance will work
10.structure padding
11.about #pragma
12.How to avoid re declaration of header files
13.About Jtag

1.How you Evaluate the Driver
2.about ISR, Interrupts 
3.about Synchronization mechanism where you used  in real time(examples)
4.what happen if you use mutex in ISR, how you over come with that problem 
5.about memory mapped files
6.about linker scripts 
7.what is re entrant function
8.what is module
9. IPC mechanism
10.toggle alternate bits
11.about function pointers
12.Advantages of func pointers
13.Advantages of call back functions
14. Declare a array of function pointer of taking two arguments
15. How to find little endian and big endian


1. Implement your own memcpy function and Error handling in memcpy
2. How you handle errors with the pointers
3. About dynamic and static memory
4.about malloc in depth
5. about Null pointer
6. how can you determine whether your memory is in protected or un-protected mode
7. About memory layout 
8.How you will think while writing a program in optimized way 
9.They will ask most of the question from memory in this round please study MMU well.

Some Imp Question:

1.About volatile and use cases
2.Why the first two parameters are of type void in memcpy
3.Are #pragramas Gerneric or processor specific
4.Enabling & Disabling of interrupts
5.C program to swap every 2 bits in a 8 bit binary number.
6.Write a program to find how many bit to toggle in 2 binary numbers so that they become equal
    a. program for to get the number of bits toggle in 2 binary numbers and toggle them to make the numbers equal
7. what is user mode and kernel mode

1.How you Decide the stack size for the function or thread.
2.Booting Sequence
3.About JTAG
4.Diff btwn SPI & I2C
5.Memory Layout
6.what is your strength 
7.About Disassembly file(Memory map file) 
8. About clock & timers
9.About Stack
*************************************************************************************************************


PANASONIC and HARMAN Automotive:
*************************************************************************************************************
1. Booting sequence in embedded systems
2. How to decrease the time of booting processes
3. What is the functionality of PROBE function
4.How to detect whether a device is not detected?
5.Own Malloc implementations
6.memcpy implementation
7.Find a word from string
8.How to find if their is in repeating node in linked list
9.For a given array gather all 1's to one side and 0's to one side.
10.In a given byte interchage pair of bits
11.Reverse linked list
12.Reverse string
13.Reverse a word in a string


Ericson:
*************************************************************************************************************
1.A thread is created by processes, how the process comes to know the completion of that created thread ?
2.In a big array consists of 1's & 0's ,write an efficient programe to keep all 1's to right side and 0's to other side?
3.Write a programe In a given string find a specific word.
4.Semaphore internal code behavior in a way semaphore implementation ?
5. Topic to look :
 1.            Inter-process communication
a.            Socket programming
b.            Named and unnamed pipes
c.             Message queues
d.            Shared memory, mmap
2.            Synchronization mechanisms
a.            Mutex and semaphore
b.            Spinlocks
c.             Synchronization between ISRs and process context threads
3.            Debugging using GDB
C Questions
------------
1. Storage classes
2. const and volatile
3. How to allocate memory in c - malloc vs calloc
4. brk, sbrk
5. Any other system call to allocate memory. mmap ; anonymous mapping
6. Memory barriers; Why are they required
7. Wild and dangling pointers
8. struct alignment and packing. Need of alignment
9. Pass by value and ref
10. Endianness
11. size of void pointer
12. What is thread safety
13. What is re-entrancy
14. far and near pointers
Programming
------------
1. Verify if a number is a power of two
2. nth element from last in a  linked list
OS Concepts
------------
1. Thrashing
2. Deadlock - example
3. MM - Segmentation, paging, swapping
4. Paging vs swapping
5. Different segments in a program
6. Does linux use segmentation
7. System boot sequence
8. What is DMA. Modes - cycle stealing/burst (blk transfer)/transparent
9. Cache coherency during dma. Which component handles it
Linux
------
1. How are interrupts handled in linux 
2. spinlock vs mutex vs semaphore
3. Top and bottom halves. examples
4. Different contexts
5. softirq vs tasklet vs workqueue
6. IPC mechanisms - shared mem/pipe/sockets/DBUS
7. Memory alloc in linux - kmalloc vs vmalloc
8. System call implementation
9. Physical Virtual and logical addresses
10. Threads vs processes
scheduler in linux
Hardware / Protocols / Misc
-----------------------------
I2C 
 - Protocol
 - Slave address

*************************************************************************************************************




 Dover corporation:F2F
1.what is a device driver and write a simple driver
and explain what happens when an insmod is done an module
2.How will you insert a module statically in to linux kernel.
3.what are IPC mechanisms and explain d/f between all types with example scenario
4.explain the synchronization mechanisms
5.Explain about file system in linux kernel and how a kernel handles any file when it was created.
6.what is file descriptor and what informtion it contains in file descriptor
7.How do u see system messages and how do find the issues in system by reading the proc file system or dmsg queues or sysfs information.
8.what all kind  of info is present in procfs.
9.when do u select the semaphore and a mutex and binary sempahore.
10.what is an interrupt and difference between exceptions and signals
11.How many types of signals are present in linux kernel.


Shared IRQ :
When a signal is raised on irq line which triggers an exception on processor.
Linux had data structure called interrupt descriptor table which is linked list of irq descriptors
number  of descriptors is equal to number of irq lines. Below screen shot shows the irq descriptor table.
 This descriptor had two main pointers handler and action.Handler pointer is to managing a irq line like enabling , disabling and acknowledge and action pointer is to call the registered function to be called.
Linux allows single irq line to be shared between multiple devices in such case the action pointer points to multiple handler functions.Each ISR is called in sequence of the ISR's registered.







1. In a processes address space does the code segment starts form zero?
Ans.  No, out of 0-3GB processes address space the first 64kb is not used for process address space
         that 64KB is used by OS for critical/important tasks.
      (In general it is 64kb it may vary.)




Nice link for LDD questions:
http://embedded-telecom-interview.blogspot.in/2010/07/linux-and-linux-device-driver-interview.html

Void main()
{
    char *str_ptr="MY_STRING";
    printf("%s",str_ptr);
}
     In processes addres space wehre is string "MY_STRING" stored ?
Ans. string "MY_STRING" stored at read only Text segment and str_ptr stored at data segment.






In a Process Address Space what if stack or heap collide?


Malloc Implementation (not Interview FAQ but you can impress interviwer if asked)
http://danluu.com/malloc-tutorial/
(
    Very effective and easy to understand (My Pref read this down to the blog you can find very useful     link  https://github.com/danluu/malloc-tutorial/blob/master/malloc.c to see simple malloc code
    Read this too
    http://duartes.org/gustavo/blog/post/anatomy-of-a-program-in-memory/
)


http://www.inf.udec.cl/~leo/Malloc_tutorial.pdf
https://fossies.org/dox/glibc-2.21/malloc_8c_source.html  //glibc malloc source code.
http://moss.cs.iit.edu/cs351/assets/slides-malloc.pdf






Ericsion Interview from WIPRO:

1.Write a simple with crtical section,mutex lock and mutex unlock.
2.What is the difference between Mutex and Binary semaphore
3.What is difference between Mutex and semaphore
4.Working of spinlocks
5.Can Spinlocks works on mutliprocessor system.
6.In what scenarios mutex is used and semaphore is used.
7.Delete a particular node in a linked list having argument passed as address of a node.
   without Header pointer known and other implementation with header pointer known
8.When a signal is raised on a interrupt line what will be passed to processor either interrupt number        or anything else?
9.How kernel comes to know which device raised an interrupt when  interrupt  is shared.
10.How can an application can talk to specific device in this below case ?
      having Hard Disk devices
        SATA0
        SATA1
        SATA2
 if their a devce driver registered for these devices and a single drivere is used to manage thesr devies then how can an application talk to a sepcific device
Ex: if i want to read from SATA1 hard disk and Write to SATA0 and SATA1  hard disk.
11.How do you establish a sync mechanisam in above hard disk scenarios.
12.When a Mutex lock is aquired by a low priority task and High priority trys to acquires the lock
      will the low priority task will be pre emitted .
13.The same above scenario is with sema and spinlock
14.Explain working any any IPC mechanisam.
15.Where your driver will be in kernel
16.Explain about process address space with data seg,code seg..
     how much memory is occupied by process address spcae.
17.When a same executable is excuted in two terminals like terminal 1 execute ./a.out and terminal 2 executed ./a.out what will the programe address space look like on RAM
18.If a global variable defined as int V1=100 in programm_1 and modified this V1=200 in              programme_2.what will be printed in Programme_1 and Programme_2.
19.char *name="WIPRO";
       sizeof(*name) = ?  (Ans :1)
       sizeof("WIPRO")= ? (Ans :6 )
       sizeof(name)= ?    (Ans :4 )
20.Declare a function pointer which takes 2 arguments as char pointers,and returns an integer pointer?
21.For above function pointer assign the function to be called?

.............................................................................................................................................................

CISCO Interview from WIPRO:
Malloc allocation tutorial
Write your own malloc implementation without using system calls.(FAQ Interview)
http://danluu.com/malloc-tutorial/
http://www.inf.udec.cl/~leo/Malloc_tutorial.pdf


Understanding linux Kernel Oreily
http://idak.gop.edu.tr/esmeray/UnderStandingKernel.pdf

Linux Kernel Dervelopment by Robert Love click on 1st item
https://www.google.co.in/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=robert+love+linux+device+drivers+4th+edition+pdf

Linux Device Drivers Oreilly
http://www.oreilly.com/openbook/linuxdrive3/book/


Below link explains i2c well
http://maxembedded.com/2014/02/inter-integrated-circuits-i2c-basics/


Below Link Explains how a Prob function called (FAQ in device driver interviews)
http://stackoverflow.com/questions/7578582/who-calls-the-probe-of-driver



1. Write program for Fibonacci series of first n number
           Ex: if n=4 ,answer is 0,1,1,2
2. Write program to Insert element in static array.
          Ex: int a[20] = {1,2,3,5},
               Given input element is 4,
               answer is {1,2,3,4,5}
3.Write your own malloc implementation without using system calls.

         Hint:How you will get the heap next free address

4.Reverse the words in given strings.

         Ex: I am good boy

         answer : boy good am I


5. Swap two element in efficient manner


Design Part
1. Class diagram for State Machine.
 

OS Concept 

1.Message queues

2.semaphore
Memory Leak Debugging concept.  Whats your approach on debugging a core dump.
Memory layout of a process. Stack/Heap/BSS/Data/Code.
implement malloc API.
C++ Programming Concepts . why do we need virtual function? How the performance is affected by this?)
Concepts of pointer and reference.
1.       Write a malloc_alloc() function for an integer, without using heap or any system calls
Int * malloc_alloc(int * 1) Hint: normal integer pointer allocation ; storage can be in data segment
2.       Write a pgm to insert an element in a sorted array; check all boundary conditions
3.       Implement a state diagram for state change based on events
Hint: use a Table mapping events to state change
4.       Memory usage, heap, physical memory, system concepts
5.       Data segment/Bss etc
6.       Compare the size of the 2 files after compilation.
File1:
int arr1[1000];
Main() {
}
File2:
Int arr2[2000];
Main() {
}
Hint: File size is same
7.       Lastly worked project details and design
8.       Bit manipulation – To set a bit at a position in a 32 bit integer


.............................................................................................................................................................

Cisco f2f interview
1.Write a C program to set a bit at a particular position.
2. Write a function in library file that function should return a 32bit unique integer number every time the function is called and that function will not take any arguments?
3.How above written library function to be take care in multi thread scenarios. 
4.What is the default value of static?
5.how the default value is get assigned to static variables?
6.Where static variable are present in programme address space?
7.How a interrupt is registered?
8.How a delayed execution in interrupt is handled?
9.In detail about top half and bottom Half?
10.In which interrupt context the interrupt will run?
Ans. Arbitary Thread context means(The processes in which the interrupt was triggered.)
         (https://www.osr.com/blog/2014/09/08/arbitrary-thread-context-article-video/)
11.what all Debugging techniques you know?
12.do you know scripting?

2nd-Round:
1.Create a pointer pointing to integer type point that to char array containing 10 elements?
2.The above created pointer if incremented ++ which element of the array it points to?
3.Write an instruction such that integer pointing sould point to first element of the array on increment?
4.Will their be any compilation errors while trying to print the below?
     int *ptr=NULL;
     printf("%d",*ptr);
5.will their be any warning if yes when at compile time or run time?
6.Expalin about your latest project?
7.Explain about shared interrupt  and how an correponding 
interrupt Handler is called while an interrupt is shared?

.........................................................................................................................................................
Broad com:
1. write a C programe to check given string is palindrome or not.
2.Write a C programe to reverse a string.
3.write a C programme to copy a string to other char pointer
4.write a C programme for any sorting logic.
5.write a C programme to set a particular bit to 1 for given position.
6.write a C programme to set a particular bit to 0 for given position.
7.write a C programme to toggle a particular bit for given position.
8.Volatile keyword
9.Interrupts mechanisam
10.Synchronization techniques(Semaphore/Mutex/Spinlocks)

..........................................................................................................................................................

SmartPlay :
1. write a C programe to set bits  from 3 to 7  positions to 1 in a 32-bit given value
Condition is at a time only one bit from 3 to 7 bit positions to be  1 and if not all bits to be reset.?

2. Determine the minimum stack size required for given prog by end of main function?
Void main()
{
int x,y;
char c;
fun1();//Assuming forward declaration is done.
fun2();//Assuming forward declaration is done
fun3();//Assuming forward declaration is done
}

void fun1()
{
int a,b,c;
c=a+b;
}

void fun2()
{
char c;
}

void fun3()
{
}

3.what is the internal implementation/mechanism made to work volatile to get the updated value?

4. Behavior of  system call from user level to kernel level.
5.What is software interrupt and hardware interrupt with examples?
6. Spin locks behavior?
7.What is structure padding?How can we eliminate it?
8.If structure padding is efficient why not C language made this as default behaviour?
9.
..........................................................................................................................................................

HCL telephonic:
1.Explain camera sensor project
2.How frame buffers are allocated in camera sensor project
3.how to debug your driver if u had any buffer issues
4.Do u know about V4L2 layer
5.Have u faced any page faults in driver and how u will solve that issue?
6.How the data is transferred from camera sensor to LCD display
7.Do u know about IOCTL operations? and have they been used in your camera sensor project.

8.what is softirq and tasklet and work queues?
9.how you select the bottom half mechanism and what are the differences between them
10.what in interrupt context and process context
11.what is context switch
12.what are kernel synchronization techniques
13.Difference between sempahore and mutex and when u select the semaphore and mutex to use in your driver
14.what is process management
15.What is kernel thread?
16.what is pthread?
17.Do u know about IPC mechnanisms?
18.what is shared memory
19.Explain MMU in Linux
20.what is /proc entry and how it is useful
21.how the device files are created in linux
22.Difference between structure and union
23.what is function pointer and how it is used?
24.can i call a function using the address of that function through a point variable?

..........................................................................................................................................................



General Question Collection:

->Storage classes
->Where static and global data members stored?
->What is shared lib and static library?
->How can two slaves can communicate with master in i2c protocol at a time?
->How can we address different devices from same vendor i2c?
->Structure padding?
->Difference between #define and CONST, which one will you chose in programming?
->Debugging techniques?
->Volatile keyword?
->Top half and bottom half interrupt approach?
->Inter process communication techniques?
->Threads, Fork and clone?


->Device driver projects
->write a efficient programme to set a particular bit in a givne number?
->Difference between typedef and #define?
->Callback functions?
->Intterupt top half and bottom half?
->USb driver project?

..................................................................................................................................................................
Global edge:
1.Explain camera sensor driver project
2.where the camera driver resided in kernel
3.Know about VL42
4.I2C protocl
5.I2C- dummy write,repeated start,arbitration,synchronization between masters
6.Lm475 temeprature driver project
7.storage classes in C
8.Questions on static,diff b/n static and extern
9.can we assign pointer to a static variable?
10.can we assign pointer to a register variable
..................................................................................................................................................................
HCL:
1.How to give memory of 250Mb to kernel (high zone memory)
2.Working of camera sensor project
3.bit operations :set a bit, clear a bit,toggle a bit
4.find a loop in a linked list
5.can we add two pointers
6.can we subtract pointers
7.Difference between structures and union
8.storage classes
9.diff between static and extern
10.How to develop a device driver for a hard device?
..................................................................................................................................................................
DELL:
1.Explain the projects what u have done
2.IPC,memory management, process management
3.Socket programming
4.Delete a node in the list
5.find a word in a buffer
Telephonic for CISCO:
Linux
1. Explain in brief about your project (Camera device driver)?
2. What is the communication protocol used to communicate with camera sensor?
3. How to write data to camera sensor address?
4. Which type of address (virtual or physical) is used in function iowrite32?
5. What is concept of virtual address or physical address?
6. Why virtual address is required when physical address is existing?
7. What all the things to be taken care while handling an interrupt?
8. Main  difference between Tasklets and workqs?
9. When an interrupt can be enabled again?( Not asked but better to find the answer When an interrupt can be disabled)
10. What is volatile variable?
11. How to register an interrupt handler?
12. How to know whether a interrupt is an edge triggered or level triggered from registering an interrupt handler?
13. What is the type of driver char or n/w or block driver you developed?
14. How to register a CHAR driver to kernel?
15. How to load a dynamic driver or static driver?
C
11. what is a static variable or static function?
12. what is the difference between static variable and global variable?
13. Where a global variable and static variable resides in at run time?
14. What all the segments present when a programe at compile time?
14. What all the segments present when a programe at run time?
15. Tell me the logic to disable specific set of bit provided a 32 bit number, start bit and end bit?
Example given numb, disable whatever the data from 5th bit to 10th bit.
16. Tell me the logic how can you find depth of a stack?
Example In a program their is foo1() function calling foo2() function  calling foo3() in any function write a logic to know the depth of stack.
17. s3c2440 processer supports which ENDIAN type?
18. Can Volatile be applied to pointer?
19. Why to have Virtual memory concept instead why cannot we increase the RAM on system?
20.s3c2440 supports what bit type 32/16/8?
symphony teleca F2F questions
1.volatile variable usage
2.const and volatile difference
3.can volatile and const be used together?
4.How do you declare pointer to memory mapped area?
5 Call backs and explain with example
6.How callbacks are different to normal function calling?
6.synchronization mechanisms (semaphore and mutex)
7.Difference between binary semaphore and Mutexes
8.Interrupt handler ? how interrupt is serviced?
9.difference between Malloc and calloc
10.what is memory leak and how to avoid it?
11.I2C protocol

Second round:
1.What are the design issues/considerations  that was taken care for your camera project.
2.Expalin about the S3C2440 processor architecture
allegion interview F2F qs
1.why size of data types is restricted?
2.why volatile and why it cant be used to all variables
3.difference b/w macro and a constant variable
4.I2c protocol and diff b/w i2c and spi
5.what is  i2c bus error
6.how to synchronize devices which operates at different frequencies
7.explain how an interrupt of hardware device is handled
8.explain embedded system architecture (von neumann and harvard architecture)
9.s3c2440 board architecture
10.make file creation and it rules and how it works to create .objs
11.Build process of  C program (preprocessing, compilation,linking etc)
12.Questions on Wifi-- related to networking

..................................................................................................................................................................
Broadcom//Face to face.
1. WAP to toggle the given range of bits for a given number(with out using loops)?
2.How C programme memory address space is allocated?
(stack,heap ,data segment,code segment
given few functions in a programme and asked to tell which all variables goes to which sections in
programme memory adress space)
3.How can you make a header file not to include multiple times?
4.Q's on #ifdef,#ifndef
5.where are static variable get stored in programme adress space?(in stack/heap/data segment)
6.if we print the adress of local variable which adress it would print?
7.What all the data memebers stored on data segmet?
8.Volatile use case?volaitile is qualifier or not?
9.static use case ?
10.Over all more Q’s on programme address space,stack heap segements?
..................................................................................................................................................................
Broadcom//2nd Round
1.main()
  {
  int a;
  }
  where a will be stored.
2.WAP to know how stack grows in upward or downward directions?
3.WAP to convert ACII to Interger?
4.Why ASCII number is required?
5.Given Two borads and with exactly same CPU's should they require different compilers?
6.#include<stdio.h>
 void main ()
 {
 int a;
 }
 how this programme looks after preprocessing?
8.The project done by you are in linux platform if gcc is the compiler used what is the preprocessor used?
9.what is the job of preprocessor?
10.more deep question on preprocessor and compiler?
11.what is diff b/w process and threads?
12.Will threads have their own stack space?
13.can one thread access the address space of another thread?
//http://www.cs.cf.ac.uk/Dave/C/node29.html
14.Overall 2nd round more Q's on preprocessor,compliler,process and threads?
15.main()
  {
  int a;
  }
  how variable ‘a’ get allocated memory  in assembly level language?
16.In printf what it the purpose of %X ?
17.What is the size of integer variable on 32bit and 64bit machine?
18.Structure
{
Int a,
Char c;
Int b;
}
What is the size of the structure.
19. What is an re-entrant function?

..................................................................................................................................................................
Broadcom://Telephonic
1. Brief about yourself?
2. In Depth of USB Device Driver?
a. What are the different data transfer modes?
b. If there is a speech audio data to be received by USB device what type of data transfers will
you chose.
c. What are the different types of device descriptors?
d. How many END point descriptors can be present per device?
e. What is a configuration descriptor?
f. What is a control type of data transfer?
3.In a given structure having n number of structure members how do you find the sizeof structure?
4. How can you find the offset  of next structure member
 if out of n-number of structure members ,xth structure member is given  how can you find the size of structure?
5. DO you know container macros? In all most all kernel drivers it is used?
6. What is call by value and call by reference?
7. If passing name is an call by value, then array name is passed is it also call by value?
8. Volatile keyword? Usage?
9.  Can a volatile member can be cached?
10. Can you see any difference between MUTEX and Binary Semaphore?
11. Spinlocks mechanism?
12. A global data member is programmed to get modified in a thread and Interrupt,so what kind of synchronization mechanism will you use?
13.If spin locks what flavor of spin locks will you use.
..................................................................................................................................................................
Xylinx:
How can a static driver runs? Without doing any insmod?
Any idea about Device tree?
synchronization Techniquies programmes
IOCTL implementation prog
C-Code data segments
C-programme complilation steps
Where will be your driver file will be located
What is the entry point of your driver
Memory Kernel Working
USB Driver
i2c Driver
IPC Mechanisams
Port Mapping/Memory mapping
Fork/Clone
Diff of Kmalloc and Vmalloc
Linked List
Device Tree
String operations
Call back
Programme to find little Endian and Big endian
programme to find the size of a structure with size of operator.
Programme to implement reversal of bits
ARM processor overall knowledge.
Overall knowledge of kernel building knowledge.
..................................................................................................................................................................
MiroChip
->Linked List creation, adding elements, insertion in the middle, deleting elements in the middle.
->2-Dimentional array creation, allocation
->Reversing bits.
->IPC
->Creating of threads
->Difference between process and threads
->Debugging of kernel
->Kernel crash dump analysis
->basics of board support package

..................................................................................................................................................................
Tata Elexsi:
->Storage classes
->Where static and global data members stored?
->What is shared lib and static library?
->How can two slaves can communicate with master in i2c protocol at a time?
->How can we address different devices from same vendor i2c?
->Structure padding?
->Difference between #define and CONST, which one will you chose in programming?
->Debugging techniques?
->Volatile keyword?
->Top half and bottom half interrupt approach?
->Inter process communication techniques?
->Threads, Fork and clone?
->


..................................................................................................................................................................


Global Logic:
->Device driver projects
->write a efficient programme to set a particular bit in a givne number?
->Difference between typedef and #define?
->Callback functions?
->Intterupt top half and bottom half?
->USb driver project?
->
..................................................................................................................................................................


General:
Sizeof operator without using sizeof operator?
Search the middle element in a given list?
Ethernet driver how a packet get transferred in Ethernet drivers?


System call flow?
blocking and non-blocking USB calls
How and steps a C programme executes.,
How the programme is loaded in execution space


1.C prog Compilation steps
2.C prog memory layout.
3.Diff b/w string and string lit
4.What actually preprocessor does
5.
..................................................................................................................................................................


WIPRO:

->How Memory Management works in KERNEL?(In total about Kernel Memory management)
->Inter Process communication techniques?
->Spin locks working?
->Favorite topics in kernel?
->Tell about interrupts handling in kernel?
->When a interrupt is handled whether that specific interrupt is disabled or not? If disabled why ? if not disabled why not disabled?
->When a interrupt is handled tell whether all interrupts are disabled or not ?if yes why ?if no why?
->As device driver developer when you will you disable or enable particular interrupt or all interrupts>
->What is the functionality of save_interrupts?
->what is the first function called when interrupt is handled?
->Have you heard about “Handle_interrupt” ?
->What are the possible ways that memory leaks can happen in a programme ?(Apart from allocation and not freeing )
-> How a memory leak can happen in a linked list?
->How a Reception of packet performed in a Ethernet device driver? (Explain from starting to reception of packet)
->How can you rate yourself in KERNEL?
..................................................................................................................................................................

HARMAN

->How can you avoid accessing of an array beyond its limits?
->Whether an exception or normal operation when an array is accessed beyond its limits?
..................................................................................................................................................................

General Q's:
->What are types of function(Callback,Recursion ....)?
->what is advantage and disadvantages of each function type?
->Implementation example for each function type?
->What are different searching algos expalin each one ,implement any one?
->link for programmes of palidrome ,fibonaci,searching etc.
http://study-for-exam.blogspot.in/search/label/C%20programming#.VHUuByWoLFY



..................................................................................................................................................................

WIPRO:

->How Memory Management works in KERNEL?(In total about Kernel Memory management)
->Inter Process communication techniques?
->Spin locks working?
->Favorite topics in kernel?
->Tell about interrupts handling in kernel?
->When a interrupt is handled whether that specific interrupt is disabled or not? If disabled why ? if not disabled why not disabled?
->When a interrupt is handled tell whether all interrupts are disabled or not ?if yes why ?if no why?
->As device driver developer when you will you disable or enable particular interrupt or all interrupts>
->What is the functionality of save_interrupts?
->what is the first function called when interrupt is handled?
->Have you heard about “Handle_interrupt” ?
->What is Memory Leak?
->What are the possible ways that memory leaks can happen in a programme ?(Apart from allocation and not freeing )
-> How a memory leak can happen in a linked list?
->How a Reception of packet performed in a Ethernet device driver? (Explain from starting to reception of packet)
->How can you rate yourself in KERNEL?
->Points you will inquiry when a driver from one platform to be ported to another platform?
->How do you do debug?
->Have analyzed kernel panic code dump(what all data it dumps and what do you understand from it)
->What are storage classes available ?what are the scenarios the specific storage class is used?
->Are you comfortable with pointers, linked list and Queues?
->What is memory mapping ?How kernel knows to which memory location the devices are mapped?
->


..................................................................................................................................................................


HARMAN
->How can you avoid accessing of an array beyond its limits?
->Whether an exception or normal operation when an array is accessed beyond its limits?
..................................................................................................................................................................
Aricent :
1.What is Function Pointer?
2.What is Call back function?
3.How Call Function works?
4.What is the clock frequency used in your I2C driver designed?
5.What is the start bit condition in I2C?
6.How I2C protocol works?
7.What are different speeds the I2C had?
8.What is the path of your driver inside kernel?
9.Can interrupts sleep?why?
10.Types of interrupts?
11.What are the function names for the driver you designed?
12.How the master knows what is the start condition ?
13.while in between I2C communication what happens if clocks happends to be dragged low which is not as per i2c standard?
14.What if the slave device is not responding or no acknowledge bit is sent by slave device?
15.What is the difference between kmalloc and vmalloc?
16.how to get physically contiguousness memory allocation if kmalloc is giving logical contiguousness allocations?
17.How do a driver get registered to kernel?
18.What actually happens while interrupt occurs exactly explain in terms of context switching
,what happens to the current running process?
19.As their no code written to do  context saving when a interrupt happens in any of the functions then  which is responsible in doing this context saving and switching context?
20.How "Make" is performed in compiling a module?
21.What is VOLATILE keyword?
22.Write a program to perform a string copy without using string library functions?
..................................................................................................................................................................

Wipro/ERRICSON:
1.What is the difference between Linux and RTOS ?and Reason why linux is not Real time?
2.How User space buffer can be accessed from kernel level and viceversa?
3.How to debug different threads in GDB?
4.Comfort level in Assembly level language?
5.What are the kernel structures and which kernel structure used in device driver development?
6.What is interrupt nesting, How IRQ priority handled?
7.What is SERDES?
8.How do you pass data between kernel modules?
9.What are different embedded design patters?
10. Memmory Mapping, synchronization Techiniques , Interrupts , Mutes , Interprocess_communication?
..................................................................................................................................................................

Ericsson :
1.Explain about any Device Driver project your good at?
2.Can call back functions or Recursive call can be made in asynchronous events?
3.What is stack overflow?
4.Difference between processes and Threads?
5. How can you corrupt STACK?
6.What are the issues faced while developing driver projects?
7.What are your strengths?
8.Rate your self in C?
9.What is Blocking and Pooling?Diff ?

 ..................................................................................................................................................................

UTC Aerospace:
1.Storage classes in C
2.What is pointer
3.What is volatile
4.What is Structure
5.What is Class in C++
6.Difference between structure and class
7.What is Partition on DO-178B document?
8.What is Real time system
9.What are types of real time systems
10.what happens in Real time system if specific task in not executed at specified time?
11.What is Dead code and Deactivated code and diff b/w them?
12.Level of software as per DO-178B?
..................................................................................................................................................................
Aricent:
1.Explain about USB device Dreiver?
2.Explain about I2C Driver?
3.How USB driver is registration mechanisam?
4.How to pass a two dimentional array to other fucntion?
5.Syntax of main with arguments?
..................................................................................................................................................................

Global Edge:
C:
1.Difference between string and string literal
2.compilation steps of a C programme
3.Memmory allocation of a c programme
4.Why uninitialized data is placed in uninitialized data segment?

Device drivers project:
1.More questions on Camera device driver project?and more Questions specific to project?
..................................................................................................................................................................
SMART_PLAY
1.How do find wheter a processor is Big Endian/Little Endian?
2.Intreputs,Bottom half.
3.Memmory allocation using Kmalloc with FLAGS?

..................................................................................................................................................................
synapse-da
Device Drivers

Camera Project

How do you get JPEG image from CAM

Diff Semaphore & Mutex

Diff Insmod and Modprobe

Diff Binary sema and Muex

What are the precautions to be take care in ISR routine.

Diff Process and Thread

How to create a Major and Minor Numbs dynamically.

Diff b/w char ,Block and Network drivers

When Kernal had a previlage to write to any memory location then why do we need copy_to_user and copy_from_user functions.

What is Dead lock scenario.

Diff Kmalloc and Vmalloc



 ..................................................................................................................................................................

C:

Volatile

Diff array and Linked List.

Storage classes and difference.

Usage of Static data members.

While and For loop efficiency and which is better.

How to find a number is divisible by 4 without using mathematical operators

Diff static library dynamic library and shared library

Diff inline and macro.

Diff malloc and calloc


..................................................................................................................................................................
HARMAN:
1.How to create buffers in Kernel?
2.What is the difference b/w kmalloc and vmalloc
3.How buffer is copied to user level
4.Explain working of interrupts
5.Expalin about the projects mentioned in CV?
6.How to search for a specific nth-node in a given unknown number of nodes in a linked list?
7.How to determine the size of structure with out using "sizeof" operator?
8.What is memory leak
9.Fucntion Signature of registering Interrupt handler?aned Flags used while requesting IRQ?
10.Explain Shared memory ,Message Queue Synchronization techniquies in Linux
..................................................................................................................................................................
Unknown Consultancy:
Volatie variable:with example

Volatile is qualifier applied  while  declaring of an variable.

Volatile keyword tells the compiler that  variable can be modified from outside source without the action of the code the compiler finds nearby.

Volatile int a,

Int volatile b,

Int volatile *foo-> Pointer  pointing to a volatile integer

Volatile int *foo;



Register variable



Unions with practical example

Malloc and its disadvantages

Int *const p and const *int p meaning

Endianness determination

Diff between array and linkedlist

Bitoperations : how do u set a bit?

..................................................................................................................................................................

Mettasoft--Graphite semi
1.What happens when insomd is performed?
2.How system call is executed?
3.What all stpes involved while a C programme .exe is created?
4.How can you make part of driver code is allowed to be executed and not executed depending upon condition?
5.How Intrrupts are executed?.
6.Different synchronization techniquies ?how do you chose the best sync mechanisam fits the scenario?
7.What are all the Kernel APIs used in you driver programming?
8.In a given list of elements how to find the middle element?
   condition no count is available
   condition not known how many elements present
9.How the data integrity check is done in case of network packets or I2c driver communication?
10.How a packet is sent in ethernet driver?

..................................................................................................................................................................

  Consultancy:
1. A = 10000000000

  B = 0110

  i = 2

  j=  6

o/p =10000001100??


 2.how to implement own malloc function.

3.how to delete duplicate node in single linked list.

4.what is the entry points in kernel?

5.how to create a major number dynamically?

6. ISR descriptor Table


7.spin_lock_bh() diff spin_lock_irq()?

8. Do_irq?

9. Static Drivers vs Dynamic Driver?

10.Diff SLAB and Vmalloc

11.copy_to_user and copy_from_user?

12. how to divided critical work and non critcal work based on top half and bottom Half

13.int arr[]{9,9,9}

    o/p = {1,1,1,0}


..................................................................................................................................................................

Global logic interview questions


What is system call? How to check what are the system calls used?
What is linux kernel module programming?
What is boot loader?
What ioctl?
How to write own module?

Programming questions:
Printing * in triangle shape , input is number lines to print
       *
   * * *
* * * * *

Delete a node in the linked list and the node to be deleted is the one that is passed to the function, no head reference is given

Print nth node from the end in a single linked list

String is recursive or not, s1 = “abcd” , s2 is the user input – s2 can be cdab, dbca
..................................................................................................................................................................
SONY india questions

1.       How to speed up the memcpy, have you seen memcpy code in kernel ?
2.       How to build the vmlinux image
3.       How to debug crash, what is the first line you see when you see a crash/oops message, explain crash console
4.       How Ethernet device is registered
5.       Have you checked linux lib code
6.       How to debug kernel code
7.       What is x86 and what are the registers used
8.       How to write a makefile to build a customized kernel
9.       More questions on debug and crash point related
10.   Struct test { int a; int b; };  Assume you don’t know the contents of structure, and you have the base address of test strucuture alone, how to do access the data inside it ??
11.   How to register, allocate NIC.
12.   How does system call works, in detail.
13.   ARM or x86 archiecture
14.   Step by step of writing a device driver structure, lot of cross questions, not a straight forward question
15.   /proc file system, how to create it
16.   ARM
17.   In-depth of the projects worked so far… 

Few more Questions @

http://linuxinterviewpreperation.blogspot.in/2013/01/linux-kernel-and-device-drivers.html

..................................................................................................................................................................

References:
1. Steps involved in creating a C programme executable
http://www.thegeekstuff.com/2011/10/c-program-to-an-executable/

2.Re-entrant functions and Thread safe is explained well at :
http://www.thegeekstuff.com/2012/07/c-thread-safe-and-reentrant/