更多"下列程序段的输出结果是______。 void main( ) "的相关试题:
[单项选择]下面程序段的输出结果是
classTest
public static void main(Stringargs[])
MyThread t=new MyThread( );
t.displayOutput(”t has been createD) ”);
t.start( );
Class MyThread extends Thread
public void displayOutput(Strings)
System.out.println(S);
public void run( )
displayOutput(”t is running.”);
A. thas been created.
B. thas been created
C. t is running.
D. 编译出错
[单项选择]下面程序段的输出结果是 class Test{ public static void main(String args[]){ MyThread t=new MyThread( ); t.displayOutput("t has been createD) "; t.start( ); } } class MyThread extends Thread{ public void displayOutput(String s){ System.out.println(s); } public void nm( ){ displayOutput("t is running. "); }
A. t has been create t is runnin
B. t has been create
C. t is runnin
D. 编译出错
[填空题]下列程序段的输出结果是 [7] 。
#include<iostream.h>
void main( )
int i=10,sum=0;
do
sum=+sum+i;
i=i-2;
while(i>=2);
cout<<sum<<end1;
[单项选择]下列程序的输出结果是 #include void main( )
{ char * str="12123434"; int x1=0,x2=0,x3=0,x4=0,i;
for(i=0;str[i]!=’/0’;i++) switch(str[i]) {
case’1’:x4++; case’2’:x3++; case’3’:x2++;
case’4’:x1++; } cout < < x1 < < ","
< < x2 < < "," < < x3 < < "," < < x4;
A. 8,6,4,1
B. 8,6,3,2
C. 8,8,4,1
D. 8,6,4,2
[填空题]以下程序运行后输出的结果是______。
void main( )
char c1,c2;
for (c1=’0’,c2=’9’;c1<c2;c1++,c2--) printf("%c%c",c1,c2);
printf("/n");
[填空题]以下程序的输出结果是 [10] 。
char s[ ]="XYZQ";
void main( ){
char *p;
for(p = s; p < s+4; p++)
cout<<p<<end1;
}
[单项选择]下面程序段的运行结果是
void main ( )
int t, a, b, C;
a=1;b=2;C=2;
while(a<b<c)
t=a;a=b;b=t;c--;
cout < < a < < "," < < b < < "," < < C;
A) 1,2,0 B) 2,1,0 C) 1,2,1 D) 2,1,1
[单项选择]以下程序的输出结果是
#include<iostream.h>
void main( )
int i,j,x=0;
for(i=0;i<2;i++)
x++;
for(j=0;j<3;j++)
if(j%2)continue;
x++;
x++;
cout<< "x="<<x;
A. x=4
B. x=8
C. x=6
D. x=12
[单项选择]下列程序的输出结果是
#include<iostream.h>
void main( )
char*str="12123434";
int xl=0,x2=0,x3=0,x4=0,i;
for(i=0;str[i]!=’/0’;i++)
switch(str[i])
case’1’:x4++;
case’2’:x3++;
case’3’:x2++;
case’4’:x1++;
cout<<x1<<","<<x2<<","<<x3<<","<<x4;
A. 8,6,4,1
B. 8,6,3,2
C. 8,8,4,1
D. 8,6,4,2