面试题目汇总

MOTO

1、智能指针,com实现的原理,
2、printf()可变参数如何实现
3、标准模板库vector追加数据如何实现。是底层如何实现,不能用现有的东东。
4、还有,java的垃圾收集机制如何实现为什么?如果是你自己实现垃圾收集机制,如何实
现? 用什么数据结构。
5、二叉排序树和哈希表那个查找效率高,实用于pda 。
6、.net的底层实现机制。
7、进程间通信如何实现。
8、还有迭代问题,什么问题用迭代,迭代在操作系统中如何实现的 。
9、如何交换两个变量,不能用中间变量。
10、c与c++static函数的区别???
11、const 函数的作用,如何实现钩子函数。
12、两层容错技术怎么实现?
13、写出函数指针,函数返回指针,const指针,指向const的指针,指向const的const指针.
14、函数调用如何实现,注意什么问题。
15、指针和引用的差别,
16、拷贝构造函数如何实现,什么情况下会用到。

*******************************unkonw************************************************************************** 

1.What is achieved by prefixing the 'static' keyword to a file-level function or file-level variable declaration?
 
2.Describe the difference between the “IS A” and “HAS A” object relationships. Which is the stronger relationship and why?
 
3.Java & C# support interfaces directly with the “interface” keyword.
C++ does not have an “interface” keyword. How do you create an interface in C++?
Where/when is the use of interfaces especially helpful?
 
4.If a program requires a large number of execution contexts what can be done to minimise thread scheduling overhead?

5. What does it mean to say that a function is reentrant?
What are some of the ways of achieving re-entrancy? 
*******************ms_aisian_college*****************************************************************************
  题目:
struct S
{
  int i;
  int * p;
};

void main()
{
  struct S s;
  int * p = &s.i;
 
  p[0] = 4;
  p[1] = 3;
 
  s.p = p;
 
  s.p[1] = 1;
  s.p[0] = 2;
}


问程序会在哪一行死掉。

分析:这道题有点难度。如果你对指针掌握的不错的话,仔细分析,相信最终还是可以迎刃而解的。下面就来逐条分析

  struct S s;
  int * p = &s.i;/*取成员s.i的地址*/

  p[0] = 4;;/*设置成员s.i为4。因为指针p指向i地址,p[0]指向i*/
  p[1] = 3;/*设置成员s.p为3。因为p[0]指向s.i,p[1]指向指针s.p*/
  
  s.p = p;/*重新设置指针s.p为s.i的地址*/
  
  s.p[1] = 1;/*置s.p指针为1。因前面s.p指向s.i的地址,固s.p[1]指向s.p*/
  s.p[0] = 2;/*因为s.p指针已经通过前面被设置为1,即非法地址,所以s.p[0]想通        过s.p去访问s.i显然是非法的。*/

  在内存中的对应关系:
 | s.i    | s.   |
  | p[0]   | p[1]   |
  | s.p[0] | s.p[1] |
 
后话:这里出题者故意将s.p[0]和s.p[1]的访问次序对调,就是想通过设置s.p[1]搞死s.p[0]的相关操作。如果先执行s.p[0] = 2,然后执行s.p[1] = 1,那么所有代码都正常通过。
 
答案:程序执行最后一句s.p[0] = 2死掉。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值