问题 填空题

在窗体上有一个名称为Command1的命令按钮,并有如下事件过程和函数过程:
Private Sub Command1_Click()
Dim p as Integer
p=m(1)+m(2)+m(3)
Print p
End Sub
Private Function m(n As Integer) As Integer
Static s As Integer
For k=1 To n
s=s+1
Next
m=s
End Function
运行程序,单击命令按钮Command1后的输出结果为______。

答案

参考答案:J

解析: 本题考查静态变量,静态变量s上一次的值可以被保留下来。第一次调用时,For循环执行一次,s=s+1=0+1=1,第二次调用时,For循环执行两次,s=s+1=1+1=2,s=s+1=2+1=3,第三次调用时,For循环执行三次,s=s+1=3+1=4,s=s+1=4+1=5, s=s+1=5+1=6,最后p=1+3+6=10。所以[6]空填10。

阅读理解

阅读短文,选择正确答案。

     In the United States, headmasters and teachers discipline (惩罚) students in several ways. The teacher often

writes to or calls the students' parents. Sometimes students have to stay at school for one hour. If a student

behaves very badly, the headmaster can stop the student having classes. The student can't come to school for

one, two or three days. Mr. Lazarus, the headmaster of a middle school in Ohio, did not like to do so. When he

didn't let the students come to school, they were happy."A three-day holiday!" they thought.

     One day, a boy was in Mr. Lazarus' office. The boy was not behaving well in class. Mr. Lazarus telephoned

the boy's parents. "If you come to school with your son, I won't stop him having classes," he said. The boy's

father came to school and went with his son to every class. Other students looked at the boy and his father. The

boy was embarrassed. After that he behaved better. And, of course, other students behaved better, too. 

     Now headmasters all over the USA are trying Mr. Lazarus's idea. They too, think that students behave better

when parents come to school.

1. What does a headmaster usually do to the student if he behaves very badly? [ ]

A. He stops the student having classes for several days.

B. He makes the student stay at school for one hour.

C. He calls the student's parents.

2. When a student was stopped having classes for two or three days, he was ________. [ ]

A. happy

B. angry

C. worried

3. What did Mr. Lazarus do when his students were not behaving well in class? [ ]

A. Tried to talk to them.

B. Sent them home.

C. Telephoned their parents to come to school and go to classes with them.

4. Why did the other students behave better, too? [ ]

A. They didn't like to have classes with the boy's father.

B. They didn't want their parents to come to school.

C. They were afraid of teachers.

5. In the United States, a student will be _______ when his parents have classes with him. [ ]

A. happy

B. embarrassed

C. excited

名词解释