11、以下程序输出结果为_______ main() { int x=100, a=10, b=20, ok1=5, ok2=0; if(a<b) if(b!=15) if(! ok1) x=1; else if(ok2)x=10; else x=-1; else x=2; printf("%d\n",x); }
第1题:
有以下程序: int fun(int n) {if(n==1)return 1; else return(n+fun(n-1)); } main() {int x; scanf("%if",&x);x=fun(x);printf("%d\n",x); } 执行程序时,给变量X输入10,程序的输出结果是( )。
A.55
B.54
C.65
D.45
第2题:
有以下程序: #include<stdio.h> main( ) {int x=1,y=0; if(!x)y++; else if(x==0) if(x)y+=2; else y+=3; Drintf("%d\n"。v); } 程序运行后的输出结果是( )。
A.3
B.2
C.1
D.0
第3题:
下列程序的运行结果是( )。 #include<stdio.h> main() { int a=0,b=4,c=0,d=10,x; if(a) d=d-10; else if(!b) if(!c) x=15; else x=25; printf("%d\n",d); }
A.5
B.3
C.20
D.10
第4题:
有如下程序 main() { float x=2.0,y; if(x<0.0)y=0.0; else if(x>10.0)y=1.O/x; else y=1.0; printf("%f\n",y);} 该程序的输出结果是
A.0
B.0.25
C.0.5
D.1
第5题:
有以下程序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
第6题:
有以下程序: #include<stdio.h> int fun(int x,int y) {if(x==y)return(x); else return((x+y)/2); } main() {int a=1,b=2,c=3; printf("%d\n",fun(2*a,fun(b,C))); } 程序运行后的输出结果是( )。
A.2
B.3
C.4
D.5
第7题:
有以下程序
#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
第8题:
以下程序运行后的输出结果是main(){ int x=15; while(x>10&&x<50) { x++; if(x/3) { x++; break; } else continue; } printf("%d\n",x);}
第9题:
【程序】
SET TALK OFF
INPUT “X=” TO X
DO CASE
CASE X>10
?“OK1”
CASE X>20
?“OK2”
OTHERWISE
?“OK3”
ENDCASE
SET TALK ON
RETURN
程序运行时输入X值为9,则显示结果为 ______。
A.“OK1”
B.OK1
C.“OK2”
D.“OK3”
第10题:
下面程序 main() { int x=100,a=10,b=20,ok1=5,ok2=O; if(a<B) if(b!=15) if(!ok1) x=1; else if(ok2)x=10; x=1; printf("%d\n",x); } 的输出是______。
A.-1
B.0
C.1
D.不确定的值
第11题:
(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
第12题:
55
54
65
45
第13题:
下面程序的输出是
main( )
{int x=100,a=10,b=20,ok1=5,ok2=0;
if(a<B)
if(b!=15)
if(!okl)
x=1;
else
if(ok2)x=10;
x=-1;
cout<<x<<endl;
}
A.-1
B.0
C.1
D.不确定的值
第14题:
A.输出:* * * *
B.输出:# # #
C.#存在语法错误
D.无输出结果
第15题:
下面程序 main() { int x=100, a=10, b=20, ok1=5, ok2=0; if(a<b) if(b!=15) if(!ok1) x=1; else if(ok2)x=10; x=1; printf("%d\n",x); } 的输出是______。
A.-1
B.0
C.1
D.不确定的值
第16题:
下面程序 main() { int x=100,a=10,b=20,okl=5,ok2=0; if(a<B) if(b!=15) if(!ik1) x=1; else if(ok2)x=10; x=-1; printf("%d\n",x); } 的输出是______。
A.-1
B.0
C.1
D.不确定的值
第17题:
下面程序的输出是 main() {int x=100, a=10, b=20, ok1=5, ok2=0; if(a<b) if(b! =15) if( ! ok1) else if(ok2) x= 10 x=-1 cout<<x<<end1; }
A.-1
B.0
C.1
D.不确定的值
第18题:
下列程序的运行结果是( )。 #include<stdio.h> main() { int a=0,b=4,c=0,d=10,x; if(a) d=d-10; else if(!b) if(!c) x=15; else x=25; printf("%d\n",d); }
A.5
B.3
C.20
D.10
第19题:
以下程序的输出结果是main(){ int x=100,a=10,b=20,ok1=5,ok2=0; if(a<b)if(b!=15)if(!ok1)x=1; else if(ok2)x=10; else x=-1; printf("%d\n",x);}
第20题:
有以下程序
#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
第21题:
下面程序输出的结果是( )。 main() { int x=100,a=10,b=20,ok1=5,ok2=0; if(a<b) if(b!=15) if(!ok1) x=-i; else if(ok2) x=10; x=1; printf("%d\n",x); }
A.-1
B.0
C.1
D.不确定的值
第22题:
以下程序运行后的输出结果是【 】。
main( )
{ int x=15;
while(x>10 &&x<50)
{ x++;
if(x/3){ x++;break;}
else continue;
}
printf("%d\n",x);
}
第23题:
请为下面的程序设计符合判定覆盖的测试用例。 int main() { int a,b,c,x,y,z,t; scanf(“d%,d%,d%”,&a,&b,&c,&t); if a>5 && t<1 x=10 else x=1; if b>10 y=20 else y=2; if c>15 z=30 else z=3; printf(“d%,d%,d%/n”,x,y,z) }
第24题:
3
2
1
0