笔试题

来源:互联网 发布:ios 数组拼接字符串 编辑:程序博客网 时间:2024/05/06 00:46

a[3][4]哪个不能表示 a[1][1]: *(&a[0][0]+5) *(*(a+1)+1) *(&a[1]+1) *(&a[0][0]+4)
答案: *(&a[1]+1)
a是数组的首地址,a[1]就表示a[1][0]地址了,不用再取地址了。

 

顺序查找的平均时间
答案:(1+2+3+…+n)/n = (n+1)/2


for(i=0,sum=0; i<10; ++i,sum+=i);的运行结果
答案:sum = 55


 

不使用其他变量,交换两个整型a,b的值
答案:x = x+y; y = x-y; x = x-y

 

 

写出float x 与“零值”比较的if语句

答案:if(x>=0.000001 && x<=-0.000001)(x不为0的比较)
float: 6位精度
double: 16位精度

 

 

任意写一个JDK6自带的线程池类名:

ThreadPoolExecutor

原创粉丝点击