更多"[单选题]#include 'stdio.h'
int digits"的相关试题:
[单选题]有以下程序
#include
fun(int n, int *s)
{ int f1, f2;
if(n==1||n==2)
*s=1;
else
{ fun(n-1, &f1);
fun(n-2, &f2);
*s=f1+f2;
}
}
void main()
{ int x;
fun(6, &x);
printf("%d\n", x);
}
执行后的输出结果是( )。
A.9
B.8
C.7
D.6
[单选题]有以下程序
int fun(int x[],int n)
{static int sum=0,i;
for(i=0;iA.45
B.50
C.60
D.55
[单选题]有以下程序
int fun(int n)
{if(n==1)return 1;
else
return(n+fun(n-1));
}
main()
{int x;
scanf("%d",&x); x=fun(x);printf("%d\n",x);
}
执行程序时,给变量X输入10,程序的输出结果是()。
A.55
B.54
C.65
D.45
[单选题]以下程序调用findmax函数返回数组中的最大值
findmax(int *a,int n)
{ int *p,*s;
for(p=a,s=a; p-a
if (______) s=p;
return(*s);
}
main()
{ int x[5]={12,21,13,6,18};
printf("%d\n",findmax(x,5));
}
在下划线处应填入的是()。
A.p>s
B.*p>*s
C.a[p]>a[s]
D.p-a>p-s
[单选题]有以下函数
int fun(char *x,char *y)
{ int n=0;
while((*x==*y)&&*x!=’\0’) {x++;y++;n++;}
return n;
}
函数的功能是()。
A.查找x和y所指字符串中是否有’\0’
B.统计x和y所指字符串中最前面连续相同的字符个数
C.将y所指字符串赋给x所指存储空间
D.统计x和y所指字符串中相同的字符个数
[单选题]以下程序的输出结果是()。
long fun( int n)
{ long s;
if(n==1||n==2)s=2;
else s=n-fun(n-1);
return s;}
main()
{ printf("%ld\n", fun(3)); }
A.1
B.2
C.3
D.4
[单选题]设有以下说明语句
typedef struct
{ int n;
char ch[8];
} PER;
则下面叙述中正确的是( )。
A.PER 是结构体变量名
B.PER是结构体类型名
C.typedef struct 是结构体类型
D.struct 是结构体类型名
[单选题]有以下程序
#include
void ive(x,n)
int x[],n;
{ int t,*p;
p=x+n-1;
while(x
A.1 2 3 4 5 6 7 8 9 0
B.0 9 8 7 6 5 4 3 2 1
C.1 3 5 7 9 2 4 6 8 0
D.0 8 6 4 2 9 7 5 3 1
[单选题]有以下程序
#include "stdio.h"
int abc(int u,intv);
main ()
{ int a=24,b=16,c;
c=abc(a,b);
printf('%d\n",c);
}
int abc(int u,int v)
{ int w;
while(v)
{ w=u%v; u=v; v=w }
return u;
}
输出结果是()。
A.6
B.7
C.8
D.9
[单选题]有以下程序
#include
int fun (int x,int y)
{ if (x!=y) return ((x+y)/2);
else return (x);
}
main()
{ int a=4,b=5,c=6;
printf("%d\n",fun(2*a,fun(b,c)));
}
程序运行后的输出结果是 ()。
A.3
B.6
C.8
D.12
[单选题]设有以下程序段,则值为6的表达式是( )。
struct st { int n; struct st *next;};
static struct st a[3]={5,&a[1],7,&a[2],9,0 },*p;
p=&a[0];
A.p++->n
B. ++p->n
C. p->n++
D.(*p).n++
[单选题]有以下程序
fun(char p[][10])
{int n=0,i;
for(i=0;i<7;i++)
if(p[i][0]=='T')n++;
return n;
}
main()
{char str[][10]={"Mon","Tue","Wed","Thu","Fri","Sat","Sun"};
printf("%d\n",fun(str));
}
程序执行后的输出结果是()。
A.1
B.2
C.3
D.0
[单选题]阅读下列程序:
main( )
{ int n[3],i,j,k;
for(i=0;i〈3;i++〉 n[i]=0;
k=2;
for (i=0;i〈k;i++〉
for (j=0;j〈k;j++〉 n[j]=n[i]+1;
printf("%d\n",n[1]); }
程序运行后输出结果是()。
A.2
B.1
C.0
D.3
[单选题]有以下程序
#include
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++));
}
程序运行后的输出结果是()。
A.1,2
B.1,1
C.2,3
D.3,3
[单选题]#include
int streql(char *str1,char *str2)
{ while((*str1==*str2)&&(*str1))
{
str1++;
str2++;
}
return((*str1==NULL)&&(*str2==NULL));
}
void main()
{
printf("%d",streql("abc","Abc"));
}
程序的运行结果是 ( ) 。
A.0
B.1
C.2
D.3
[单选题]有以下程序
#include “stdio.h”
fun(int x, int y){ return (x+y); }
void main()
{ int a=1, b=2, c=3, sum;
sum=fun((a++,b++,a+b),c++);
printf("%d\n",sum);
}
执行后的输出结果是( )。
A.6
B.7
C.8
D.9
[单选题]有以下程序
#include "stdio.h"
void main()
{ int x=0x02ff,y=0x0ff00;
printf("%d\n",(x&y)>>4|0x005f);
}
执行后的输出结果是( )。
A.127
B.255
C.128
D.1