首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下列程序运行后,单击窗体,在窗体上显示:1,1+2,1+2+3,1+2+3+4,1+2+3+4+5的和。在横线处应填写( )。 Private Sub Form_Click() Dim i As Integer,tt As Integ
下列程序运行后,单击窗体,在窗体上显示:1,1+2,1+2+3,1+2+3+4,1+2+3+4+5的和。在横线处应填写( )。 Private Sub Form_Click() Dim i As Integer,tt As Integ
admin
2016-11-12
25
问题
下列程序运行后,单击窗体,在窗体上显示:1,1+2,1+2+3,1+2+3+4,1+2+3+4+5的和。在横线处应填写( )。
Private Sub Form_Click()
Dim i As Integer,tt As Integer
For i=l To 5
tt=Sum(i):Print"tt=";tt,
Next i
End Sub
Private Function Sum( )
j=j+n:Sum=j
End Function
选项
A、n As Integer j As Integer
B、n As Integer Static j As Integer
C、ByVal n As Integer j As Integer
D、ByVal n As Integer Static j As Integer
答案
D
解析
本题考查参数的传递和静态局部变量。Sum函数在窗体单击事件中调用5次并用来求和,因此每一次求和结果应当保留,所以借助静态变量实现。同时要求传递的形参变化不应影响到实参,因此采用传值调用。
转载请注明原文地址:https://kaotiyun.com/show/uoGp777K
本试题收录于:
二级VB题库NCRE全国计算机二级分类
0
二级VB
NCRE全国计算机二级
相关试题推荐
在数据库系统的内部结构体系中,索引属于()。
(1)在名称为Forml的窗体上画两个标签(名称分别为Labell和Label2,标题分别显示为“姓名”和“年龄”)、两个文本框(名称分别为Textl和Text2,初使内容均为空)和一个命令按钮(名称为Commandl,标题为“显示”)。然后编写命令按钮的
VisualBasic对象可以分为两类,分别为_________和________。
以下关于多重窗体程序的叙述中,错误的是()。
在VisualBasic的立即窗口内输入以下语句X=65?Chr$(X)在窗口中显示的结果是_________。
关于结构化程序设计原则和方法的描述错误的是()。
设有以下函数过程:Functionfun(mAsInteger)AsIntegerDimkAsInteger,sumAsIntegersum=0Fork=mTo1Step-2sum
在面向对象方法中,______描述的是具有相似属性与操作的一组对象。
软件工程学中除软件开发技术需重视外,另一重要组成内容是软件的【】。
数据结构分为线性结构和非线性结构,线性表、栈和队列都属于【】。
随机试题
编一个C程序,父进程首先设置信号SIGUSR1的处理方法和创建无名管道,再创建一个子进程,然后从键盘上读入一个命令串(如ls-l),并通过无名管道向子进程发送该命令串。之后再向子进程发送软中断信号SIGUSR1,父进程等待子进程终止。子进程读到命令后,睡眠
用科学发展观的全面协调可持续发展的原理谈谈人与人、人与自然、人与社会的关系。
房地产经纪机构的经营战略中,下列关于多向多样化战略类型的说法中不正确的是()。
拟建于某自然保护区内的索道建设项目的建设单位,按照相关规定,建设单位应当在()向公众公告环境影响评价的工作程序和主要工作内容。
工程项目实施阶段的主要工作包括()。
投标保证金的实质是为了避免因()等行为而给招标人造成损失。
用人单位未按规定提出工伤认定申请,工伤职工或者其直系亲属、工会组织在事故伤害发生之日或者被诊断、鉴定为( )之日起1年内,可以直接向用人单位所在地统筹地区劳动保障行政部门提出工伤认定申请。
市场预测的一般过程是()。
根据面试技巧,以下面试官的做法中,不正确的是()。
简述皮亚杰的认知发展理论。
最新回复
(
0
)