单项选择题下面程序有错误的行是______。
main()
{ int a[3]={1};
int i;
scanf("% d", &a);
for(i=1; i<3; i++) a[0]=a[0]+a[i];
printf("a[0]=% d\n", a[0]);
}
main()
{ int a[3]={1};
int i;
scanf("% d", &a);
for(i=1; i<3; i++) a[0]=a[0]+a[i];
printf("a[0]=% d\n", a[0]);
}
A.3
B.6
C.7
D.4
延伸阅读
你可能感兴趣的试题
1.单项选择题C语言中,下列不合法的字符常量是______。
A."\xff"
B."\65"
C."&"
D."\028"
2.单项选择题设有以下语句
int a=1, b=2, c;
c=a^(b<<2);
执行后,c的值为______。
int a=1, b=2, c;
c=a^(b<<2);
执行后,c的值为______。
A.9
B.7
C.8
D.6
3.单项选择题计算机能直接执行的程序是______。
A.源程序
B.目标程序
C.汇编程序
D.可执行程序
4.单项选择题有以下程序:
# include <stdio.h>
main()
{int a,b,k,m,*p1,*p2;
k=1,m=8;
p1=&k,p2=&m;
a=/*p1-m;b=*p1+*p2+6;
printf("%d",a); printf("%d\n",b);
}
编译时编译器提示错误信息,你认为出错的语句是______。
# include <stdio.h>
main()
{int a,b,k,m,*p1,*p2;
k=1,m=8;
p1=&k,p2=&m;
a=/*p1-m;b=*p1+*p2+6;
printf("%d",a); printf("%d\n",b);
}
编译时编译器提示错误信息,你认为出错的语句是______。
A.a=/*p1-m;
B.b=*p1+*p2+6;
C.k=1,m=8;
D.p1=&k,p2=&m;
5.单项选择题数据库系统的三级模式不包括______。
A.概念模式
B.内模式
C.外模式
D.数据模式
6.单项选择题若有以下函数首部
int fun(double x[10], int*n)
则下面针对此函数的函数声明语句中正确的是______。
int fun(double x[10], int*n)
则下面针对此函数的函数声明语句中正确的是______。
A.int fun(double *, int*);
B.int fun(double, int);
C.int fun(double *x, int n);
D.int fun(double x, int*n);
7.单项选择题有以下计算公式
若程序前面已在命令行中包含math.h文件,不能够正确计算上述公式的程序段是______。
若程序前面已在命令行中包含math.h文件,不能够正确计算上述公式的程序段是______。
A.if(x>=0) y=sqrt(x);else y=sqrt(-x);
B.y=sqrt(x);if(x<0) y=sqrt(-x);
C.if(x>=0) y=sqrt(x);if(x<0) y=sqrt(-x);
D.y=sqrt(x>=0 x:-x);
8.单项选择题有以下函数:
int aaa(char*s)
{char*t=s;
while(*t++);
t--;
return(t-s);
}
以下关于aaa函数功能叙述正确的是______。
int aaa(char*s)
{char*t=s;
while(*t++);
t--;
return(t-s);
}
以下关于aaa函数功能叙述正确的是______。
A.将串s复制到串t
B.比较两个串的大小
C.求字符串s的长度
D.求字符串s所占字节数
9.单项选择题有以下程序
#include <stdio.h>
void fun(int a[],int n)
{ int i,t;
for(i=0;i<n/2;i++) {t=a[i];a[i]=a[n-1-i];a[n-1-i]=t;}
main()
{ int k[10]={1,2,3,4,5,6,7,8,9,10},i;
fun(k,5);
for(i=2;i<8;i++) printf("%d",k[i]);
printf("\n");
}
程序的运行结果是______。
#include <stdio.h>
void fun(int a[],int n)
{ int i,t;
for(i=0;i<n/2;i++) {t=a[i];a[i]=a[n-1-i];a[n-1-i]=t;}
main()
{ int k[10]={1,2,3,4,5,6,7,8,9,10},i;
fun(k,5);
for(i=2;i<8;i++) printf("%d",k[i]);
printf("\n");
}
程序的运行结果是______。
A.321678
B.876543
C.1098765
D.345678
10.单项选择题有以下程序
#include<stdio.h>
int f(int x);
main()
{ int a,b=0;
for(a=0;a<3;a+=1)
{b+=f(a);putchar("A"+b);}
}
int f(int x)
( return x*x+1;}
程序运行后输出结果是______。
#include<stdio.h>
int f(int x);
main()
{ int a,b=0;
for(a=0;a<3;a+=1)
{b+=f(a);putchar("A"+b);}
}
int f(int x)
( return x*x+1;}
程序运行后输出结果是______。
A.BDI
B.BCD
C.ABE
D.BCF
热门相关试卷
最新相关试卷