Monday, March 19, 2012

Some more questions on Interview

1. Write the syntax of function pointer. Then write a function how to use declare, define and use the function pointer.
2. Take 2 string and contactinate with out using the library functions
copy one string to another string.
3. Difference between structure and union. gave a structure decalration and union declaration and asked to say the difference. how to assign the values or initialize a structure members and union members. what is the size of the structure of the given structure and the given union.
4. What is static? what happens if a variable is declared with the storage class static and what happens if the function is declared as static and what happens if the a function pointer is declared as static.
5. How to know the size of the 'int' of a particular micro controller whose int size is not known(1bit or 32bit) without using the sizeof operator.
6. if extern declaration is made in a .h file do we need to include this .h in the .c file?
7. If a static variable is declared both globally and locally in a function. then when we are using that varible in the function which variable will be considered whether the local variable or global variable?
8. How a volatile variable is used give one usecase how to use?
9. What is an inline function? what is the differnce between inline and macro? which will be better?
10. AUTOSAR archetecture where our modules lye and what are upper layers to that?
11. Write a macro to in generic way to set and bit and reset a bit.
12. write a function to mask nth bit of the number(set and reset).
13. questions regarding typecasting
14. CAN - how to gain the bus. and how to know which node had gained the bus.
Describe the field of the CAN frame
15. how to add two numbers using bitwise operators
16. Where the global, static, local variables are allocated in the RAM. What heap ares contais?
17. fibonic series program logic

strcpy(p, q)

strcpy(char *src, char *dst)
{
while(*src++ =! '\0')
{
*dst++ = *src++;
}
}

strcpy(p, q)

strcpy(char *src, char *dst)
{
while(*dst++ =! '\0')
{
*src++ = *dst++;
}
}

main()
{
int f1, f2, f3;
f1 = 0;
f2 = 1;
while(i != 8)
{
f3 = f2 + f1;
f1 = f2;
f2 = f3;
}
}

Set(int n)
{
return((data) || (01 << n));
}

Reset(int n)
{
return((data) && ~(01 << n));
}

No comments:

Post a Comment