以下()表达式产生一个0~7之间(含0,7)的随机整数.
第1题:
函数Math.Floor(15.8)的返回值为16。()
第2题:
A.Intfoo=(int)Math.max(bar);
B.Intfoo=(int)Math.min(bar);
C.Intfoo=(int)Math.abs(bar);
D.Intfoo=(int)Math.ceil(bar);
E.Intfoo=(int)Math.floor(bar);
F.Intfoo=(int)Math.round(bar);
第3题:
下面程序段的输出结果是______。 public class Test{ public static void main(String args[ ]){ int x,y; x=(int)Math.sqrt(5/2)+(int)Math.random( )*5/2; y=(int)Math.sqrt(3/2)+(int)Math.random( )*3/2; if(x>y) System.out.println("x>y"); else if(x==y) System.out.println("x=y"); else System.out.println("x<y"); } }
A.x>y
B.x=y
C.x<y
D.编译错误
第4题:
A.(int)(20+Math.random()*979)
B. 20+(int)(Math.random()*980)
C. (int)Math.random()*999
D. 20+(int)Math.random()*980
第5题:
要产生[20,999]之间的随机整数可以使用以下哪个表达式?()
第6题:
在Math类中random方法可以产生随机数。如果从1到100之间产生一个随机整数(大于等于1,小于等于100),并赋值给n,那么下面语句正确的是()。
第7题:
下列正确的代码分别是?()
第8题:
Math.random()方法用来实现什么功能?下面的语句起到什么作用? (int)(Math.random()*6)+
第9题:
d >= 1.0
0.0 <= d < 1.0
0.0 <= d < Double.MAX_VALUE
0.0 <= d <= Double.MAX_VALUE
Double.MIN_VALUE <= d < Double.MAX_VALUE
第10题:
第11题:
(int)(20+Math.random()*97)
20+(int)(Math.random()*980)
(int)Math.random()*999
20+(int)Math.random()*980
第12题:
(难度:中等)Math.random()返回 0(不包括) 至 1(不包括) 之间的随机数
答案:(no)
第13题:
A.d>=1.0
B.0.0<=d<1.0
C.0.0<=d<Double.MAX_VALUE
D.0.0<=d<=Double.MAX_VALUE
E.Double.MIN_VALUE<=d<Double.MAX_VALUE
第14题:
执行int x=(int)(Math.random()*100);语句时,不会出现下列哪个数值?
A.1
B.35
C.48
D.100
第15题:
阅读以下说明和 Java 代码,填补代码中的空缺,将解答填入答题纸的对应栏内。 【说明】 设计 RGB 方式表示颜色的调色板,进行绘图。其类图如图 6-1 所示。该程序的 Java代码附后。图6-1 类图
【Java 代码】 //颜色类 class MyColor { private int red ,green, blue; public MyColor( ) { red = o; green = 0; blue = 0; } public MyColor(int red ,int green ,int blue) { this.red = red; this.green = green; this.blue = blue; } //其他方法略 public String toString( ) { return "Red: " + red + "\tGreen: " + green + "\tBlue " + blue; } } //调色板类 class Palette { public int number; / /颜色数 private (1)palette; //颜色表 public Palette( ) { number = 256; palette = new MyColor[number); } public Palette(MyColor[] palette ,int number) { (2)= number; (3)= palette; } //其他方法略 public String toString( ) { String str = ""; for (int i = 0; i < number; i++) { str +=i+ " : " + palette[i] + "\n"; } return str; } //绘图类 class Drawing { public (4) int COLORNUMBER = 16; public static void main(String[] args) { Palette palette; int red ,green ,blue; MyColor[] color = new MyColor[COLORNUMBER]; for (int i = 0; i < COLORNUMBER; i++) { red = (int) (Math.random( ) * 256); green = (int) (Math.random( ) * 256); blue = (int) (Math.random( ) * 256); color [i] = (5) (red ,green ,blue); } palette = new Palette(color ,COLORNUMBER); System.out.println(palette); } }
第16题:
动作语句:math.random()*10表示产生0--10之间的随机数。
A对
B错
第17题:
Math.random()方法可返回介于()和()之间的一个伪随机数。
第18题:
Java语言中的方法Math.Random( )返回0到()之间的一个随机小数。
第19题:
以下()表达式产生一个0~7之间(含0,7)的随机整数。
第20题:
11. double d = Math.random(); Which is true about d after line 11?()
第21题:
Math.floor(Math.random()*6)
Math.floor(Math.random()*7)
Math.floor(Math.random()*8)
Math.ceil(Math.random()*8)
第22题:
第23题:
对
错