a的值是2,b的值是3
a的值是1,b的值是3
a的值是1,b的值是2
c的值是false
第1题:
有以下程序
#include <stdio.h>
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;
case 3:a++; b++;
}
printf("a=%d,b=%d\n",a,b);
}
程序的运行结果是
A.a=1,b=0
B.a=2,b=2
C.a=1,b=1
D.a=2,b=1
第2题:
A.a的值是1,b的值是2
B.c的值是false
C.a的值是2,b的值是3
D.a的值是1,b的值是3
第3题:
下列程序执行后输出的结果是( ) #include<stdio.h> f(int A) { int b=0; static c=3; a=c++,b++; return(A) ; } main() { int a=2,i,k; for(i=0;i<2;i++) k=f(a++); printf("%d\n",k); }
A.3
B.0
C.5
D.4
第4题:
有下列程序: #include <stdio.h> 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; case 3: a++;b++; } printf("a=%d,b=%d\n",a,B) ; } 程序的运行结果是( )。
A.a=1,b=0
B.a=2,b=2
C.a=1,b=1
D.a=2,b=1
第5题:
有以下程序 int fun(int x,int y){return(x+y);} main { int a=1,b=2,C=3,sum; sum=fun((a++,b++,a+b),c++ printf("%d\n",sum);) 执行后的输出结果是( )。
A.6
B.7
C.8
D.9
第6题:
有以下程序: fun(int x,int y){return(x+y);) main { int a=1,b=2,c=2,sum; sum=fun((a++,b++,a+b),c++); printf("%d\n",sum); } 执行后的结果是( )。
A.6
B.7
C.8
D.9
第7题:
有以下程序: fun(int x,int y){return(x+y);} main() {int a=1,b=2,c=3,Sum; sum=fun((a++,b++,a+b),c++); printf("%d",sum); } 执行后的输出结果是______。
A.6
B.7
C.8
D.9
第8题:
若有定义语句“int a,b;double X;”,则下列选项中没有错误的是( )。
A.switch(X%2) { case 0:a++;break; case l:b++;break; default:a++;b++; }
B.switch((int)x/2.O) { case 0:a++;break; case l:b++;break; default:a++;b++; }
C.switch((int)X%2) { case 0:a++;break; case l:b++;break; default:a++;b++; }
D.switch((int)(x)%2) { case 0.0:a++;break; case l.0:b++;break; default:a++;b++; }
第9题:
第10题:
执行完下面程序片段后,()的结论是正确的。int a,b,c;a=1;b=2;c= (a+b>3?a++:b++);
第11题:
a的值是2,b的值是3
a的值是1,b的值是3
a的值是1,b的值是2
c的值是false
第12题:
先执行a++,表达式a++的值为0,由此即可确定(a++ && b++)值为0,因此执行d++
先执行a++,表达式a++的值为0;再执行b++,表达式b++的值为0,由此可确定(a++ && b++)值为0,因此执行d++
先执行a++,表达式a++的值为1;再执行b++,表达式b++的值为1,由此可确定(a++ && b++)值为1,因此执行c++
先执行b++,表达式b++的值为1;再执行a++,表达式a++的值为1,由此可确定(a++ && b++)值为1,因此执行c++
第13题:
有下列程序:
fun(int x,int y){return(x+y);}
main()
{inta=l1b=2,c=3,sum;
sum=fun((a++,b++,a+b),C++);
printf("%d\n",sum);}
执行后的输出结果是( )。
A.6
B.7
C.8
D.9
第14题:
有如下程序: #include<stdio.h> main() { int x=1,a=0,b=0; switch(x) { casc 0:b++; case 1:a++; case 2:a++;b++; } 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
第15题:
有下列程序: 、 fun(int X,int y){return(x+y);) main( ) { int a=1,b=2,c=3,sum; sum=fun((a++,b++,a+b),c++); printf("%d\n",sum); } 执行后的输出结果是( )。
A.6
B.7
C.8
D.9
第16题:
有下列程序:
fun(int x,inty){retum(x+y);}
main()
{int a=1,b=2,c=3,sum;
stun=fun((a++,b++,a+b) ,c++);
printf("%d\n",sum);
} 执行后的输出结果是( )。
A.6
B.7
C.8
D.9
第17题:
下面程序的结果为 #include<iostream.h> int c; class A { private: int a; static int b; public: A( ) {a=0;c=0;} void seta( ){a++;} void setb( ){b++;}
A.1 2 1
B.1 2 2
C.1 1 2
D.2 2 2
第18题:
以下程序的输出结果是main() { int x=l,a=2,b=3; switch(x) { case 0:b++; case 1:a++;break; case 2:a++;b++; } printf("a=%d,b=%d\n",a,b); }
a=3,b=3
第19题:
若有定义语句int a,b;double x;则下列选项中没有错误的是( )。
A.switch(x%2) {case O:a++;break; case 1:b++;break; default:a++;b++; }
B.switch((int)x/2.0) {case O:a++;break; case 1:b++;break; default:a++;b++; }
C.switch((int)x%2) {case O:a++;break; case 1:b++;break; default:a++;b++; }
D.switch((int)(x)%2) {case 0.O:a++;break; case 1.0:b++;break; default:a++;b++; }
第20题:
执行完下面程序片段后,( )的结论是正确的。
inta,b,c;
a=1;
b=2;
c=(a+b>3?a++:b++);
A、a的值是2,b的值是3
B、a的值是1,b的值是3
C、a的值是1,b的值是2
D、c的值是false
第21题:
执行完下面的程序片段后,下面哪些结论是正确的?() int a,b,c; a=1; b=2; c=(a+b>3?a++:++b);
第22题:
下列程序的输出结果是(). 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; case 3:a++;b++;break; } printf("a=%d,b=%d/n",a,b); }
第23题:
switch(x%2)
{
case 0:a++;break;
case 1:b++;break;
default:a++;b++;
}
switch((int)x/2.0)
{
case 0:a++;break;
case 1:b++;break;
default:a++;b++;
}
switch((int)x%2)
{
case 0:a++;break;
case 1:b++;break;
default:a++;b++;
}
switch((int)(x)%2)
{
case 0.0:a++;break;
case 1.0:b++;break;
default:a++;b++;
}