28)
import java.awt.*; import java.applet.*;
public class DrawRect extends Applet { public void paint(Graphics g) { g.setColor(Color.red); g.drawRoundRect(150,50,50,50,20,40); g.setColor(Color.green); g.fillRoundRect(150,140,50,50,20,20); } }
根据代码,输出结果正确的有()。
a) 两个圆角矩形的绘制弧高都为20 b) 两个圆角矩形的绘制弧宽相同 c) 两个圆角矩形是左对起的 d) 两个圆角矩形是上对齐的 参考答案 bc
考核知识点 Java中的Graphics
3 难度
0805 所属章节
3 认知层次 29)
下列解释正确的是()。
a) our_applet.java中一定有一个参数是”display_string” b) 具有两个属性”name”和“value” c) value是参数的名称 d) \通过
考核知识点 向applet传递参数
2 难度
1004 所属章节
2 认知层次
30)
import java.applet.*; import java.awt.*;
public class A1 extends Applet { public void paint(Graphics g) { g.drawString(\ } }
有以上代码下列说法错误的是()。
a) 嵌入该程序的height=50 b) 嵌入该程序的code一定是A1.class c) 其结果显示为”hello!” d) 用web可以浏览嵌入该程序的网页 参考答案 a
考核知识点 在HTML页中嵌入Applet
2 难度
1004 所属章节
2 认知层次 31)
对“停止状态”或“销毁状态”理解不正确的是()。 a) 若用户从applet运行的页移动到其它页,stop()方法就会停止第一页
中的applet
b) 若用户从applet运行的页移动到其它页,stop()方法不会停止第一页
中的applet
c) 使用destroy()方法可将applet从内存中永久删除 d) destroy()方法可以删除运行的applet所有使用的资源 参考答案 b
考核知识点 Applet的生命周期
1 难度
1003 所属章节
2 认知层次 32)
对于applet状态理解正确的是()。 a) 是在init()方法的调用以后 b) 如果一个applet保持为“闲置状态”,则applet将在用户重新开始工
作时用init()方法执行
c) 如果一个applet保持为“闲置状态”,则applet将在用户重新开始工
作时用start()方法执行
d) start()方法在applet的生命周期只能调用一次
参考答案 考核知识点 难度 所属章节 认知层次 33)
ac
Applet的生命周期 2 1003 2
程序读入用户输入的一个值,要求创建一个自定义的异常,如果输入值大于10,使用throw语句显式地引发异常,异常输出信息为“something’s wrong!”, 语句为()。
if ( i > 10 ) a)
throw Exception(“something’s wrong!”);
if ( i > 10 ) b)
throw Exception e (“something’s wrong!”);
if ( i > 10 ) c)
throw new Exception(“something’s wrong!”);
if ( i > 10 ) throw new Exception e (\d) 参考答案 c
考核知识点 异常处理
2 难度
0505 所属章节
2 认知层次 34)
import java.applet.Applet;
import java.awt.*;
public class ImageDemo extends Applet{ Image img; public void init() {
img=getImage(getCodeBase(),\ //1 }
public void paint(Graphics g) { int w=img.getWidth(this); int h=img.getHeight(this);
g.drawImage(img,120,60,w/2,h/2,this); //2 g.drawImage(img,150,0,w*2,h*2 ,this); //3 } }
以上代码第()行将图像放大。
1 a) 2 b) 3 c) d) 代码并没有将图像放大 参考答案 c
考核知识点 使用图像的动画
难度 所属章节 认知层次
1 0807 1
35) 对于drawImage(image,x,y,width,height,this)方法解释正确的是()。 a) image是要绘制的图像 b) x,y是表示图像的中心的位置 c) width是源图像的宽度 d) this是容器 参考答案 ad
考核知识点 使用图像的动画
2 难度
0807 所属章节
2 认知层次
38) 当在一个操作中按下和释放鼠标按钮时处理()事件。 mouseEntered a) mouseExitied b) mousePressed c) mouseClicked d) 参考答案 d
考核知识点 鼠标事件
2 难度
0703 所属章节
2 认知层次
39) 返回按钮的标签的方法的是()。
getActionCommand() a) setLabel(string str) b) button() c) getLabel() d) 参考答案 d
考核知识点 按钮的标签
2 难度
0902 所属章节
2 认知层次 40)
为了辨别用户关闭窗口的时间,要实现监听器接口()。
MouseListener a)
b) c) d) 参考答案 考核知识点 难度 所属章节 认知层次 41)
ActionListener WindowListener 以上都要
c
事件处理 1 0702 2
import java.awt.*; import java.applet.*;
public class ButtonDemo extends Applet{ public void init() { Button pushBotton=new Button(\ Button downBotton=new Button(\es\ add(pushBotton); add(downBotton); } }
根据以上代码,下列解释正确的是()。
a) 该代码画了一个按钮 b) Button(\创建一个有显示\的按钮 c) Button()是构造函数 d) 按钮属于容器 参考答案 bc
考核知识点 Java GUI组件和Applet
2 难度
所属章节 综合题
2 认知层次
42)
下面的程序: public class test {
public static void main(String args[]) { int x, y; x = 5 >> 2; y = x >>> 2;
System.out.println(y); } }
编译运行后,在屏幕上显示的结果是()。
5 a)
2 b)
80 c)
0 d)