2016年电脑二级c语言题库及答案
一、选择题(每题1分,共40小题,共40分)
(1:35),初始状态为front=rear=35。现经过一系列入队与退队运算后,front=15,rear=15,则循环
int f(int x)
{ return x * xl; }
程序运行后的输出结果是( )。
:int x[2][3];,则以下关于二维数组X的表达错误的选项是( )。
[0]可看做是由3个整型元素组成的一维数组
[0]和x[l]是数组名,分别代表不同的地址常量
[o]=0;为数组所有元素赋初值0
,语句P=NULL;是给指针变量赋NULL值,它等价于( )。
="";
="0";
=0;
=";
:
#include
main()
{int a[]={10,20,30,40},*p=a,j;
for(i=0;i<=3;i++){a[i]=*P;p++;}
printf("oAd\n",a[2]);
}
程序运行后的输出结果是( )。
:
#include
#define N 3
void fun(int a[][N],int b[])
{ int i,j;
for(i=0;i
for(j=i;j
}
main()
{int x[N][N]={1,2,3,4,5,6,7,8,9},y[N],i;
fun(x,y);
for(i=0;i
}
程序运行后的输出结果是(,)。
,4,8,
,6,9,
,5,7,
,3,5,
(strcpy为字符串复制函数,strcat为字符串连接函数):
#include
#include
main()
{char a[10]="abc",b[10]="012",c[10]="xyz";
strcpy(a+1,b+2);
puts(strcat(a,c+1));
}
程序运行后的输出结果是( )。
,合法的是( )。
str3[]={’d’,’e’,’b’,’u’,’g’,’\0’};
str4;str4="hello world";
name[10];name="china";
strl[5]="pass",str2[6];str2=strl;
:
#include
main()
{ char*s="[2]34";int k=0,a=0;
whil(s[k+1]!=’\o’)
{ k++;
if(k%2=o){a=a+(s[k]-’0’+1);continue; }
a=a+(s[k]-’0’);
printf("k=%d a=%d\n",k,a);
}
程序运行后的输出结果是( )。
=6 a=11
=3 a=14
=4 a=12
=5 a=15
:
#include
main()
{char a[5][10]={"one","tw0","three","four","five"};
int i,j;
char t: 、
for(i=0;i<4;i++)
for(j=i+1;j<5;j++)
if(a[i][O]>a[j][0])
{t=a[i][O];a[i][O]=a[j][O];a[j][O]=t;)
puts(a[1]);
}
程序运行后的输出结果是( )。
:
#include
int a=1,b=2:
void funl(int a,int b)
{printf( "%d%d",a,b); }
void fun2()
{ a=3;b=4; }
main()
{ funl(5,6);fun2();
printf("%d%d\n",a,b);
}
程序运行后的输出结果是( )。
2 5 6
6 3 4
6 1 2
2016年计算机二级c语言题库及答案 来自淘豆网www.taodocs.com转载请标明出处.