阅读下列代码段 intx=3; while(x<9) X+=2; X++; while语句成功执行的次数是【 】。
阅读下列代码段 intx=3; while(x<9) X+=2; X++; while语句成功执行的次数是【 】。
阅读下列代码段 intx=3; while(x<9) X+=2; X++; while语句成功执行的次数是【 】。
A.x=3,6
B.x=3,4
C.x=5,4
D.编译错误
A.0
B.1
C.2
D.3
阅读下列程序,请写出程序的运行结果。
import java.applet.*;
import java.awt.*;
public class C extends Applet implements Runnable
{
Thread redBall,blueBall;
Graphics redPen,bluePen;
int blueSeta=0,redSeta=0;
public void init()
{
setSize(250,200);
redBall=new Thread(this);
blueBall=new Thread(this);
redPen=getGraphics();
bluePen=getGraphics();
redPen.setColor(Color.red);
bluePen.setColor(Color.blue);
setBackground(Color.gray);
}
public void start()
{
redBall.start();
blueBall.start();
}
public void run()
{
intx,y;
while(true)
{
if(Thread.currentThread()==redBall)
{//以下代码为顺时针画圆
x=(int)(80.0*Math.cos(3.1415926/180.0*redSeta));
y=(int)(80.0*Math.sin(3.1415926/180.0*redSeta));
redPen.setColor(Color.gray);
redPen.fillOval(100+x,100+y,10,10);
redSeta+=3;
if(redSeta>=360)redSeta=0;
x=(int)(80.0*Math.cos(3.1415926/180.0*redSeta));
y=(int)(80.0*Math.sin(3.1415926/180.0*redSeta));
redPen.setColor(Color.red);
redPen.fillOval(100+x,100+y,10,10);
try{redBall.sleep(20);}
catch(InterruptedException e){}
}
elseif(Thread.currentThread()==blueBall)
{//以下代码为顺时针画圆
x=(int)(80.0*Math.cos(3.1415926/180.0*blueSeta));
y=(int)(80.0*Math.sin(3.1415926/180.0*blueSeta));
bluePen.setColor(Color.gray);
bluePen.fillOval(150+x,100+y,10,10);
blueSeta-=3;
if(blueSeta<=-360)blueSeta=0;
x=(int)(80.0*Math.cos(3.1415926/180.0*blueSeta));
y=(int)(80.0*Math.sin(3.1415926/180.0*blueSeta));
bluePen.setColor(Color.blue);
bluePen.fillOval(150+x,100+y,10;10);
try{blueBall.sleepp(40);}
catch(InterruptedException e){}
}
}
}
}
A.java
B.class
C.java
D.class
A.无编译错误
B.代码publicStringdoit(){行,出现编译错误
C.代码return“a”;行,出现编译错误
D.代码publicdoubledoit(intx){行,出现编译错误
A.x的值是1,y的值是1,z的值是6
B.x的值是2,y的值是1,z的值是3
C.x的值是1,y的值是2,z的值是3
D.x的值是2,y的值是1,z的值是6
分析下面的C#代码,该程序的运行结果是()。classExample{staticvoidMain(stringO
args){(newExample).myMethod(;}voidmyMethod(){intxy;x=5;y=3;Console.Write("(*+x+","+y+'));switchCoords(x.y);Console.Write("("+x+"+y+")");}voidswitchCoords(intX,inty){inttemp;temp=x;y=temp;Console.Write("+x+"+y+")");}}
A.打印输出(5,3)(5,5)(5,3)
B.打印输出(5,3)(3,5)(3,5)
C.打印输出(5,3)(3,5)(5,3)
A.bar(3)(2)==8
B.bar(2)(3)==8
C.bar(2)(3)==6
D.bar(3)(2)==6
根据下列要求编写一个汇编语言程序: (1)代码段的段名为COD_SG。 (2)数据段的段名为DAT_SG。 (3)堆栈段的段名为STK_SG。 (4)变量HIGH_DAT所包含的数据为95。 (5)将变量HIGH_DAT装入寄存器AH、BH和DL中。 (6)程序运行的入口地址为START。