A)a数组和b数组的长度相同
B)a数组长度小于b数组长度
C)a数组长度大于b数组长度
D)a数组等价于b数组
(42)已知:char a[15],b[15]={“I love china”};则在程序中能将字符串I love china赋给数组a的正确语句是
A)a=“I love china”;
B)strcpy(b,a);
C)a=b;
D)strcpy(a,b);
(44)阅读下面程序,则执行后的结果为
#include “stdio.h”
main()
{ char *str=“abcdefghijklmnopq”;
while(*str++!=′e′);
printf(“%c\n”,*str);}
A)f
B)a
C)e
D)q
(45)现有如下程序段
#include “stdio.h”
int fun(int k,int *m)
{if(k%3)*m=k*k;
else *m=k/3;}
main()
{ int (*p)(int,int *),m;
p=fun;
(*p)(78,&m);
printf(“%d\n”,m);}
则程序段的输出结果为
A)24
B)25
C)26
D)27
(46)阅读下列程序,则执行后的输出结果为
#include “stdio.h”
www.lexue88.com
fun(int x)
{if(x/2》0)fun(x/2);
printf(“%d”,x%2);}
main()
{ fun(20);
putchar(′\n′);}
A)11100
B)10100
C)10101
D)10110
(47)阅读如下程序段,则执行后程序的输出结果是
#include 《stdio.h》
main()
{structa{int x; int y;}num[2]={{20,5},{6,7}};
printf(“%d\n”,num[0].x/num[0].y*num[1].y);}
A)0
B)28
C)20
D)5
(48)阅读程序段,则执行后的输出结果为
#include “stdio.h”
typedef union{ long x[2];
int y[4];
char z[8];} atx;
typedef struct aa{ long x[2];
int y[4];
char z[8]; } stx;
main()
{printf(“union=%d,struct aa=%d\n”,sizeof(atx),sizeof(stx));}
A)union=8,struct aa=8
B)union=8,struct aa=24
C)union=24,struct aa=8
D)union=24,struct aa=24
(49)阅读下列程序段
#include “stdio.h”
typedef struct aa
{ int a;
struct aa *next; } M;
void set(M *k,int i,int *b)
{ int j,d=0;
for(j=1;j《i;j++)
{ k[j-1].next=&k[j];
k[j-1].a=b[d++]; }
k[j].a=b[d]; }
main()
{ M k[5],*p;
int d[5]={23,34,45,56,67};
set(k,5,d);
p=k+1;
printf(“%d\n”,table); }
则下面的表达式在table处,能使程序执行后,打印输出数据45的是
A)p-》next-》a
B)++p-》a
C)(*p).a++
D)p++-》a
(50)阅读下面程序,程序实现的功能是(a123.txt在当前盘符下已经存在)
#include “stdio.h”
void main()
{FILE *fp;
int a[10],*p=a;
fp=fopen(“a123.txt”,“w”);
while( strlen(gets(p))》0 )
{ fputs(a,fp);
fputs(“\n”,fp);}
fclose(fp);}
A)从键盘输入若干行字符,按行号倒序写入文本文件a123.txt中
B)从键盘输入若干行字符,取前2行写入文本文件a123.txt中
C)从键盘输入若干行字符,第一行写入文本文件a123.txt中
D)从键盘输入若干行字符,依次写入文本文件a123.txt中
,2017计算机二级考试C语言考前密卷八tag: 计算机等级考试,计算机等级考试试题,全国计算机等级考试试题,计算机等级考试