0 9
0 0
9 0
9 9
第1题:
以下程序的输出结果是______。
include <stdio.h>
void swap(int *a, int *b)
{ int *t;
}
{ int i=3,j=5,*p=&i,*q=&j;
swap(p,q); printf("%d %d\n",*p,*q);
第2题:
有如下程序: #include <iostream> void fun(int& x, int y){int t=x;x=y;y=t;} int main () { int a[2]={23,42}; fun(a[1],a[0]); std::cout<<a[0]<<","<<a[1]<<std::endl; return 0; } 执行后的输出结果是
A.42,42
B.23,23
C.23,42
D.42,23
第3题:
有如下程序: #include <iostream> void fun (int& x,int y){int t=x;x=y;y=t;} int main() { int a[2]={23,42}; fun (a[1],a[0]; std::cout<<a[0]<<”,”<<a[1]<<std:: ond1; retum0; }执行后的输出结果是______ 。
A.41,41
B.23,23
C.13,42
D.42,23
第4题:
以下程序的输出结果是【 】。
include <stdio.h>
int fun(int x)
{ static int t=0;
return(t+=x);
}
main()
int s,i;
for(i=1 ;i<=5;i++) s=fun(i);
printf("%d\n",s);
第5题:
下列程序的运行结果是( )。
#include<stdio.h>
voidfun(int*s,int*p)
{ static int t=3;
*p=s[t];
t--;
}
void main()
{ int a[]={2,3,4,5},k;
int x;
for(k=0;k<4;k++)
{ fun(a,&x);
printf("%d,",x);
}
}
A.5,4,3,2
B.2,3,4,5,
C.2,2,2,2,
D.5,5,5,5,
第6题:
有如下程序: #include<iostream> void fun(int&x,int y){int t=x;x=y;y=t;} int main() { int a[2]={23,42}; fun(a[1],a[0]; std::cout<<a[0]<<","<<a[1]<<std::ndl; return 0; } 执行后的输出结果是
A.42,42
B.23,23
C.23,42
D.42,23
第7题:
下列程序的运行结果是( )。#include<stdio.h>void fun(int*s,int*p){ static int t=3; *p=s[t]; t--;}void main(){ int a[]={2,3,4,5),k; int x; for(k=0;k<4;k++) { fun(a,&x); printf("%d,",x); }}
A.5,4,3,2
B.2,3,4,5,
C.2,2,2,2,
D.5,5,5,5,
第8题:
下列程序的输出结果是【 】。
include <stdio.h>
void swap(int *a, int *B)
{
int *t;
t=a;a=b;b=t;
}
main()
{
int i=3,j=5,*p=&i,*q=&j;
swap(p,q);printf("%d %d\n",*p,*q);
}
第9题:
有以下程序 #include <stdio.h> void fun(int n, int *p) { int f1,t2; if(n==1 ||n==2) *p=1; else { fun(n-1,&f1); fun(n-2,&f2); *p=f1+f2; } } main() { int s; fun(3,&s); printf("%d\n", s ); }
A.2
B.3
C.4
D.5
第10题:
下列程序的运行结果是( )。 #include<stdio.h> void fun (int*s,int*p) { static int t=3; *p=s [t]; t--; } void main() int a[]={2, 3, 4, 5},k; int x; for(k=0; k<4; k++) { fun (a, &x); printf("%d,", x); }
A.5,4,3,2
B.2,3,4,5,
C.2,2,2,2,
D.5,5,5,5,