- 61
- 0
- 约1.05万字
- 约 21页
- 2015-09-25 发布于重庆
- 举报
c语言高级面试题
整个测试遵循以下的约定:
??????? 假定在所有的程序中必须的头文件都已经被正确包含。
考虑如下的数据类型:
??????? char 为1个字节
??????? int 为4个字节
??????? long int 为4个字节
??????? float 为4个字节
??????? double 为个8字节
??????? long double 为 8个字节
??????? 指针为4个字节
?
?
1. Consider the following program:
#includesetjmp.h
static jmp_buf buf;
?
main()
{
volatile int b;
b =3;
?
if(setjmp(buf)!=0)
{
printf(%d , b);
exit(0);
}
b=5;
longjmp(buf , 1);
}
The output for this program is: (a) 3(b) 5(c) 0(d) None of the above
2. Consider the following program:
main()
{
struct node
{
int a;
int b;
int c;
};
struct node s= { 3, 5,6 };
struct node *pt = s;
printf(%d , *(int*)pt);
}
The output for this program is: (a) 3(b) 5(c) 6(d) 7
3. Consider the following code segment:
int foo ( int x , int n)
{
int val;
val =1;
if (n0)
{
if (n%2 == 1) val = val *x;
val = val * foo(x*x , n/2);
}
return val;
}
What function of x and n is compute by this code segment?
(a) x^n(b) x*n(c) n^x(d) None of the above
4. Consider the following program:
main()
{
int a[5] = ;
int *ptr = (int*)(a+1);
?
printf(%d %d , *(a+1), *(ptr-1) );
?
}
The output for this program is: (a) 2 2(b) 2 1(c) 2 5(d) None of the above
5. Consider the following program:
void foo(int [][3] );
?
main()
{
int a [3][3]= { { 1,2,3} , { 4,5,6},};
foo(a);
printf(%d , a[2][1]);
}
?
void foo( int b[][3])
{
++ b;
b[1][1] =9;
}
The output for this program is: (a) 8(b) 9(c) 7(d) None of the above
6. Consider the following program:
main()
{
int a, b,c, d;
a=3;
b=5;
c=a,b;
d=(a,b);
?
printf(c=%d ,c);
printf(d=%d ,d);
?
}
The output for this program is: (a) c=3 d=3(b) c=5 d=3(c) c=3 d=5(d) c=5 d=5
7. Consider the following program:
main()
{
int a[][3] = { 1,2,3 ,4,5,6};
int (*ptr)[3] =a;
?
printf(%d %d ,(*ptr)[1], (*ptr)[2] );
?
++ptr;
printf(%d %d ,(*ptr)[1], (*ptr)[2] );
}
The output for this program is: (a) 2 3 5 6(b) 2 3
您可能关注的文档
- Climate Change and Sustainable Development, Case of China.ppt
- Climate Change and Hydrologic Models A Review of Existing Gaps and Recent Research Developments.pdf
- Clinical Evaluation Report for delivery set.doc
- CloudSim源代码学习之虚拟机分配策略.doc
- Cluster Transformation Coefficients for Structure and Dynamics Calculations in nParticle S.pdf
- CloudStack安装常见问题解决.docx
- Clustering Markov States into Equivalence Classes using SVD and Heuristic Search Algorithms.pdf
- CMA 论述 真题.doc
- CMMI中英文术语对照表.docx
- Clustering Overhead and Convergence Time Analysis of the Mobilitybased MultiHop Clusterin.pdf
最近下载
- JBL Bar Studio影霸系列说明书.pdf VIP
- 一汽解放J6重卡汽车维修手册.pdf VIP
- 第六次全国幽门螺杆菌诊治共识.pptx VIP
- 基于年龄结构的乙肝流行病模型构建与稳定性的深度剖析.docx
- 数学六年级上册口算脱式计算解方程应用题每日一练(共30天).docx VIP
- 第9课《学会倾听》教案-2025-2026学年第二学期三年级道德与法治统编版下册.docx
- 五年级下册英语教案-Module 1 Unit 1|外研社(三起).docx VIP
- 基于Python的南京二手房数据可视化分析的设计与实现.docx VIP
- 初中英语综合时态练习13352.doc VIP
- 钉钉杯大数据挑战赛银行卡电信诈骗危险预测.pdf VIP
原创力文档

文档评论(0)