问题 单项选择题

关于下面程序段的说法,正确的是
import javA.applet.*;
import java.awt,*;
public class Test extends Applet
Image img;
public void init()
img=new Image();

public void paint(Graphics g)
g. drawlmage(img,0,0,this);

A.该程序段可以正常运行

B.程序中所创建的Image为空,但可以显示

C.程序中所创建的Image不为空

D.程序中所创建的Image为空,不能显示

答案

参考答案:D

解析: 本题考查Image的概念和用法。程序的目的是想要使用drawImage(Image img,int x,int y,ImageObserver observer)方法将img在Applet中画出,但由于程序段所创建的Image为空,不能显示,应该先调用getImage()获取已经存在的图像。所以选项D正确。

阅读理解

One afternoon after school had finished , Peter and Jane were walking along the street. Suddenly they heard a big noise.

“Come on” shouted Peter.“That sounds like an accident. Let’ see what’s happened.”

They ran to where the noise came from. As soon as they got there, they could see what had happened. A small car had knocked into the side of a truck. The accident had happened in a quiet street with only four houses in it. Peter and Jane were the first ones to reach the site. No other people came.“We must be the only ones who saw the accident,” said Jane. They found that both the car driver and the truck driver were hurt.

“Peter,” said Jane,“ Run back down the road to Mrs Day’s house. Ask her to call the policemen and the ambulance. Hurry. I’ll stay here.”

Off went Peter as fast as he could. There was nothing Jane could do but wait. She knew that when people were hurt in an accident, they shouldn’t be moved. It wasn’t long before the police car and the ambulance arrived. The policeman got the car door open and they carried the man out. Then they got the truck driver out. The men weren’t seriously hurt, but they were both taken to the hospital. The policemen thanked Peter and Jane, “You were very good to act so quickly when you saw the accident. Thank you for all your help.”

67.The accident happened _______.

A. in a quiet street one school day afternoon

B. in a busy street one school day afternoon

C. in a quiet street one Sunday after noon

D. in a busy street one Sunday afternoon

68. ______in the accident.

A. Only the car driver was hurt        B. Only the truck driver was hurt

C. Neither of the two drivers was hurt   D. Both the drivers were hurt

69._____called the policeman.

A.Jane  B.The drivers   C. Mrs Day    D. Peter

70.Jane did nothing before the policemen arrived because _____.

A. she was too frightened to do anything   B. she was alone after Peter left

C. she was waiting for Peter

D. she knew she shouldn’t move the two drivers

单项选择题