资源描述:
《山石网科笔试题及部分答案》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、1.1 考察sizeof在32位机子上,输出值/* value1 = 4,value2 = 4,value3 = 4 * value4 = 4,value5 = 4,value6 = 4 * value7 = 1,value8 = 1,value9 = 1 * value10 = 25 * value11 = 9 * value12 = 0 * value13 = 8 */#include #include #include int main(){c
2、har networks[25] = {0};char *p1 = "networks";char *p2 = malloc(25);char *p3 = networks;printf("value1 = %d,value2 = %d,value3 = %d",sizeof(p1),sizeof(p2),sizeof(p3));printf("value4 = %d,value5 = %d,value6 = %d",sizeof(&p1),sizeof(&p2),sizeof(&p3));prin
3、tf("value7 = %d,value8 = %d,value9 = %d",sizeof(*p1),sizeof(*p2),sizeof(*p3));printf("value10 = %d",sizeof(networks));printf("value11 = %d",sizeof("networks"));printf("value12 = %d",strlen(networks));printf("value13 = %d",strlen("networks"));}分析:
4、Sizeof(*p1) =1 ,====》*p1是第一个字符sizeof(networks) =25 =====》networks在内存中的大小 25 x 11.2 /* * stones */#include int test_func(char *str){str = "hill";return 0;}int main(){char *str = "stones";test_func(str);printf("%s",str);return 0;}分析:1.3/**0,9,10*/
5、#include enum ERROR{error,WARNING = 8,ERR,NODEV,};int main(){printf("%d,%d,%d",error,ERR,NODEV);return 0;}1.4 #include struct test_node {int aa;int bb;};int main(){int p1[] = {0,1,2,3,4,5,6,7,8,9};struct test_node *p2 = (struct test_nod
6、e *)p1;p2 +=4;printf("%d,%d",p2->aa,p2->bb);//8,9return 0;}分析:1.5/* * j=9 */#include int main(){int j=7;if((++j<=7)
7、
8、(j++>=8)
9、
10、(++j<=9));printf("j=%d",j);return 0;}分析:1.6 将str输出"est",怎么填move_ptr()#include void move_ptr(____________){_
11、__________________}int main(){char *str = "test";move_ptr(_____);printf("%s",str);return 0;}二、问答题2.1 hub、二层交换机和路由器的主要区别?2.2 数组与链表的主要区别及应用场所?2.3 操作系统中进程的概念,进程与程序的区别?三、二叉树顺序输出编程题四、将小写字符串变成大写字符串编程题五、单链表反转编程题