问题 填空题

在窗体上有1个名称为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
Fork=1 To n
s=s+1
Next
m=s
End Function
运行程序,单击命令按钮Command1后的输出结果为______。

答案

参考答案:J

解析: 局部变量如果使用Dim声明,随过程的调用而分配存储单元,每次调用都对变量初始化,过程体结束,变量的内容自动消失,并释放存贮单元;如果使用Static声明,则每次调用过程,变量保持原来的值。本题中的s为一个静态变量,第一次调用结束后里面的值为1,第二次调用结束后里面的值为3,第三次调用结束后里面的值为6。

完形填空
完形填空。
     Mr. John was at the window of a train in    1   . He was going to Washington, and now he was    2   .
The train began moving, and an old worker    3    the window. Mr. John shouted angrily at the    6   ,
" I gave you my luggage (行李) an hour ago,    5    you didn't put it in the train. Why isn't it here, and
where did you    6    it?" The old man smiled at Mr. John and said, "I looked    7    you here and there,
but I didn't    8    you. Your luggage isn't as foolish    9    you are. You are in the wrong    10   . This
one is going to New York."
( )1. A. the street 
( )2. A. tired   
( )3. A. came to  
( )4. A. boy                  
( )5. A. so     
( )6. A. lost    
( )7. A. over    
( )8. A. find    
( )9. A. so     
( )10. A. window   
B. the station     
B. busy          
B. left             
B. woman           
B. and                           
B. put            
B. at              
B. look for         
B. but            
B. luggage       
C. Washington    
C. happy       
C. opened          
C. worker        
C. or                                   
C. found       
C. for              
C. find out    
C. for             
C. train    
D. the factory  
D. angry       
D. closed  
D. driver      
D. but       
D. forgot                        
D. after          
D. bring  
D. as         
D. station 
单项选择题