Embedded System Interview Questions:
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 Questin??? How can we dynamically allocate memory without using malloc() or calloc() or realloc()?Explain in Breif. Can any one help in finding this answer to this question…… Tech Interviews comment by Midhun V In Java, we place even the Main() function inside a CLASS. But it is not the case with C++. So, i think this is one of the answers you can say, JAVA is Fully Obejct Oriented. Tech Interviews comment by vsvraju 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 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. Q 13: NONE. None of the Public, Protected and Private data members are visible. 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". 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. 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. Q 30: In Hard RTOS the latency should be less the 20ns (nano sec) in Soft RTOS the latency range 3ns - 20ns is also acceptable. Tech Interviews comment by vsvraju I THINK A BALOON CAN HAVE TO MUCH ELECTRICITY Tech Interviews comment by SANDRA Java is not a pure object oriented language as "everything" in java is not an object. It still has primitive data types such as int, char, etc. which are NOT objects. Ruby is an example of a pure object oriented language, where "everything" is an object, even int. Tech Interviews comment by Karan 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. 18. Operations involving unsigned and signed - The signed data will be converted to unsigned - Refer arithemetic conversion rules in K&R 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" |
评论
发表评论