更多"[单选题]有以下程序
#include <stdio.h>
vo"的相关试题:
[单选题]有以下程序
#include
void fun(int *p)
{printf(“%d\n”,p[5]);}
main()
{int a[10]={1,2,3,4,5,6,7,8,9,10};
fun(&a[3]);
程序运行后的输出结果是()。
A.5
B.6
C.8
D.9
[单选题]有以下程序
#include
void fun(int *s)
{ static int j=0;
do
{ s[j]+=s[j+1];
}while(++j<2);
}
void main()
{ int k,a[10]={1,2,3,4,5};
for(k=1;k<3;k++)
fun(a);
for(k=0;k<5;k++)
printf("%d",a[k]);
}
执行后的输出结果是( )。
A.35756
B.23445
C.35745
D.12345
[单选题]有以下程序
#include
void fun(int *x,int i)
{*x=*(x+i);}
void main()
{ int a[8]={1, 2, 3, 4, 5, 6, 7, 8},i;
fun(a,2);
for(i=0; i<8/2; i++)
{ printf("%d",a[i]);}
printf("\n");
}
执行后的输出结果是( )。
A.3234
B.3231
C.2334
D.2331
[单选题]有以下程序
#include
void fun(char *c)
{ while(*c)
{ if(*c>='a'&&*c<='z') *c=*c-('a'-'A');
c++;
}
}
void main()
{ char s[81];
gets(s); fun(s); puts(s):
}
当执行程序时从键盘上输入Hello Beijing<回车>,则程序的输出结果是( )。
A.hello beijing
B. Hello Beijing
C.HELLO BEIJING
D. hELLO Beijing
[单选题]有以下程序
#include
void fun(char *s)
{ while(*s)
{ if (*s%2==0) printf("%c",*s);
s++;
}
}
void main()
{
char a[]={"good"};
fun(a);
printf("\n");
}
执行后的输出结果是( )。
A.a
B.b
C.c
D.d
[单选题]有以下程序
#include
void fun (char*c,int d)
{*c=*c+1;d=d+1;
printf("%c,%c,",*c,d);
}
void main()
{char b='a',a='A';
fun(&b,a); printf("%c,%c\n",b,a);
}
执行后的输出结果是( )。
A.b,B,b,A
B.b,B,a,A
C.b,b,a,a
D.b,b,A,a
[单选题]有以下程序
#include
void main()
{
int j,a[]={1,3,5,7,9,11,13,15},*p=a+5;
for(j=3;j;j--)
{
switch(j)
{
case 1:
case 2:printf("%d",*p++);
case 3:printf("%d",*(--p));
}
}
}
执行后的输出结果是( )。
A.9911
B.79911
C.99999
D.991113
[单选题]有以下程序
#include
int w=3;
void main()
{ int w=10;
printf("%d\n",fun(5)*w);
}
fun(int k)
{ if(k==0) return(w);
return(fun(k-1)*k);
}
执行后的输出结果是( )。
A.360
B.3600
C.1080
D.2100
[单选题]有以下程序
#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
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
[单选题]有以下程序
#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
[单选题]有以下程序
#include "stdio.h"
void main()
{ int x=1,y=0,a=0,b=0;
switch(x)
{ case 1: switch(y)
{ case 0: a++;break;
case 1: b++;break;
}
case 2: a++;b++;break;
}
printf("a=%d,b=%d\n",a,b);
}
执行后的输出结果是( )。
A.a=2,b=1
B.a=1,b=1
C.a=1,b=0
D.a=2,b=2