顯示廣告
隱藏 ✕
看板 rikaka
作者 rikaka (rikaka)
標題 embedded System Interview Questions:
時間 2012年04月12日 Thu. PM 11:32:48


http://blog.cechina.cn/zhiy66/155072/message.aspx#44518

待CHECK--->

Embedded System Interview Questions:
Q1Can structures be passed to the functions by value?
Q1. No they are always passed by reference. Think. Size of structure can be arbitrarily large.
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
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.Why cannot arrays be passed by values to functions?
Q2. Same as above.
Q2. Individual element can be passed by value of course. But not whole array.

Q3.Advantages and disadvantages of using macro and inline functions? 
q.3.
—- Inline is only a request that may be rejected also based on optimization policies,while macro is immediately replaced before compilation.
—- type checking is not possible in Macros, but in inline its possible.


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


Q4.What happens when recursion functions are declared inline?


Q5.Scope of static variables?
Q5. Lifetime of process.
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





Q6.Difference between object oriented and object based languages?


Q7/Multiple inheritance - objects contain howmany multiply inherited ancestor?


Q8.What are the 4 different types of inheritance relationship?
Q8. public ,private, protected, virtual


Q9.How would you find out the no of instance of a class?
Q9. Declare a static variable, class variable, and increment(decrement) for every constructor (destructor) called.

Q10.Is java a pure object oriented language? Why?


Q11.Order of constructor and destructor call in case of multiple inheritance?
Q11. Constructor. Base to current. Destructor. current to base. Both are done recursuively.


Q12.Can u have inline virtual functions in a class?


Q13.When you inherit a class using private keyword which members of base class are visible to the derived class?
Q13. NONE


Q14.What is the output of printf("\nab\bcd\ref"); -> ef
Q14. $> acd
ef
->ef is wrong, what happened to acd?

Q15.#define cat(x,y) x##y concatenates x to y. But cat(cat(1,2),3) does not expand but gives preprocessor warning. Why?


Q16.Can you have constant volatile variable? Yes, you can have a volatile pointer?
16. It is possible to have “const volatile” declaration. This indicates that the variable defined like this is not possible to change within that context. It can be changed by an external event. const declaraion just says that it will be readonly within the context, that area can be modified by an interrupt routine or another process.


Q17.++*ip increments what? it increments what ip points to


Q 17.
I will explain this with an example:
int a = 10;
int *p = &a;
// suppose &a = 4010 (address of a)
Because both ++ and * are unary operators, the are calculated from right to left –> ++ (*p)
++*p will inrement 4010 by 4 (int size) -> ++*p will have the value 4014.


Q18.Operations involving unsigned and signed — unsigned will be converted to signed
18. Operations involving unsigned and signed - The signed data will be converted to unsigned - Refer arithemetic conversion rules in K&R


Q19. a+++b -> (a++)+b

Q10.malloc(sizeof(0)) will return — valid pointer



Q11.main() {fork();fork();fork();printf("hello world"); } — will print 8 times.
Q11 : Base-class constructors are called in the order in which inheritance is specified in the derived-class definition. The order in which the Base-class constructors are specified in the derived-class member initializer list does not effect the order of construction.
Tech Interviews comment by vsvraju

Q 21:
It will print 8 times. Because, each fork will print twice.
if u flush, (using “fflush”), then it will be printed only once. thats is you need to flush the iostreams.

Q12.Array of pts to functions — void (*fptr[10])()
Q 12:
Yes we can have.
you are never guaranteed that a routine is inlined. It is only a suggestion to the compiler. If
the routine is either too complicated or a virtual function,then a static copy of the routine will be placed in the compiled module. Thus, a routine that was coded as inline may cause a performance degradation because it may consume much more space when it is not physically inlined.
With a virtual function, a copy of that routine will be created for every module that has at least one instantiation of that class.

Q13.Which way of writing infinite loops is more efficient than others? there are 3ways.
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


Q 13:
NONE.
None of the Public, Protected and Private data members are visible.

Q14.# error — what it does?
24. #error is used for displaying an error while compilation. for eg.
#ifdef ABC
printf(”ABC”);
#else
#ifdef DEF
printf(DEF);
#else
#error “Declaration not done”
#endif


Q15.How is function itoa() written?

Q16.Who to know wether systemuses big endian or little endian format and how to convert among them?
Q16. You can have a constant pointer to a volatile variable but not a constant volatile variable.
Q 16:
YES. We can have a const volatile variable.
a volatile variable is a variable which can be changed by the extrenal events (like an interrput timers will increment the voltile varible. If you dont want you volatile varibale to be changed then declare them as “const volatile”.


Q17.What is interrupt latency?

31. Interrupt latency is the time period between interrupt on the pin to the execution of 1st instuction in the interrupt routine. THis will depend upon the processor. If the execution time for the instruction is less (like in RISC) this time will also be less. If register storage is required the time will be less in the processors in which remapping of registers is present as this can be done in a single instruction.

What is interrupt latency?
It is the time interval between an interrupt has occured till the time it has been serviced.
Mathematically:
Int(lat)= rt+pt+dt
where rt="recognition" time
pt=process time
dt=dispatch time
Tech Interviews comment by Ramesh K.B.


Q18.What is forward reference w.r.t. pointers in c?

Q19.How is generic list manipulation function written which accepts elements of any kind?

Q20.What is the difference between hard real-time and soft real-time OS?
30. Hard RTOS is system which will be having major problems if the specified time limit is crossed. For eg. missiles
Soft RTOS is systems which will not be having major problems if the specified limit is crossed. For eg. real time audio steaming.
But for both exceeding the time limit is concidered as error.

32. RTOS systems are embedded systems with time criticality.

Q21.What is interrupt latency? How can you recuce it?

Q 21:
It will print 8 times. Because, each fork will print twice.
if u flush, (using “fflush”), then it will be printed only once. thats is you need to flush the iostreams.



Q22.What is the differnce between embedded systems and the system in which rtos is running?

Q23.How can you define a structure with bit field members?
typedef struct regset{
unsigned char onebit:1;
unsigned char twobit:2;
….
}regset;


Q25.What are the features different in pSOS and vxWorks?

Q26.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?
Q26. Write a union of int and 2 chars. Store as int retrieve as chars.


Q27.What are the different storage classes in C?
Q 27. Time taken between INT req and INT service.
Q36.What are the different storage classes in C?
A:Auto,Register,Static,Extern
Tech Interviews comment by MKS


Q28.What are the different qualifiers in C?

Q29.What are the different BSD and SVR4 communication mechanisms
 Persional Prospectives:



Q33. Study Let us C, Yeshwant Kanetkar
Tech Interviews comment by Taran

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





--
※ 作者: rikaka 時間: 2012-04-12 23:32:48
※ 編輯: rikaka 時間: 2012-04-14 14:25:46
※ 看板: rikaka 文章推薦值: 0 目前人氣: 0 累積人氣: 230 
分享網址: 複製 已複製
guest
x)推文 r)回覆 e)編輯 d)刪除 M)收藏 ^x)轉錄 同主題: =)首篇 [)上篇 ])下篇