分类: 嵌入式
2009-08-21 21:19:17
Embedded System Interview Questions:
Can structures be passed to the functions by value?
Why cannot arrays be passed by values to functions?
Advantages and disadvantages of using macro and inline functions?
What happens when recursion functions are declared inline?
Scope of static variables?
Difference between object oriented and object based languages?
Multiple inheritance - objects contain howmany multiply inherited ancestor?
What are the 4 different types of inheritance relationship?
How would you find out the no of instance of a class?
Is java a pure object oriented language? Why?
Order of constructor and destructor call in case of multiple inheritance?
Can u have inline virtual functions in a class?
When you inherit a class using private keyword which members of base class are visible to the derived class?
What is the output of printf("\nab\bcd\ref"); -> ef
#define cat(x,y) x##y concatenates x to y. But cat(cat(1,2),3) does not expand but gives preprocessor warning. Why?
Can you have constant volatile variable? Yes, you can have a volatile pointer?
++*ip increments what? it increments what ip points to
Operations involving unsigned and signed — unsigned will be converted to signed
a+++b -> (a++)+b
malloc(sizeof(0)) will return — valid pointer
main() {fork();fork();fork();printf("hello world"); } — will print 8 times.
Array of pts to functions — void (*fptr[10])()
Which way of writing infinite loops is more efficient than others? there are 3ways.
# error — what it does?
How is function itoa() written?
Who to know wether systemuses big endian or little endian format and how to convert among them?
What is interrupt latency?
What is forward reference w.r.t. pointers in c?
How is generic list manipulation function written which accepts elements of any kind?
What is the difference between hard real-time and soft real-time OS?
What is interrupt latency? How can you recuce it?
What is the differnce between embedded systems and the system in which rtos is running?
How can you define a structure with bit field members?
What are the features different in pSOS and vxWorks?
How do you write a function which takes 2 arguments - a byte and a field in the byte and returns the value of the field in that byte?
What are the different storage classes in C?
What are the different qualifiers in C?
What are the different BSD and SVR4 communication mechanisms
Persional Prospectives:
Q1. No they are always passed by reference. Think. Size of structure can be arbitrarily large.
Q2. Same as above.
Q5. Lifetime of process.
Q9. Declare a static variable, class variable, and increment(decrement) for every constructor (destructor) called.
Q11. Constructor. Base to current. Destructor. current to base. Both are done recursuively.
Q13. NONE
Q14. $> acd
ef
->ef is wrong, what happened to acd?
Q16. You can have a constant pointer to a volatile variable but not a constant volatile variable.
Q26. Write a union of int and 2 chars. Store as int retrieve as chars.
Q 27. Time taken between INT req and INT service.
Q33. Study Let us C, Yeshwant Kanetkar
Tech Interviews comment by Taran
Q. 13
Answer posted is wrong.
Public & protected members of base class will be visible to derived class, but not its objects.
Tech Interviews comment by Sumeet
Q1 - YES, a complete structure can be passed. Regarding the size, it is true that they can be very large and hence it is not a good practice to do so. In any case, one can do if one wants to.
Tech Interviews comment by Bhaskar
Q3. When using macro you can’t use data type while passing it. But in Inline function you can have data types so that it can be checked.
e.g MACRO : ADD(a,b)
INLINE : inline void Add(int a,int b );
Tech Interviews comment by VijayaKumar
Q1. Yes structure can be passed by value but the overhead of copying large values will be there. hence not usable. We should pass it by pointer.
Q2. Individual element can be passed by value of course. But not whole array.
Q5. It is alive lifetime of process, and its scope is limited to function in which it is defined.
file1.c
**********
static int i;
void main()
{
……..
}
file2.c
**********
extern int i; //error
If declared global then it is visible in that file only.
Q6. Object oriented language have Inheritance, polymorphism etc. But object based language only deal with object.
Q7. If
class D:public A,B,C
{}
then three ancestors
Q8. public ,private, protected, virtual
Q30. Hard RTS is having deadline defined and it is life critical ,should be reliable. late answer is wrong answer. in Soft RTS,process time should be predictable and reliable.
Tech Interviews comment by Pawan Kumar
Q36.What are the different storage classes in C?
A:Auto,Register,Static,Extern
Tech Interviews comment by MKS
Q5 Scope of static variables is only within the block where it is declared.
But the lifetime is till the process is running
Tech Interviews comment by Satish Parande