C语言试卷

第681题

有以下程序:

#include <stdio.h>
int fun(int a,int b)
{
    if(b==0)return a;
    else return(fun(--a,--b));
}
main()
{
    printf("%d\n",fun(4,2));
}

程序运行的结果是()。

第682题

若有以下程序

#include <stdio.h>
int f(int a[],int n)
{
    if(n>1)
    {
        int t;
        t=f(a,n-1);
        return t>a[n-1]?t:a[n-1];
    }
    else
        return a[0];
}
main()
{
    int a[]={8,2,9,1,3,6,4,7,5};
    printf("%d\n",f(a,9));
}

则程序的输出结果是()。

第683题

有以下程序:

#include <stdio.h>
int f(int x[],int n)
{
    if(n>1)
    {
        f(&x[1],n-1);
        printf("%d,",x[0]);
    }
    else
        printf("%d,",x[0]);
}
main()
{
    int z[6]={1,2,3,4,5,6};
    f(z,6);
    printf("\n");
}

程序的运行结果是()。

第684题

有以下程序

#include <stdio.h>
void fun(int n,int *s)
{
    int f;
    if(n == 1)*s = n + 1;
    else
    {
        fun(n-1,&f);
        *s = f;
    }
}
main()
{
    int x = 0;
    fun(4,&x);
    printf("%d\n",x);
}

程序运行后的输出结果是()。

第685题

有如下程序:

#include <stdio.h>
int sum(int *array,int len)
{
    if(len == 0)
        return array[0];
    else
        return array[0]+sum(array+1,len-1);
}
main()
{
    int array[5] = {1,2,3,4,5};
    int res = sum(array,4);
    printf("%d\n",res);
}

程序运行后的输出结果是()。

第686题

以下叙述中正确的是( )。 

第687题

以下叙述中正确的是( )。 

第688题

在C语言中,只有在使用时才占用内存单元的变量,其存储类型是 ( )。

第689题

当没有指定C语言中函数形参的存储类别时,函数形参的存储类别 是( )。 

第690题

以下叙述错误的是( )。 

第691题

以下选项中叙述错误的是( )。

第692题

设函数中有整型变量n,为保证其在未赋值的情况下初值为0,应选 择的存储类别是( )。 

第693题

有以下程序:

#include <stdio.h>
int sum(int *array,int len)
{
 if(len == 0)
 return array[0];
 else
 return array[0]+sum(array+1,len-1);
}
main()
{
 int i=1,j=3;
 printf("%d,",i++);
 {
 int i = 0;
 i+=j*2;
 printf("%d,%d,",i,j);
 }
 printf("%d,%d\n",i,j);
}

程序运行后的输出结果是( )。 

第694题

有以下程序

#include <stdio.h>
int f(int n)
{
 int t=0,a=5;
 if(n/2)
 {
 int a=6;
 t+=a++;
 }
 else
 {
 int a=7;
 t+=a++;
 }
 return t+a++;
}
main()
{
 int s=0,i=0;
 for(;i<2;i++)s+=f(i);
 printf("%d\n",s);
}

程序运行后的输出结果是( )。 

第695题

有以下程序:

#include <stdio.h>
void fun(int n)
{
 static int num = 1;
 num=num+n;
 printf("%d", num);
}
main()
{
 fun(3);
 fun(4);
 printf("\n");
}

程序运行后的输出结果是( )。 

第696题

有以下程序:

#include <stdio.h>
int f(int m)
{
 static int n=0;
 n+=m;
 return n;
}
main()
{
 int n=0;
 printf("%d",f(++n));
 printf("%d\n",f(n++)); }

程序运行后的输出结果是( )。 

第697题

有以下程序:

#include <stdio.h>
int fun()
{
 static int x=1;
 x*=2;
 return x;
}
main()
{
 int i,s=1;
 for(i=1;i<=2;i++)s=fun();
 printf("%d\n",s);
}

程序运行后的输出结果是( )。 

第698题

有以下程序:

#include <stdio.h>
int fun()
{
 static int x=1; x*=2;
 return x;
}
main()
{
 int i,s=1;
 for(i=1;i<=3;i++)s*=fun();
 printf("%d\n",s);
}

程序运行后的输出结果是( )。 

第699题

有以下程序:

#include <stdio.h>
int fun()
{
 static int x=1;
 x+=1;
 return x;
}
main(){
 int i,s=1;
 for(i=1;i<=5;i++)s+=fun();
 printf("%d\n",s);
}

程序运行后的结果是( )。

第700题

有以下程序:

#include <stdio.h>
int f(int n);
main()
{
 int a=3,s;
 s=f(a);
 s=s+f(a);
 printf("%d\n",s);
}
int f(int n)
{
 static int a=1;
 n+=a++; return n;
}

程序运行以后的输出结果是( )。