| 2007年9月二级C语言笔试题及答案模拟 |
| 作者:本站 来源:本站整理 发布时间:2007-09-30 08:32:41 |
减小字体 增大字体 |
;i++)
if( 【16】 >0)
{ p=a[i];
a[i]=a[i+1];
a[i+1]=p;}}
main()
{ int i;
char *book[]={"itisme","itisyou","howareyou","fine","goodnight","goodbye"};
sort( 【17】 );
for(i=0;i<6;i++)
printf("%s\n",book[i]);}
正确答案: 1.(i<n-j) 2.(strcmp(a[i],a[i+1])) 3.(book,6)
(14)下面的函数是完成1~n的累加,完成函数。
a(int k)
{if(k<=0)printf("error\n");
if(k==1) 【18】 ;
else 【19】 ;}
正确答案: 1.(return 1) 2.(return(a(k-1)+k))
(15)阅读下列程序,则程序实现的功能是 【20】 。
#include "stdio.h"
struct node
{ char data;
struct node *next; } *head;
fun(struct node *q)
{ if(head == NULL)
{q->next=NULL;
head=q;}
else
{ q->next=head;
head=q;}}
main()
{char ch;
struct node *p;
head = NULL;
while((ch=getchar())!=′\n′)
{p=(struct node *)malloc(sizeof(struct node));
p->data=ch;
fun(p); }
p=head;
while(p!=NULL)
{printf("%c",p->data);
p=p->next; }}
正确答案: 1.(从键盘输入一行字符串,调用函数建立反序的链表,然后输出整个链表) 上一页 [1] [2] [3] [4]
|
| [
]
[返回上一页]
[打 印] |
|