足球比分直播

c语言高级面试题.doc

返回
c语言高级面试题.doc_第1页
第1页 / 共21页
c语言高级面试题.doc_第2页
第2页 / 共21页
c语言高级面试题.doc_第3页
第3页 / 共21页
c语言高级面试题.doc_第4页
第4页 / 共21页
c语言高级面试题.doc_第5页
第5页 / 共21页
点击查看更多>>
资源描述:
整个测试遵循以下的约定? 假定在所有的程序中必须的头文件都已经被正确包含。考虑如下的数据类型? char 为 1 个字节? int 为 4 个字节? long int 为 4 个字节? float 为 4 个字节? double 为个 8 字节? long double 为 8 个字节? 指针为 4 个字节1. Consider the following programincludestatic jmp_buf buf;main{volatile int b;b 3;ifsetjmpbuf0 {printf“d “, b; exit0;}b5;longjmpbuf , 1;}The output for this program is a 3b 5c 0d None of the above2. Consider the following programmain{struct node {int a;int b;int c; };struct node s { 3, 5,6 };struct node *pt printf“d“ , *int*pt;}The output for this program is a 3b 5c 6d 73. Consider the following code segmentint foo int x , int n{int val;val 1;if n0 {if n2 1 val val *x;val val * foox*x , n/2;}return val;}What function of x and n is compute by this code segment a xnb x*nc nxd None of the above4. Consider the following programmain{int a[5] ;int *ptr int*printf“d d“ , *a1, *ptr-1 ;}The output for this program is a 2 2b 2 1c 2 5d None of the above 5. Consider the following programvoid fooint [][3] ; main{int a [3][3] { { 1,2,3} , { 4,5,6},};fooa;printf“d“ , a[2][1];}void foo int b[][3]{ b;b[1][1] 9;}The output for this program is a 8b 9c 7d None of the above6. Consider the following programmain{int a, b,c, d;a3;b5;ca,b;da,b;printf“cd“ ,c;printf“dd“ ,d;}The output for this program is a c3 d3b c5 d3c c3 d5d c5 d57. Consider the following programmain{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 6b 2 3 4 5c 4 5 0 0d None of the above8. Consider following functionint *f1void{int x 10;return}int *f2void{int*ptr;*ptr 10;return ptr;}int *f3void{int *ptr;ptrint* mallocsizeofint;return ptr;}Which of the above three functions are likely to cause problem with pointers a Only f3b Only f1 and f3c Only f1 and f2d f1 , f2 ,f39. Consider the following programmain{int i3;int j;j sizeofi i;printf“id jd“, i ,j;}The output for this program isa i4 j2b i3 j2c i3 j4d i3 j610. Consider the following programvoid f1int *, int; void f2int *, int; void*p[2] int *, int;main{int a;int b;p[0] f1;p[1] f2;a3;b5;p[0]printf“dt dt“ , a ,b;p[1]printf“dt dt“ , a ,b;}void f1 int* p , int q{int tmp;tmp *p;*p q;q tmp;}void f2 int* p , int q{int tmp;tmp *p;*p q;q tmp;} The output for this program is a 5 5 5 5b 3 5 3 5c 5 3 5 3d 3 3 3 311. Consider the following programvoid eint ; main{int a;a3;ea;}void eint n{ifn0{e--n;printf“d“ , n;e--n;}}The output for this program is a 0 1 2 0
展开阅读全文
收藏
下载资源

加入会员免费下载





足球比分直播