Compiler Related Questions

C++

Q: Dynamic Linking vs Static Linking (Yahoo! PhoneScreen)
A:
1.    Dynamic linking: resolve references to lib routines, linker adds start-up code to load required libs at run-time, each lib call goes through a jump table. A jump table is patched to point at the lib routine, only overhead here is indirect reference.
2.    Static Linking:  linted into program during linking phase of compilation
3.    Dynamic Linking: verifies symbols linkage, dynamic loader checks which shared libs were linked with the program, loads to memory and attach to the program memory.

Example:
ar –s  is (ranlib)
ar –rc *.a *.o

g++ -shared –o lib*.so *.o
g++ -fPIC –c *(.c
ld –lc –o lib*.so *.o

Q:  What is Relocation?  (Yahoo! Phone Screen)
A:  allowing executable and shared obj fiels to hold right info for a process’ program image. It is the process of connecting symbolic ref with symbolic defs. ELF header, program header and section header.

Q:  C++ vfpointer and vftable?
A:  virtual function table and virtual function table. Whenever there is virtual function in class definitions, these 2 things are needed for dynamic-binding(polymorphism)

同类其他面试题 点击新一篇或旧一篇可浏览全部同类面试题


旧一篇:常见C++笔试题目整理(含答案)3

你有答案? 你对以上面试题有意见? 你想发表你的见解? 写下来吧!你的分享将会让很多人受益!

相关面试题

·Compiler Related Questions
·常见C++笔试题目整理(含答案)3
·常见C++笔试题目整理(含答案)2
·常见C++笔试题目整理(含答案)1
·网上流传的c++笔试题汇总

版权声明:本站大部分内容为原创! 另有少部分内容整理于网络,如需转载本站内容或关切版权事宜请联系站长。未经允许,严禁复制转载本站内容,否则将追究法律责任。