32
12
21
22
第1题:
下面程序的输出结果是【 】。
include <iostream>
using namespace std;
int d=1;
fun(int p){
static int d = 5;
d+ =p;
cout<<d;
return (d) ;
}
void main ( ) {
int a =3;
cout<<fun ( a + fun (d) )<<endl;
}
第2题:
以下程序的输出结果是______。
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);
第3题:
有以下程序 #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
第4题:
有以下程序 #include<stdio.h> void f(int *p,int *q); main() { int m=1,n=2,*r=&m; f(r, &n); printf("%d,%d",m,n); } void f(int*p,int*q) {p=p+1; *q=*q+1;) 程序运行后的输出结果是______。
A.1,3
B.2,3
C.1,4
D.1,2
第5题:
有以下程序 #include <stdio.h> #include <stdlib.h> int fun(int n) {int *p; p=(int*)malloc(sizeof(int)); *p=n; return *p; } { int a; a=fun(10); printf("%d\n",a+fun(10)); } 程序的运行结果是______。
A.0
B.10
C.20
D.出错
第6题:
下列程序的输出结果是( )。 #include<stdio.h> int fun(int x) { int p; if(x==0‖x==1) return 3; else p=x-fun(x-2); return p; } void main() { printf("\n%d",fun(5)); }
A.5
B.3
C.7
D.1
第7题:
请填写空格:
include<iostream>
using namespace std;
void fun(int x,int y,int * z)
{ *2 = x + y;}
void main()
{
int a=100,b=100,c,*p=&c;
fun(a,b,p);
【 】; //输出调用fun函数后返回a、b的和。
}
第8题:
有以下程序: #include<stdio.h> iht fun(iht n,int*p) { int f1,f2; 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
第9题:
以下程序中,能够通过调用函数fun,使main函数中的指针变量p指向一个合法的整型单元的是
A.main() { int *p; fun(p); … } int fun(int *p) { ints; p=&s;}
B.main() { int *p; fun(&p); … } int fun(int **p) { int s; *p=&s;)
C.#include main() { int *p; fun(&p); … } int fun(int **p) *p=(int*)malloc(2);}
D.#include main() { iht *p; fun(p); … } iht fun(iht *p) { p=(int*)malloc(sizeof(int)); }
第10题:
下列程序的输出结果是( )。
#include<stdio.h>
int fun(int x)
{ int p;
if(x==0‖x=1)
return 3;
else
p=x-fun(x-2) ;
return p;
}
void main()
{ printf("\n%d",fun(5) );
}
A.5
B.3
C.7
D.1
第11题:
5
2
6
3
第12题:
1
10
11
2
第13题:
以下程序的输出结果是( )。
include<stdio.h>
void fun(int x)
{ if(x/2>0)fun(x/2);
printf("%d",x);
}
main()
{fun(3);printf("\n");
}
第14题:
下列程序的运行结果是( )。#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,
第15题:
有以下程序 #include<stdio.h> void fun(int*a,int*B) { int*c; c=a;a=b;b=c; } main() { int x=3, y=5,*p=&x, *q=&y; fun(p,q); printf("%d,%d,",*p,*q); fun(&x,&y); printf(" %d,%d\n",*p,*q); } 程序运行后的输出结果是______。
A.3,5,5,3
B.3,5,3,5
C.5,3,3,5
D.5,3,5,3
第16题:
有以下程序 #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)); } 程序的运行结果是______。
A.1
B.2
C.3
D.4
第17题:
有以下程序 #include<stdio.h> main() { int *p,j; p=NULL p=fun(); for(j=0;j<4;j+){printf("%d",*p);p++;} } int*fun() { int a[4],k; for(k=0;k<4;k++)a[k]=k; return(A) ; } 程序运行后的输出结果是( )
A.程序有错不能运行
B.输出4个NULL
C.输出0 1 2 3
D.输出1 1 1 1
第18题:
下面程序的输出结果是【 】。
include<iostream.h>
int d=1;
int fun(int p){
static int d=5;
d+=p;
cout<<d<<" ";
return d;
}
void main(){
int a:3;
cout<<fun(a+fun(D) )<<end1;
}
第19题:
下面程序的运行结果是#include "stdio.h" void fun(int k,int *p) { int a,b; if(k==1|| k==2) *p=1; else { fun(k-1,&a); fun(k-2,&b); *p=a+b; } }main(){ int x; fun(6,&x); printf("%d\n",x);}
第20题:
下列程序的输出结果是( )。 #include<stdio.h> int fun(int x) { int p; if(x==0‖x==1) return 3; else p=x-fun(x-2); return p; } void main() { print f("\n%d", fun(5)); }
A.5
B.3
C.7
D.1
第21题:
有以下程序: #include void fun(char(*p)[6]) { int i; for(i=0;i<4;i++)printf("%c",p[i][i]); printf("\n"); } main( ) { char s[6][6]={"ABCDE","abcde","12345","FGHIJ","fghij","54321"}; fun(s); } 程序的运行结果是( )。
A.Aa1F
B.Ab3I
C.ABCD
D.fghij
第22题:
以下程序的输出结果是( )。 include<stdio.h> void swap(int*a,int*B){int*t; t=a;a=b;b=c;} main() {int i=3,j=5,*p=&i,*q=&j; swap(p,q);printf("%d %d\n",*p,*q); }
第23题:
42
0
1
41
第24题:
2,6
0,0
2,4
1,2