2004年9月全国计算机等级考试二级C语言笔试试题及答案
来源:优易学  2010-1-14 10:16:00   【优易学:中国教育考试门户网】   资料下载   IT书店

 

   47.有如下程序
   #include
   main()
   {FILE *fp1;
   fp1=fopen("f1.txt","w");
   fprintf(fp1,"abc");
   fclose(fp1);
   }
   若文本文件f1.txt中原有内容为:good,则运行以上程序后文件f1.txt中的内容为
   A.goodabc
   B.abcd
   C.abc
   D.abcgood
   48~50.以下程序的功能是:建立一个带有头结点的单向链表,并将存储在数组中的
   字符依次转储到链表的各个结点中,请从与下划线处号码对应的一组选若中选择出
   正确的选项。
   #include
   stuct node
   { char data; struct node *next;};
   (48) CreatList(char *s)
   { struct node *h,*p,*q);
   h=(struct node *) malloc(sizeof(struct node));
   p=q=h;
   while(*s!='\0')
   { p=(struct node *) malloc(sizeof(struct node));
   p->data= (49) ;
   q->next=p;
   q= (50) ;
   s++;
   }
   p->next='\0';
   return h;
   }
   main()
   { char str[]="link list";
   struct node *head;
   head=CreatList(str);
   ...
   }
   (48)
   A.char *
   B.struct node
   C.struct node*
   D.char
   (49)
   A.*s
   B.s
   C.*s++
   D.(*s)++
   (50)
   A.p->next
   B.p
   C.s
   D.s->next
  二、填空题:(每空2分 ,共40分)
   1.在64位高档微机中,CPU能同时处理 _____ 个字节的二进制数据。
   2.E-mail地址由域名和用户名两部分组成,它们之间用@分隔,其中在@后面的部分 是 _______
   3.Windows窗口一般由标题栏、菜单栏、控制按钮等部分组成。为了移动窗口,则要 用鼠标拖动 _____
   4.计算机软件分为系统软件和应用软件,UNIX系统属于 ________ 。
   5.在Windows环境下,为了将屏幕内容存入剪贴板,应按 ________ 键。
   6.以下程序段的输出结果是 _____
   int i=9;
   printf("%o\n",i);
   7.以下程序运行后的输出结果是 _______ 。
   main()
   { int a,b,c;
   a=25;
   b=025;
   c=0x25;
   printf("%d %d %d\n',a,b,c);
   }
   8.以下程序运行后的输出结果是 ______ 。
   main()
   { int p[7]={11,13,14,15,16,17,18};
   int i=0,j=0;
   while(i<7 && p%2==1) j+=p[i++];
   printf("%d\n",j);
   }
   9.以下程序运行后的输出结果是 _______ 。
   main()
   { int x=1,y=0,a=0,b=0;
   switch(x)
   {case 1:switch(y)
   { case 0:a++; break;
   case 1:b++; break;
   }
   case 2:a++;b++; break;
   }
   printf("%d %d\n",a,b);
   }

上一页  [1] [2] [3] [4] [5] [6] [7] 下一页

责任编辑:cyth

文章搜索:
 相关文章
热点资讯
资讯快报
热门课程培训