(36)以下二维数组c的定义形式是
a)int c[3][]
b)float c[3,4]
c)double c[3][4]
d)float c(3)(4)
正确答案: c
(37)阅读下列程序,则执行后输出的结果是
#include "stdio.h"
int k=1;
main()
{fun(k);
printf("%d\n",k);}
fun(int k)
{ k++;
k=k*6;}
a)1
b)2
c)6
d)12
正确答案: a
(38)已知#define m 2;的宏定义,执行语句k=m*5;后,k的值是
a)10
b)5
c)2
d)以上答案都不对
正确答案: d
(39)已知:int c[3][4];则对数组元素引用正确的是
a)c[1][4]
b)c[1.5][0]
c)c[1+0][0]
d)以上表达都错误
正确答案: c
(40)现有如下程序段
#include "stdio.h"
void fun(int *a,int *b,int *c)
{*c=*a+*b;}
main()
{int a[2]={12,23},c;
fun(a,a+1,&c);
printf("%d\n",c);}
则程序的输出结果为
a)23
b)12
c)0
d)35
正确答案: d
(41)若有以下语句,则正确的描述是
char a[]="toyou";
char b[]={′t′,′o′,′y′,′o′,′u′};
a)a数组和b数组的长度相同
b)a数组长度小于b数组长度
c)a数组长度大于b数组长度
d)a数组等价于b数组
正确答案: c
(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);
正确答案: d
正确答案: a
(44)阅读下面程序,则执行后的结果为
#include "stdio.h"
main()
{ char *str="abcdefghijklmnopq";
while(*str++!=′e′);
printf("%c\n",*str);}
a)f
b)a
c)e
d)q
正确答案: a
(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
正确答案: c
(46)阅读下列程序,则执行后的输出结果为
#include "stdio.h"
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
正确答案: b
(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
正确答案: b
(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
正确答案: b
(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
正确答案: 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中
正确答案: d
本
文共4页:第
【1】 【2】 【3】 【4】 页