3
2
1
0
第1题:
有如下程序: #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
第2题:
以下程序的执行结果是______。
include<iostream.h>
void main()
{
int x=5 y=2;
cout<<! (y==x/2)<<",";
cout<<(y!=x%3)<<",";
cout<<(x>0 && y<0=<<",";
cout<<(x!=y||x>=y)<<endl;
}
第3题:
有以下程序: #include <stdio.h> main() { int a[] = {2,4,6,8,10} ,y =0,x, * p; p =&a[1]; for(x=1;x<3;x++)y+ =p[x]; printf( "% d \n" , y); }程序运行后的输出结果是( )。
A.10
B.11
C.14
D.15
第4题:
有如下程序: #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
第5题:
有以下程序 #include <stdio.h> intf(int x) { int y; if(x==0||x==1) return(3); y=x*x-f(x-2); return y; } main() { int z; z=f(3); printf("%d\n",z); } 程序的运行结果是
A.0
B.9
C.6
D.8
第6题:
有下列程序: #include <stdio.h> int f(int x) { int y; if(x=0‖x==1)return(3); y=x*x-f(x-2); return y; } main() { int z; z=f(3);printf("%d\n",z); 程序的运行结果是( )。
A.0
B.9
C.6
D.8
第7题:
有以下程序: #include<iostream.h> void main() { int x=5,y=2; cout<<!(y==x/2)<<","; cout<<y!=x%3)<<","; cout<<(x>0&&y<0)<<","; cout<<(x!=y‖x>=y)<<endl: } 程序执行后的输出结果是( )
A.0,0,0,1
B.1,1,1 1
C.0,0, 1,1
D.1,1,0,0
第8题:
有以下程序 #include <stdio.h> int f(int x) { int y; if(x==0||x==1) return(3); y=x*x-f(x-2); return y; } main() { int z; z=f(3); printf("%d\n",z); } 程序的运行结果是
A.0
B.9
C.6
D.8
第9题:
有以下程序
#inclUde<stdio.h>
main()
{int x=1。y=0;
if(!x)y++;
else if(x==0)
if(x)y+=2;
else y+=3; .
printf(“%d\n”,y);
}
程序运行后的输出结果是
A.3
B.2
C.1
D.0
第10题:
有以下程序
#include
main()
{ int x=1,y=0;
if(!x) y++;
else if(x==0)
if (x) y+=2;
else y+=3;
printf("%d\n",y);
}
程序运行后的输出结果是
A.3
B.2
C.1
D.0
第11题:
在下面程序运行后,输出结果为 ______。 #include<iostream.h> void count(int x[],int n,int &y){ int k; y=0; for(k=0:k<n;k++) if(x[k]<0) y++; } void main(){ int b[]={2,1,-8,-3,7,2,4,6,0,-13}; int x; count(b,10,x); cout<<“x”<<x<<end1; }
A.x=3
B.x=5
C.出错
D.x=0
第12题:
0
9
6
8
第13题:
有以下程序: #include<iostream> using namespace std; int f(int,int); int main() { int i:1,x; x=f(i,i+1); cout<<x<<end1; return 0; } int f(int a,int b) { int c; c = a; if(a>b) c = 1; else if(a==b) c = 0; else c = -2; return c; } 运行后的输出结果是( )。
A.1
B.0
C.-1
D.-2
第14题:
下面程序的结果【 】。
include<iostream.h>
int f(int);
void main() {
int x=1, i;
for (i=0; i<3; i++)
cout<<f(x)<<‘ ’ ;
cout<<end1;
}
int f(int x){
int y=1;
static int z=3
y++;
z++;
return (x+y+z);
}
第15题:
下面程序的运行结果为_____。
include<iostream.h>
void fun(int x=0,int y=0)
{
cout < < x < < y;
}
void main( )
{
fun(5) ;
}
第16题:
有以下程序: #include<iostream.h> void main() { int x=l0,y=l0: for(int i=0;x>8;y=++i) cout<<x--<<","<<y<<",": } 该程序运行后的输出结果是( )。
A.10,1,9,2
B.9,8,7,6
C.10,9,9,0
D.10,10,9,1
第17题:
有以下程序 main() { int x=0,y=0,i; for(i=1;++i) { if(i%2==0) {x++;continue;} if(i%5==0){y++;break;}} printf("%d,%d",x,y);} 程序的输出结果是
A.2,1
B.2,2
C.2,5
D.5,2
第18题:
关于下面的程序 #include<stdio.h> main() { int x=3,y=0,z=0; if(x=y+z)printf("****"); else printf("$$$$"); }说法正确的是______。
A.有语法错误不能通过编译
B.输出****
C.输出$$$$
D.可以通过编译,但不能通过连接,无法运行
第19题:
有以下程序: #include <iostream> using namespace std; int main() { int x; for(int i=1;i<=100;i++) { x=i; if (++x%2==0) if (++x%3==0) if (++x%7==0) cout<
A.39,81
B.42,84
C.26,68
D.28,70
第20题:
若有以下程序段; #include<iostream> using namespace std; int main() { int a[]={1,4,5}; int *p=&a[0],x=6,y,z; for(y=0;y<3;y++) z=((*(p+y)<x) ? *(p+y):x); cout<<z<<end1; return 0; } 程序运行后的输出结果是( )。
A.1
B.4
C.5
D.2
第21题:
有以下程序: #include<iostream.h> void main() { int x=10,y=10; for(int i=0;x>8;y=++i) cout<<x--<<","<<y<<","; } 该程序运行后的输出结果是( )。
A.10,1,9,2
B.9,8,7,6
C.10,9,9,0
D.10,10,9,1
第22题:
下面程序输出的结果是( )。 #include<iostream> using namespace std; int fuc (char *x); int main(){ cout<<fuc("hello")<<endl; return 0; } int fuc(char *x){ char *y=x; while(*y! ='\0')y++; return(y-x); }
A.5
B.6
C.0
D.语法错误,不能输出结果
第23题:
(27)有以下程序
#include <stdio.h>
main()
{ int x=1,y=0;
if(!x) y++;
else if(x==0)
if (x) y+=2;
else y+=3;
printf("%d\n",y);
}
程序运行后的输出结果是
A)3
B)2
C)1
D)0