请阅读下面程序:x=0forxinrange(5):x+=1ifx==3:breakprint(x,end="")运行程序,程序的输出结果为()
A.12
B.123
C.12345
D.0
A.12
B.123
C.12345
D.0
第1题
阅读以下程序,给出运行结果。
publicclassCase{
publicstaticvoidmain(Stringargs[]){
floatx=11;
floaty=4;
intz=(int)(x%y);
switch(z){
case1:
x=x+1;
case2:
x=x+2;
default:
x=x+3;
}
System.out.println(“Valueofxis:”+x);
}
}
运行结果是:
第2题
阅读下列程序,请写出程序的运行结果。
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){}
}
}
}
}
第3题
下面程序运行后的输出结果为()。 Y=0 X=8.6 IF (X.GT.6.0)Y=10.0 IF (X.GT.8.0)Y=8.0 IF (X.GE.0.0)Y=1.0 WRITE(*,*)Y END
A.0
B.1
C.8
D.10
第4题
A.IF(X<0.0)THENY=1.0
B.ELSEIF(X<=10.0)THENY=2.0
C.ELSEY=3.0
D.ENDIFENDIFPRINT*,YEND
第5题
A.-9
B.-7
C.5
D.-6
第6题
A.s=20
B.s=20、0
C.s=1000
D.s=1000、0
第7题
A.取出[a,b]区间的第一个数进行处理
B.取出[a,b]区间最后一个数进行处理
C.取出[a,b]区间第一个和最后一个数进行处理
D.依次取出[a,b]区间的所有数据进行处理
第8题
阅读以下程序,填写运行结果()。dic={'a':[1,2,2,3],'b':[1,4,5,6,2],'c':[3,7,8,9]} for k,v in dic.items(): if v.count(2)==1: print(k)
第9题
阅读以下程序,填写运行结果()。lst=[(1,3),(4,2),(6,8),(3,0)] lst.sort(key=lambda i:i[0]*i[1]) print(lst[-1])