| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 814 人关注过本帖
标题:论坛的朋友们 给看看这个代码的意思
只看楼主 加入收藏
sunwear
Rank: 1
等 级:新手上路
帖 子:34
专家分:0
注 册:2004-8-15
收藏
 问题点数:0 回复次数:7 
论坛的朋友们 给看看这个代码的意思

这个该怎么做??

大概都是什么意思啊?

Advanced Test in C: The 0x10 Best Questions for C Programmers Using this Test In the entire test following convention are used • In all program, assume that the required header file/files has /have been included Consider the data type • char is 1 byte • int is 2 byte • long int 4 byte • float is 4 byet • double is 8 byte • long double is 10 byte • pointer is 2 byte 1. Consider the following program: #include<setjmp.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 (n>0) { 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) xn (b) x*n (c) nx (d) None of the above 4. Consider the following program: main() { int a[5] = {1,2,3,4,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},{7,8,9}}; 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 4 5 (c) 4 5 0 0 (d) None of the above 8. Consider following function int *f1(void) { int x =10; return(&x); } int *f2(void) { int*ptr; *ptr =10; return ptr; } int *f3(void) { int *ptr; ptr=(int*) malloc(sizeof(int)); return ptr; } Which of the above three functions are likely to cause problem with pointers (a) Only f3 (b) Only f1 and f3 (c) Only f1 and f2 (d) f1 , f2 ,f3 9. Consider the following program: main() { int i=3; int j; j = sizeof(++i+ ++i); printf("i=%d j=%d", i ,j); } The output for this program is: (a) i=4 j=2 (b) i=3 j=2 (c) i=3 j=4 (d) i=3 j=6 10. Consider the following program: void f1(int *, int); void f2(int *, int); void(*p[2]) ( int *, int); main() { int a; int b; p[0] = f1; p[1] = f2; a=3; b=5; p[0](&a , b); printf("%d\t %d\t" , a ,b); p[1](&a , b); printf("%d\t %d\t" , 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 5 (b) 3 5 3 5 (c) 5 3 5 3 (d) 3 3 3 3 11. Consider the following program: void e(int ); main() { int a; a=3; e(a); } void e(int n) { if(n>0) { e(--n); printf("%d" , n); e(--n); } } The output for this program is: (a) 0 1 2 0 (b) 0 1 2 1 (c) 1 2 0 1 (d) 0 2 1 1 12. Consider following declaration typedef int (*test) ( float * , float*) test tmp; type of tmp is (a) Pointer to function of having two arguments that is pointer to float (b) int (c) Pointer to function having two argument that is pointer to float and return int (d) None of the above 13. Consider the following program: main() { char *p; char buf[10] ={ 1,2,3,4,5,6,9,8}; p = (buf+1)[5]; printf("%d" , p); } The output for this program is: (a) 5 (b) 6 (c) 9 (d) None of the above 14. Consider the following program: Void f(char**); main() { char * argv[] = { "ab" ,"cd" , "ef" ,"gh", "ij" ,"kl" }; f( argv ); } void f( char **p ) { char* t; t= (p+= sizeof(int))[-1]; printf( "%s" , t); } The output for this program is: (a) ab (b) cd (c) ef (d) gh 15. Consider the following program: #include<stdarg.h> int ripple ( int , ...); main() { int num; num = ripple ( 3, 5,7); printf( " %d" , num); } int ripple (int n, ...) { int i , j; int k; va_list p; k= 0; j = 1; va_start( p , n); for (; j<n; ++j) { i = va_arg( p , int); for (; i; i &=i-1 ) ++k; } return k; } The output for this program is: (a) 7 (b) 6 (c) 5 (d) 3 16. Consider the following program: int counter (int i) { static int count =0; count = count +i; return (count ); } main() { int i , j; for (i=0; i <=5; i++) j = counter(i); } The value of j at the end of the execution of the this program is: (a) 10 (b) 15 (c) 6 (d) 7

[此贴子已经被作者于2004-08-30 20:37:59编辑过]

搜索更多相关主题的帖子: 代码 朋友 
2004-08-30 20:08
忆楠
Rank: 1
等 级:新手上路
帖 子:721
专家分:0
注 册:2004-7-5
收藏
得分:0 
论坛的朋友们 给看看这个代码的意思
建议版主把此贴转到c语言练习题里```

点 鼠 标 , 救 饥 民 http://www./
2004-08-30 20:38
sunwear
Rank: 1
等 级:新手上路
帖 子:34
专家分:0
注 册:2004-8-15
收藏
得分:0 

郁闷!

2004-08-31 09:26
xingguang
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2004-6-3
收藏
得分:0 

不是就几个题吗,有什么说的·!

2004-08-31 15:55
sunwear
Rank: 1
等 级:新手上路
帖 子:34
专家分:0
注 册:2004-8-15
收藏
得分:0 
讲具体意思
2004-08-31 21:15
sunwear
Rank: 1
等 级:新手上路
帖 子:34
专家分:0
注 册:2004-8-15
收藏
得分:0 
没一个人知道吗
2004-09-01 13:48
空前
Rank: 1
等 级:新手上路
帖 子:1146
专家分:0
注 册:2004-5-11
收藏
得分:0 
I不懂英语,不过确实看不明白

2004-09-01 16:11
andyleelzl
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2004-9-4
收藏
得分:0 

第三题的答案是d:none of all,第四题:c.第六题:c

2004-09-04 20:26
快速回复:论坛的朋友们 给看看这个代码的意思
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.032795 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved