2013年计算机二级考试C语言笔试题及答案7
(31)若有定义语句:int a[3][6]; ,按在内存中的存放顺序,a数组的第10个元素是
A)a[0][4] B)a[1][3] C)a[0][3] D)a[1][4]
(32)有以下程序
#include
void fun(char **p)
{++p; printf("%s ",*p);}
main()
{char *a[]={"Morning","Afternoon","Evening","Night"};
fun(a);
}
程序的运行结果是
A)Afternoon B)fternoon C)Morning D)orning
(33)若有定义语句:int a[2][3],*p[3]; ,则以下语句中正确的是
A)p=a; B)p[0]=a; C) p[0]=&a[1][2]; D)p[1]=&a;
(34)有以下程序
#include
void fun(int *a,int n)/*fun函数的功能是将a所指数组元素从大到小排序*/
{int t,i,j;
for(i=0;i for(j=i+1;j if (a} main() {int c[10]={1,2,3,4,5,6,7,8,9,0},i; fun(c+4,6); for (i=0;i<10;i++) printf("%d,",c); printf("
"); } 程序运行的结果是 A)1,2,3,4,5,6,7,8,9,0, B)0,9,8,7,6,5,1,2,3,4, C) 0,9,8,7,6,5,4,3,2,1, D)1,2,3,4,9,8,7,6,5,0, (35)有以下程序 #include int fun(char s[]) {int n=0; while(*s<=’9’&&*s>=’0’) {n=10*n+*s-’0’;s++;} return(n); } main() {char s[10]={’6’,’1’,’*’,’4’,’*’,’9’,’*’,’0’,’*’}; printf("%d
",fun(s)); } 程序运行的结果是 A)9 B)61490 C)61 D)5 31-35 BACDC