阅读程序回答问题:main(){int i,j,k,m=0;for(i=1;i<4;i++)for(j=1;j<4;j++)for(k=1;k<4;k++)m++;printf(“M=%d”,m);}以上程序输出M=()。
A.3
B.6
C.9
D.27
A.3
B.6
C.9
D.27
第2题
A.4
B.3
C.1
D.2
第3题
写出下列程序的运行结果。
#include void Fun(){int num=20;cout<< "The Fun's num is"<< num<< endl;
}void main(){int num=10;cout<< "The main's num is "<< num<< endl;Fun();{int num=30;
cout<< "The Field's num is "<< num<< endl;}cout<< "The main's num is "<< num<< endl;}
第4题
请写出如下程序的输出结果:
#include void Swap(int &a, int & b);void main(){int x(10 ), y(7 );
cout<< "x="<< x<< " y="<< y<< endl;Swap(x , y );cout<< "x="<< x<< " y="<< y<< endl;
}void Swap(int & a, int & b){ int temp; temp = a ; a=b ; b=temp ; }
第5题
A.963
B.852
C.875421
D.741
第6题
A.0
B.1
C.2
D.4
第7题
请写出下列程序的输出结果。()
#include
int main() /{
char str[ ]="1A2B3C4D"; int i;
for(i=0;str[i]!='/0';i++)
if ((str[i]<'0') || (str[i]>'9'))
printf("%c",str[i]);
return 0;
/}
}
第8题
class A
{
int a;
A(int b)
{a=b;}
void show()
{System.out.println(“a=”+a);}
}
public class Class1
{
public static void main (String args[])
{
A bj=new A(12345);
boolean b=false;
char ch=97;
obj.show();
System.out.println(“b=”+b+”/tch=”+ch);
}
}
第10题
A.3 3
B.3 4
C.4 2
D.4 3
第11题
A.-11 is a positive odd number.
B.-11 is a negative odd number.
C.-11 is a positive even number.
D.11 is a negative even number.