Funding Statement
Hello All, I hope these questions will help you on understanding Embedded C, CAN, CANAlyzer, CANoe,RTOS, ARM, Operating System, Interrupt…..
Enjoy
Yours Rasmi Ranjan Nayak………… The Ultimate Power of RAY Beyond Your Imagination
1. How C program works?
Ans:
#include<stdio.h>
#define x 1 // http://gcc.gnu.org/onlinedocs/gcc-2.95.3/cpp_1.html
main()
{
int i;
i = 0;
i = i + x;
printf(“The value of i is %d n”, i);
Printf(“Hello”); // Run time error (Linking error)
//Think
}
Before compilation, preprocessor comes into picture, and the value of X gets replaced by 1 before actual compilation starts. Then compiler looks for main() and starts compiling, and checks for the syntax format. Then when we run the program the linking comes into picture, compiler links the functions and all called within the file, are really exists in the library or not? If everything is Okay then program runs successfully… Manythigs I have skipped (Where variable gets stored and all) and I briefed some overall idea. Refer
http://www.howstuffworks.com/c.htm
2.What is the output of printf(“%d”)?
Ans:
main()
{
printf(“%d”);
}
Output will be a Garbage.
3. Calloc vs Malloc
Ans:-
There are two differences. First, is in the number of arguments.
Malloc() takes a single argument (memory required in bytes), while calloc() needs two arguments.
Secondly, malloc() does not initialize the memory allocated, while calloc() initializes the allocated memory to ZERO.
calloc() allocates a memory area, the length will be the product of its parameters. calloc fills the memory with ZERO’s and returns a pointer to first byte. If it fails to locate enough space it returns a NULL pointer.
Syntax:
ptr_var=(cast_type *)calloc(no_of_blocks , size_of_each_block);
i.e. ptr_var=(type *)calloc(n,s);
malloc() allocates a single block of memory of REQUSTED SIZE and returns a pointer to first byte. If it fails to locate requsted amount of memory it returns a null pointer.
Syntax:
ptr_var=(cast_type *)malloc(Size_in_bytes);
4. Struct vs union
Think and Try
I just wanted to addmake/add apoint here, In Union:-
union u{
int x;
char y;
}
u.x = 0;
u.y = 1.;
printf(“The value of u.x will be ? “) //Think before you scroll Down or look down
The o/p of x will be garbage.
5. #define vs #include
Try yourself
6. #define vs typedef; Explain
typedefs can correctly encode pointer types.
where as #DEFINES are just replacements done by the preprocessor.
For example,
typedef char *String_t;
#define String_d char *
String_t s1, s2;
String_d s3, s4;
s1, s2, and s3 are all declared as char *, but s4 is declared as a char,
which is probably not the intention.
http://www.oualline.com/style/c06.html
7. #define vs enum; Which one is better? And Why?
Ans: Click the below link for better understnding
http://www.embedded.com/showArticle.jhtml?articleID=9900402
Coming to the question:- Which one is better and why? It depends on the programmer. If there is only few changes needed then #define is the best solution. But if there are lots of changes need to be done then the solution is enum. e.g,
#define x 1 // if tomorrow you are changing the value of x from 1 to 2 then #define is effective
similarly if there are many
#defines like #define X1 1 #define X2 2 . . . #define Xn n In this case we can use enum, to reduce the complexity. enum {X1, X2….Xn};
Now the question is if X10 value changed from 10 to 50 but the rest of the sequence are unchanged then how to tackle? Think !!!
8.Compilation How to reduce a final size of executable?
Ans:
Size of the final execuatable can be reduced using dynamic linking for libraries.
http://wiki.wxwidgets.org/Reducing_Executable_Size
9. What does static variable and function mean?
void func()
{
static int x = 0;
/*Remember the value of un-initialized static variable is always initializes to zero by compiler at run time.*/
// x is initialized only once across three calls of func()
printf(“%d, “, x); // outputs the value of x
x = x + 1;
fun();
}
O/p:- 0,1,2,3,….. Because the scope of static variable is always to that particular function/file(incase of Global declaration). It gets stored in Data Segment The default value of static variable is always Zero, It (Default value or user-defined value) gets initialized at the run time.And it get initialized only once. In this above example the value of x is initialized to Zero. When next time fun() call happens, the variable x does not get initialized again.
Static Function:- in file 1.c In file 2.c
main()
static void fun();
void fun1();
{ fun();
fun1();
}
void fun{ printf(“It is a static fun”) ;}
void fun1{printf(“It is not a static fun”);}
// Try to compile and see what happens, That (The warning or error) is your answer.
/*undefined reference to `Func’ */
//Ans:: the fun() is local to file 2.c and can’t get accessed by main().
/***** Local Variables are stored in Stack.
Register variables are stored in Register.
Global & static variables are stored in data segment.
The memory created dynamically are stored in Heap And the C program instructions get stored in code segment and the extern variables also stored in data segment. *****/
10. Can a static variable accessed from outside of the file?
Ans: See Qestion number 9.
11. Macro vs inline; Explain each of them; and which one is better why?
12. What are different storage classes? Why register is used?
13. Const vs static vs #define
14. What is the difference between strings and character arrays?
15. Difference between const char* p and char const* p
16. **p vs &*p vs *&p
17.What is hashing?
18. memmove vs memcpy vs memset
19. How free() works?
20. Can a variable be both const and volatile? Explain Volatile
21. Can include files be nested?
22.What is NULL pointer? Why it is required?
23. Is NULL = =0?
24. What is static memory allocation and dynamic memory allocation?
25. How you do dynamic memory allocation?
26. Is realloc() uses the same memory location which was used by malloc()?
27. Describe different types of pointers?
28. How are pointer variables initialized?
29. Difference between arrays and pointers?
30. Is using exit() the same as using return?
31. declaring a variable vs defining a variable
32. lvalue vs rvalue
33. Differentiate between an internal static and external static variable?
34. string vs array?
35. Call by value vs call by reference
36.What are advantages and disadvantages of external storage class?
37.Describe void pointer
38. Typecast when to use and when not to use?
39. Switch vs if; which one is better? Why?
40. Linker vs linkage?
41. Function vs built-in function
42. Why should I prototype a function?
43. Array vs Linked list
44. Write a code for String reverse, strlen, etc
45. Explain C memory
46. Little endian vs big endian? Why it is required? Which one is better? How the conversion happens? White a pseudo code for hton() and ntoh()
47. How can you make sure that 3 rd bit (Say 8-bits given to you) is set or not?
48.How do you set/reset a particular bit?
49. Write the T-table of X-OR
50. What is code optimization?
51. How code optimization does not happen when it comes to VOLATILE? Explain
52. Const to Pointer vs Pointer to Const
53. Difference between Static and Dynamic Library
54. Write a function which takes few arguments and displays the arguments
e.g fun(int arg1, int arg2, int arg3); //May be infinite numbers of arguments
o/p will be value of agr1, arg2, arg3….
Ans:
Use logic of printf()
Refer http://en.wikipedia.org/wiki/Stdarg.h
55.How to write and read data from an address location in C language?Ans: Method -1 Assume it’s 8 bits:
char * address = (char *)3000; // address is a pointer to address 3000 char val;
*address = 36; // write 36 to 8 bit location at address
val = *address; // read 8 bit value from address
Method – 2
char *ptr; //u can take any datatype ptr = 0x0000000a; //”0x0000000a” is hexadecimal adrr. bit
*ptr = ‘a’; //here u put data “i had put a”
same as u can read it by
char d,*ptr; ‘” ” // as it is above ‘” d = *ptr; // u`r value read from ptr is store in d
http://in.answers.yahoo.com/question/index?qid=20091118002501AAYTcjU
56. What is segmentation fault?
57. volatile vs const volatile, Explain
58. How function call happens in C? or How function/function call works internally?
Some more C Questions
1. In order to assign attributes to the pointer itself, rather than to the pointed-to object, you put the attributes after the asterisk.
like ‘ char *const p = &c; ‘ – True/False
2. What is the output of the below code ?
char **p =”Hello”;
printf(“%s”,**p);
return 0;
3. There is a char * pointer that points to some ints, and what should be done to step over it ?
4. What changes has to be done to get the ouput as “9 8 7 6 5” by the same recursive call method ?
int main(void) {
int i=9;
printf(“%d \t”,i–);
if(i)
main();
return 0;
}
5. What is the output in the below program ?
void main() {
int z = 12;
printf(“%d”,printf(“Mr.123\\”));
printf(”%d”,printf(”%d%d%d”,z,z,z));
}
6. You can’t ‘shift’ an array –
True/False?
7. Is it possible to do like this in C ?
char s[8];
s=”ABCD1234″;
8. bit-fields do not provide a way to select bits by index value – True/False?
9. Does ‘char *a’ allocate some memory for the pointer to point to ?
10. A null pointer is does not to point to any object or function – True/False?
An uninitialized pointer might point anywhere – True/False?
11. The address of operator will never yield a null pointer – True/False?
malloc returns a null pointer when it fails – True/False?
12. char y[] is not identical to char *y – True / False .?
Explain the reason for either true/false.
13. What would be output of the below code ?
char x[] = “abcde”;
char *y= “abcde”;
printf(“%c \n”, x[3]);
printf(“%c \n”, y[3]);
14. Is it possible to have char x[5] in one file a declaration extern char * in other file ?
15. What is dangling pointer ?
16. Why does the below code cause segmentation fault ?
int* z = NULL;
*z = 1;
17. What are the two problems in the below code ?
char *s1 = “Hello, “;
char *s2 = “world!”;
char *s3 = strcat(s1, s2);
18. What is the problem with the below code ?
i) char a[] = “Hello”;
char *p = “Hello”;
My program crashes if I try to assign a new value to p[i].
ii) char *a = “abcdef”;
*a = ‘X’;
19. Some compilers have a switch to control if string literals are writable or not – True/False?
20. Three attributes can be assign to a pointer: const / volatile / restrict – True/False
21. What are the problems in below code. How will you fix it ?
char *check(int n)
{
char box[20];
sprintf(box, “%d”, n);
return box;
}
22. What is malloc’s internal bookkeeping information and how does it play a role in mis-directing the location of the actual bug ?
23. Where would you use ‘const int’ instead of #define and where should you use #define instead of ‘const int’ ?
24. Keyword ‘const’ refers to read-only -> True/False?
25. What is the output of the below code
#define MY_CALCULATOR 2+5+6
printf(“%d \n” 3 * MY_CALCULATOR);
26. How does declaring function parameters as ‘const’ help in better,safer code ?
27. Which of the following is correct . Why does point no ‘i’ gives output sometime & sometimes it does not give output ?
i. char *a = malloc(strlen(str));
strcpy(a, str);
ii. char *a = malloc(strlen(str) + 1);
strcpy(a, str);
28. How do the below get expanded ? Which one is the preferred method & Why ?
#define mydef struct s *
typedef struct s * mytype;
mydef d1,d2;
mytype t1,t2;
29. i. const values cannot be used in initializers – True/False?
ii. const values cannot be used for array dimensions – True/False
30. Is char x[3] = “wow”; legal ?
Why does it work sometimes ?
31. How will the below code corrupt stack ?
void checkstackcorruption (char *var)
{
char z[12];
memcpy(z, var, strlen(var));
}
int main (int argc, char **argv)
{
checkstackcorruption (argv[1]);
}
32. Is the below method of usage of realloc() correct ?
void *z = malloc(10);
free(z);
z = realloc(z, 20);
33. What does the below mean ?
int (*)[*];
34. The rank of any unsigned integer type shall equal the rank of the corresponding
signed integer type, if any – True/False?
35. The rank of long long int shall be greater than the rank of long int which shall be greater than int – True/False?
36.No two signed integer types shall have the same rank, even if they have the same
representation – True/False?
37. sprintf function is equivalent to fprintf, except that the output is written into an array – True/False?
38. Incase of both sprintf and fprintf , A null character is written at the end of the characters written and that is not counted as part of the returned value – True/False?
39. Arithmetic underflow on a negative number results in negative zero – True/False?
40.Negative zero and positive zero compare equal under default numerical comparison – True/False?
41. ‘type cast’ should not be used to override a const or volatile declaration – True/False?
42. ‘sizeof’ yields the size of an array in bytes – True / False?
43. How will you determine the number of elements in an array using sizeof operator ?
44. What is l-value & r-value ?
45. What is the output of the below code ?
char (*x)[50];
printf(“%u, %u,%d\n”,x,x+1,sizeof(*x));
46.How will you declare & initialize pointer to a register located at phys addrs 600000h ?
47. What is NPC ?
48. Why does *ps.i do not work in the below code ?
struct rec
{
int i;
float f;
char c;
};
int main()
{
struct rec *ps;
ps=(struct rec *) malloc (sizeof(struct rec));
*ps.i=10;
free ps;
return 0;
}
49. The term ‘Pointer to pointer’ is different from the term ‘double pointer’ – True/False?
50. Will the Free API (after calling Malloc) return the Memory back to the OS or the Application ?
51. How to do array assignment ?
52. What could be the gud way to check ‘Close enough’ equality using Floats ?
53. What is the Problem of Floating Points with ‘==’ operator in C . On what is that dependent upon ?
54. Tell about the size of ’empty structs’ in C ?
55. Why does C language permits an extra comma in initializer list
56. What does the below do ? z = x++ +( y += x++) ;
57. What is nested union ? How is it useful ?
58. How wil you pass unions to functions or pointers to unions ?
59. What is the Behaviour of realloc for NULL argument ?
60. Write a Macro to swap 2 bytes
61. Write a Macro to swap 2 bytes
62. Write small program to Set a Bit, Clear a Bit, Toggle a Bit, Test a Bit (or Demonstrate simple Bit Manipulation in C)
63. Use #define to Set Bit, Clr Bit, Toggle and Test Bit of a volatile status register (Port) – Bit Manipulations to set/clear a bit of a particular Port Register
64. Universal Gates;
Ans: http://www.asic-world.com/digital/gates3.html
Control Area Network:
1. What is CAN?
2. What is Asynchronous Serial Communication?
3. Why CAN is reliable?
4. How many layer it supports?
5. What is the max speed of CAN?
6. St. CAN vs Extd. CAN? Can they coexist on a network?
7. If they can co-exist, which one will have priority; if not, what is the reason?
8. Describe the process of bus arbitration in CAN?
9. What’s the difference between CSMA/CR and CSMA/CD?
10. How can we identify a specific sensor in a CAN network?
11.Data Frame vs Remote Frame; Who wins arbitration?Explain why?
12. What is bus termination resistor value for CAN? Do they vary if we put them in each node instead of bus ends?
13.Explain Error Frame? Explain the error states (Like Passive Active and Bus-off)?
14. What is BUS-Off? What happens when bus-off occurs?
15.What is TEC and REC?
16. How they increment and decrement?
17. What is difference between Inter frame space and overload frame?
18. What is time quanta?
19. Explain
20. How does CAN work? What are the features of CAN?
21. Why SOF is always a dominant bit?
22. Explain error detection mechanism?
23. CANALyzer vs CANoe
24. CAPL vs IG
25. IG block vs G block
26. How many nodes can be simulated in Canalyzer and Canoe?
27. Data frame vs Remote frame? Who wins when both are available in the network?
28. What is Bit-Encoding?
29. What is bit-stuffing?
30. Why bit stuff happens after5th bit; why not after or before 4th or 6th bit?
31. What is DLC? Why is it needed?
32. CAN vs LIN?
33. CAN vs KWP vs UDS?
34. Why 7F has considered for €“ve response why not other than 7F?
35. What is tester present? Why do we need it?
36. What is security Access? Why do we need it?
37. What is CANCaseXL (if you have used it)? Explain with types?
38. If there are only two nodes on the bus, and both are transmitting same identifier(exactly the same identifier),who will win the arbitration or what happens?
39. If there is only one node on the bus and it is transmitting messages on the bus continuously, what will happen? Is node will go into the bus-off state or what happens?
41. Is CAN full duplex? what is the significance of Extended frames other than that it can be used for generating more identifiers?
42. What is the major difference between CAN 2.0B and previous version?
43. Without CAPL,can we simulate the other ECU’s CAN Messages except Test ECU in the CAN Simulation Network in CANoe tool without using IG or G blocks.
44. How many can database files are required for CAN Network simulation in CANoe tool.
45. what is the difference between CANalyzer,CANoe and CANape tools?
46. Mention the few uses of the CANoe tool?
47. what is a panel is CANoe Tool and its Use?
48. Why CAPL scripting is used in CANoe tool?
49.Is it possible to simulate other ECU’s Except Test ECU without CAPL Scripting in CANoe tool?
50. What is flow control frame?
51. Describe ISO15765.
52. How Consecutive Frame, Single Frame, First Frame and Flow Control get recognized?
53. How Acknowledgement happens in CAN? /*Receiver pulls ACK bit down (1 (Rec..) to 0 (Dom..))*/
54. How a node overcomes from Bus-off ?
http://www.8052.com/users/Navin/
Click to access lpc23xx.can.arm.pdf
Automotive Questions:
1. What is EBS (Electronic Braking System)? How it is different from ABS?
2. What is EBD (electronic brake force distribution)? How it helps yourvehicle?
3. What is Traction Control System?
4. Are the speed/velocity of four wheels are always same? V1 = V2 = V3 = V4? 5. What is YAW Rate?
6. What is Freeze Frame Data?
7. What is Stop-start engine system (stop-idle)? Why it is required?
8. Ina traffic if Engine stops then how it turns on?
9. How the engine coolant works?
RTOS:
1. What is a Real-Time System?
2. Does the RTOS give you a flexible set of scheduling policies?
3. Does the RTOS use the dynamic object’s address as its identifier?
4. Are interrupts handled with a macro/function or do you have to write your own prologue (entry) and epilogue (exit)?
5. How does the RTOS synchronize with events? Do your event synchronization objects automatically clear with a task release or can events be missed? Can multiple tasks wait on a single event? Can a single task wait on multiple events?
6. Does the RTOS allow you to count both periodic or aperiodic ticks?
7. Can the RTOS count ticks other than time?
8. Are Timers/Alarms globally available so that they can be used by multiple tasks or are they tied to a single task? Does the RTOS allow you to define future actions to be taken when any counter reaches a predefined value?
9. Does the RTOS manage RAM with a heap that can create non-deterministic response and fragmentation?
10.Does the RTOS provide multiple data passing options?
11. Does the RTOS allow data to be passed between tasks and ISRs (or just between tasks)?
12. How does the RTOS provide exclusive access to resources? Does it use binary semaphores or mutexes?
13. Does the RTOS have a mechanism to prevent priority inversion—when a low priority task has control of a resource that is required by a higher priority task?
14. How the RTOS is coded. Is it designed for deterministic operation? Does it ensure low system overhead? Low latency? Responsive services?
15. Write a code to connect Hardware interrupt to ISR?
16. What is priority inversion ? and What is the solution ?
17. Explain Priority Inheritance
18. Explain various types of Scheduling
19. Which RTOS supports Non-Preemptive scheduling ? Why other scheduling methods are supported by such OSes?
20. RTOS vs OS21. what is a non re-entrant code?
22. Is unix a multitasking or multiprocessing operating system? whats the difference between the two?
23. What is stack overflow and heap overflow?
24. What is a core dump?
25. Windows also has multiple processes has process priotities switches between multiple process, how RTOS is different from that?
26. what is paging, segmentation Why do we need it?
27. write a code to check wther a stack grows upwards or downwards?
28. Why do we require semaphore mutex?
29. write a small piece of code protecting a shared memory variable with a semaphore?
SOME MORE RTOS QUESTIONS:
1. What is priority inversion ?
2. What are the solutions for priority inversion ?
3. What is priority inheritance ?
4. What is priority ceiling ?
5. What is deadlock ?
6. What is the famous diners problem ?
7. What is mutex ?
8. What is spinlock ?
9. Where are spinlocks used ?
10. What do you mean by atomic operations ?
11. what is a semaphore ?
12. What are the types of semaphore ?
13. What is binary semaphore ?
14. What is a counting semaphore ?
15. What is message queue ?
16. What is the role of a scheduler ? How does it function ?
17. What is the difference between a normal OS and RTOS ?
18. What is preemption ?
19. What is preemptive multi-tasking/time-sharing ? What is its difference with co-operative multi-tasking/time-sharing ?
20. Threads are described as lightweight because switching between threads does not involve changing the memory context – True/False ?
21.What are the factors considered for a RTOS selection ?
22. What is the use of the method of temporarily masking / disabling interrupts ? When is it used ? What should be taken care while doing this method ?
23. Since, disabling/masking of interrupts can be done whent the critical section is ONLY SHORT,What method can be used if the critical section is longer than few source lines or if it involves few lengthy loopings ?
24. Difference between semaphores and disabling/masking of interrupts method ?
25. Binary semaphore is equivalent to Mutex – True/False. How ?
26. How can you avoid deadlocks incase of semaphore based designs ?
27. What is Message passing method ? What is its advantages ?
28. Tell about the design of Interrupt Handler and Scheduler in RTOS ?
29. What is interrupt latency ?
30. Even if we never enables interrupts in the code, the processor automatically disables them often during hardware access – True/False ? In this case how to reduce interrupt latency ?
31. When should we re-enable the interrupts in an ISR and why ?
32. How do you measure the latency of your system ?
33. What are First Level Interrupt handlers and Second level Interrupt handlers ?
34. What could be the typical design/implementation of FLIH and SLIH ?
35. Reentrant interrupt handlers might cause a stack overflow from multiple preemptions by the same interrupt vector – True / False ?
36. What kind of memory allocation procedure is good for embedded systems ?
37. Is there any RTOS that has non-preemptive scheduling ?
38. What is reentrant code ?
39. What is preemptive multitasking ?
40. What does timeslice refer to ?
41. If the time slice is too short then the scheduler will consume too much of processing time – True / False
42. What is I/O bound ? What is CPU bound ?
43. What is non-preemptive multitasking ?
44. CFS uses ‘nanosecond’ granularity accounting, the atomic units by which individual process share the CPU instead of previous notion of ‘timeslice’ – True/False .
45. When will you use binary semaphore ?
46. When will you choose busy-wait instead of context switch ?
47. What are the possible scenarios in which context switching of threads can occur ?
48. Can you use mutex/semaphore inside an ISR ?
49. Explain a scenari that could cause deadlock ? What is the best solution for a deadlock ?
50. Will the performance of your application improve if it has only a single thread and it is running on multiple cores of a processor ?
51. What will happen if there are more threads requesting for CPU resource such as time ?
52. What is Gang Scheduling and how is it useful ?
53. Can you sleep in interrupt handler ?
54. What is the main drawback for not considering Linux as realtime / RTOS ?
55. What is the drawback in using semaphore for synchronization ? How does spinlock help in overcoming it ?
56. What does a semaphore consist of ? and What does a spinlock consist of ?
57. Why spinlocks are useless in uniprocessor systems ?
58. What is timeslice ?
59. What is the difference between multiprogramming and multiprocessing ?
60. What is parallel programming ?
61. What are the types of IPC mechanisms ?
62. What are the types of synchronization problems and what are the resources that can cause such problems ?
63. What is data race ?
64. What is Indefinite Postponement / Indefinite blocking or starvation ?
65. What are the synchronization relationships that are present in a multithreaded or mulitprogramming applications ?
66. How Many Processes or Threads Are Enough for an application ?
67. Tell the advantages and disadvantages of Co-operative multitasking.
67. When should we use mutex and when should we use semaphore ?
For RTOS Answers… Click the below link
http://www.quadros.com/resources/white-papers/questions-to-ask-when-choosing-an-rtos
http://www.freewebs.com/chinswe/rtosquestions.htm
Device Driver
1. What is the difference in features between kernel 2.2, 2.4 and 2.6 ?
2. What are Static and Shared libraries ?
3. What is dynamic linking ? What is static linking ?
4. What are the advantages of Dynamic linking or Shared libraries ?
5. Does gcc search for both static and shared libraries ? Which is searched initially by gcc compiler ?
6. What should be done for Shared library based linking in gcc ?
7. What should be done for static library based linking in gcc ?
8. What is object file and what are symbols ?
9. Can you tell the memory layout based on Data,BSS,HEAP and STACK ?
10. What are the ways in which linux kernel can be compiled ?
11. How will get the driver added into the kernel ? What are Kconfig files ?
12. What is a kernel module ?
13. What is the difference between insmod and modprobe ?
14. How will you list the modules ?
15. How do you get the list of currently available drivers ?
16. How will you Access userspace memory from kernel ? What are the various methods ?
17. What is the use of ioctl(inode,file,cmd,arg) ApI ?
18. What is the use of the poll(file, polltable) API ?
19. What is the use of file->private_data in a device driver structure ?
20. What is a device number ?
21. What are the two types of devices drivers from VFS point of view ?
22. What are character devices ?
23. How does the character device driver adds and remove itself from the kernel ?
What is the use of register_chrdev and unregister_chrdev ?
24. What is the role of interrupts in a device driver ? How are interrupts handled in device driver ?
25. How will you make interrupt handlers as fast as possible ?
26. What are the types of softirqs ?
27. Difference between Timer Softirq and Tasklet Softirq ?
28. What are tasklets ? How are they activated ? when and How are they initialized ?
29. What is task_struct and how are task states maintained ?
30. What is rwlock and spinlock ? Briefly explain about both of them ?
31. When will you use rwlock instead of spinlock ?
32. Can spinlock/rwlock be used in Interrupt handler ?
33. Tell about the Memory Layout of a Process in Linux .
34. How will you trace the system calls made into the kernel of lInux ?
35. What is mmap ? MMAP & malloc ? MMAP & brk ? MMAP adv & dis-adv.
36. Tell the relation between Malloc and MMAP
37. Advantages of MMAP over Read ?
38. Tell the role of brk() in malloc / Tell the relation between heap and brk?
39. Example of using MMAP and MUNMAP in C ?
40. Tell about the method/steps in Linux Kernel Compilation.
41. What is Kmalloc and how does it differ from normal malloc ? or Why can’t we use malloc in kernel code ?
42. What happens as soon as a packet arrives from the network in Linux ?
43. What is a stack frame, stack pointer & frame pointer ?
44. What is a profiler ? Which one have you used ?
45. How do you determine the direction of stack growth ?
Operating System
1. What is an interrupt Vector ?
2. How CPUs find the ISR and distinguish between the various devices ?
Is it possible for two devices to share an interrupt request line but have different ISR for those two devices ?
3. What is page fault ?
4. Which hardware unit of processor detects the page fault ?
5. Difference between Monolithic kernel, Micro kernel and Hybrid kernel ?
6. What is Interrupt Descriptor Table (IDT) ?
7. Main Difference between a process and thread ?
8. Threads are lightweight. Why and How ?
9. STACK growth is in downward direction in the case of 80×86 processor – True/False.
10. What is the difference between Multiprogramming and Multiprocessing ?
11. What is parallel programming ?
12. What is a time slice ?
13. What is the difference between multiprogramming and multiprocessing ?
14. What is parallel programming ?
15. What is ABI (Application Binary Interface ) ?
16. What is the layout of a program image in main memory ?
17. What are the types of IPC mechanisms ?
18. Tell about shared memory ? Does it provide locking mechanism ? When is it typically used ?
19. What are the types of synchronization problems and what are the resources that can cause such problems ?
20. What is data race ?
21. What is Indefinite Postponement / Indefinite blocking or starvation ?
22. What is Deadlock ?
23. What are the synchronization relationships that are present in a multithreaded or mulitprogramming applications ?
24. How Many Processes or Threads Are Enough for an application ?
25. How does memory segmentation help in memory protection ?
Microprocessor & ARM interview questions
1. What are the two famous architecture of CPU ?
2. What is the difference between Harvard and Von Neuman architecture ?
3. What is the use of instruction cache ?
4. Is it good to have more instruction cache or data cache ?
5. What is the use of data cache ?
6. What is the use of TLB ?
7. What do you mean by Cache Hit or Cache Miss ? What is cache hit rate ?
8. What is the difference between read miss and write miss ?
9. How does cache hit or cache miss determine the selection of processor ?
10. What is cache line or cache block ?
11. What is write-back or copy-back cache ?
12. What is the need for cache coherence protocol ?
13. What are the 3 kinds of cache misses ? or Which of the below causes the most delay and why ? Instruction read miss, Data read miss, and Data write miss .
14. What is boundary alignment and what is the use of it ?
15. What will happen if the data being fetched exceeds the cache line size ? or
if the data is not being aligned at the beginning of cache block ?
16. How can grouping of data can improve the cache based operations from application-side ?
17. What is cache prefetch ?
18. Brief up on pipelined versus Run-to-Completion processor software architecture ?
19. Why multicore processors are preferred to improve performance rather than trying to make a single processor based system faster ?
20. Does memory access speed varies at various stages ? Which is the fastest memory that you can directly deal with from a processor or Which type of memory of a CPU has almost zero percent latency ?
21. What is temporal locality and spatial locality ?
22. What are the applications of temporal locality and spatial locality ? or where are they applied in a CPU architecture ?
23. What is the use of Shadow Registers in ARM architecture ?
24. How will you calculate the idle time off a processor ?
25. How will you identify the endianness of a processor programatically ?
26. What is Memory Overlay ?
27. Tell about Bank Switching ?
28. What are the Disadvantages of Bank Switching ?
29. Why is the size of L1 cache smaller than that of the L2 cache in most of the processors ?
30. When should one use polling method and when should one use interrupt based method ? Are there scenarios in which both can be used ?
31. What could be the better way to determine the exact locations in which the prefetch instruction should be used ?
32. Considering that a processor runs at 100 MHz and the data is coming to the processor from an external device/peripheral at the rate of 1000 Mbit/s (8 Bits/Clockcycle @ 125 MHz), which is the best way to handle traffic that comes at a higher speed to the processor ?
33. Consider that there are 100 plus ways of interrupts occuring from various sensors. There are chances that all can occur at the same time too. How can the software be designed to handle it efficiently ?
34. What is Write-Back Cache ?
35. What is Write-Through Cache ?
36. What is cache coherency ?
37. What is Clock Cycles Per Instruction (CPI) ?
38. What is IPC(Instructions per cycle) ?
39. Tell about the ‘nested interrupt handler’ , ‘reentrant interrupt handler’ and ‘ prioritized direct interrupt handler’ ?
40. What is Memory Banking ? Explain w.r.t 8051 architecture
41. What is Primary Memory and What is Secondary Memory ?
42. What is the advantage of MMU ?
43. How do you determine the direction of stack growth ?
44. What is the debugger that you have used ?
45. Have you used any emulator. If yes, how have you used it ?
46. Can you tell a scenario that was very difficult to solve / fix ?
47. Have you worked on optimization w.r.t memory usage ? What techniques have you followed to optimize ?
47. Have you worked on optimization w.r.t throughput / speed ? What techniques have you followed to optimize ?
48. What kind of co-processors have you used ?
ARM
1. What are the types of CORTEX-M series ?
2. How do you select a specific CORTEX-M processor ?
3. What is Trustzone System IP block ?
4. What is the use of T604 ? Have you used it ?
5. Have you come across LINARO ? Have you been involved in LINARO ?
6. What is pipeline shutdown ?
7. what are the kinds of protection available for SRAMS ?
How to use the single bit or double bit fault correction ?
8. What is interrupt pipelining ?
9. Explain the architecture of the CORTEX series ARM that you have used .
10. What is the use of the AMBA interface and where is it present in the architecture ?
11. What is branch prediction ?
12. What is out of order execution ? Have you considered it in selection of processor ?
13. If the pipleline is wider , the instruction throughput is high – True/False ?
14. What is the use of Neon Floating point engine ?
15. In what scenarios can neon do better than normal core ?
16. Is power dissipation more in neon compared to normal core ?
17. Incase of multimedia applications, what is the approximate number of times by which the throughput
is increased compared to normal core ?
18. Is Neon available with Cortex M or Cortex A series ?
19. Have you used RVDS ? Have you used gcc arm toolchain ? Which of these two tools is better ?
20. What is the use of –vectorize option ?
21. Have you used Palladium emulator ? Is it JTAG based ?
22. Have you used XDS510 emulator ?
23. What is Coresight System Trace Macrocell(STM) ?
24. What is the difference between ‘intrusive trace’ and ‘non-intrusive trace’ mechanisms ?
25. Which of the following is intrusive – printf, lttng, strace, ftrace, ltrace ?
26. Can you explain the flow from User application and the role of STM driver ?
27. What are the advantages and disadvantages of LTTng ?
28. What is hardware assisted instrumentation ?
29. What is the advantage of hardware assisted instrumentation over software instrumentation ?
30. What is PTM ?
31. What is TPIU ?
32. What is ITM ?
33. What is ETM ?
34. Low latency instrumentation is required for ISR tracing, Bootcode tracing . How is low latency
tracing achieved ?
35. STM cannot trace instructions. It traces only system level calls – True / False.
36. ETM is for data/program instructions & for cache/DMA level instructions – True / False.
37. In Kinetis, can SRAM be configured to act as either NVRAM or EEPROM ? Have you configured or tried it ?
38. How many power modes are there in Kinetis ? Can you tell the wakeup/recovery time for every mode ?
Which mode has the fastest recovery time ? Which mode has the lowest current consumption ?
39. Cortex M4 has Run , Sleep and Deep sleep modes – True / False ?
40. Is 32-pin Cortex M4 compatible with 256 pin Cortex M4 processor ?
41. What is I2S interface ?
42. What are the features of Cortex M4 ?
43. Tell about the Exception Handling in ARM processor. What does the ARM Core do automatically for every exception ?
44. Can you tell about DSP in ARM7TDMI or DSP in STRONGARM or DSP in ARM9E ?
45. Why should you design the DSP algorithm in general ARM architecture so that saturation is not required ?
46. Tell about AIF(Arm Image Format) and AOF(Arm Object Format) ?
47. What are the Memory initialization directives ?
48. What is the use of ‘SWI’ in ARM assembly ?
49. How to Represent a Digital Signal in ARM ?
50. Give Example of STMFD w.r.t Stack Operation push/pop ?
51. Tell about Extended Multiply Instructions in ARM
52. Tell about the NORMAL Multiply Instructions in ARM
53. Tell about ADR’s relation with LDR and the Advantage of using LDR together with ‘=’ ?
54. When does the Processor Stall in ARM and what is the pipeline hazard in ARM?
55. What is called ‘pipeline bubble’ in ARM ?
56. What is Saturating Arithmetic ? Explain
57. Tell the 2 software methods available to remove interlocks following load instructions
58. Tell about ‘Load Scheduling By Preloading’ and ‘Load Scheduling by unrolling’ ?
59. How will you flush the instuction Cache in ARM processor ?
60. List the issues when porting C code to the ARM processor ?
61. What are the advantages of writing in Assembly in ARM processor?
62. Explain this -> “AREA |.text|, CODE, READONLY”
63. What is the use of the ‘EXPORT’ directive ?
64. What is the use of various directives ?
65. How to build using command line tools w.r.t ARM ?
66. Write a simple square.s program in ARM assembly called from a C file ?
67. What will you change that program when calling ARM code from C compiled as Thumb ?
68. How will you allow Thumb C code to call the ARM assembly Code ?
69. What is the use of ‘RN’ directive in ARM assembly ?
70. What imports the libraries like printf automatically in the assembly side of ARM ?
71. What is the DCB directive and its relation with strings ?
72. What is ARMulator ? Where and How have you used it ?
73. How will you handle the Register Shortage problem in ARM ?
74. Relation between CPSR flags, S Suffix Instructions and Comparison Instructions ?
75. What is Conditional Execution in ARM ?
76. What is single issue multiple data (SIMD) processing ?
77. What is a Coprorcessor / CP15 in ARM ?
78. What does the ‘B’ mean in LDRB or What is the difference between LDR and LDRB in ARM ?
79. What is the use of Write-Back ?
80. When should i use ‘!’ in ARM programming and where is it Not Allowed to be used in ARM programming ?
81. Tell about ‘Single Data Transfer’ and ‘Multiple Data Transfer’ in ARM
82. How will you manually Enable / Disable an interrupt in ARM Processor ?
83. Tell about MRS and MSR instructions ?
84. Can you tell a 32-bit branch instruction and the way you used it ?
85. When have you used Thumb instructions in ARM processor ?
86. Write a program to mask bytes in ARM assembly ?
87. ARM7 family of processors does not use any branch prediction scheme. Neither
ARM9 nor ARM9E family implements branch prediction – True / False
88. The ARM11 micro-architecture uses two techniques to predict branches – True / False
89. What is Translation Lookaside Buffer (TLB) ?
90. What are the types of addressing modes in ARM ?
91. Can you brief up the evolution of ARM architecture ?
92. Why ARM7TDMI alone highlights the features that it supports in its naming and why not other ARM architectures ?
93. When will you choose to use ARM and when will you choose to use Thumb instructions ?
94. Can you explain the operation of ARM7 pipeline for simple instructions ?
95. Can you tell about function performed by this instruction – ADD r3, r5, r12 ?
Some more questions are coming up on RTOS, CAN and Embedded C as well. I will write my answer or understanding. You can write your answers andyour comments as well. All comments are mostly welcomed.
Rasmi Ranjan Nayak
Knol is going to be closed please find in same in below link — http://unifieddiagnosticservices.blogspot.com/2011/12/automotive-diagnostics-services.html