Embedded systems interview questions

6. Difference between object oriented and object based languages?
     Object oriented means everything is an object, they could have all the features of object such as inheritance, implementation of interface. But object based lang means it only uses object idea, it may not let you to create your own object.


7. Multiple inheritance - objects contain howmany multiply inherited ancestor?
    Java allows only one inheritance, but lang such as C++ allows multiple inheritance which means one class could inherit the behavior on many parent classes.


10.Is java a pure object oriented language? Why?    
  Java is not pure OOL, it still maintains some primitives such as int, char


11. Order of constructor and destructor call in case of multiple inheritance    
The order of constructor is from base to current which means the constructor of the parent class will be called first, which is the opposite for destructor.


12. Can u have inline virtual functions in a class?    
No it cant be used, inline func will be turned to normal function. Since inline func is converted before compiling, it will not know where is the virtual function. 
In c++ virtual function means if a function is defined as virtual in parent class, child class can override them and use their own implementation for the function instead of that of parent.


13. When you inherit a class using private keyword which members of base class are visible to the derived class? 
Define a base class with private variable, the derived class could access its public and protected variables, but it cant access its private variable;
For the instance of derived class, it could not access any variable of in base class. It could only access public and protected var in derived class.


14. What is the output of printf("\nab\bcd\ref"); -> ef    
\n means new line
\b means backspace
\r means delete to the beginning of the line, so it will delete 'acd'


15. a+++b -> (a++)+b    
http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B#Operator_precedence
The result is the same as a+b; a+=1;
Though a++ is evaluated first, a is not incremented







评论

此博客中的热门博文

Embedded System interview Question

MicroKernel & Exokernel 操作系统未来可能的发展

中国城市房地产分析