首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
现有如下程序: Private Sub Command1_Click() s=0 For i=1 To 5 s=s+f(5+i) Next Print s End Sub Public Function f(x As Integer
现有如下程序: Private Sub Command1_Click() s=0 For i=1 To 5 s=s+f(5+i) Next Print s End Sub Public Function f(x As Integer
admin
2020-02-27
16
问题
现有如下程序:
Private Sub Command1_Click()
s=0
For i=1 To 5
s=s+f(5+i)
Next
Print s
End Sub
Public Function f(x As Integer)
If x>=10 Then
t=x+1
Else
t=x+2
End If
f=t
End Function
运行程序,则窗体上显示的是( )。
选项
A、38
B、49
C、61
D、70
答案
B
解析
程序中过程f的功能是参数值大于等于10时,返回参数加1的值,否则返回参数加2的值。因此按钮事件中s值的计算过程如下:
i=1时,s=0+f(5+1)=8;
i=2时,s=8+f(5+2)=8+9=17;
i=3时,s=17+f(5+3)=17+10=27;
i=4时,s=27+f(5+4)=27+11=38;
i=5时,s=38+f(5+5)=38+11=49;
因此最终在窗体上输出的是49。
转载请注明原文地址:https://jikaoti.com/ti/qBx0FFFM
本试题收录于:
二级VB题库NCRE全国计算机二级分类
0
二级VB
NCRE全国计算机二级
相关试题推荐
目录列表框的Path属性的作用是()。
窗体上有1个名称为Label1的标签;1个名称为List1,且含有若干表项的列表框。为了使得单击List1中某个表项时,在Label1中相应地显示该表项,应使用的程序代码为
假定有以下两个过程:SubS1(ByValxAsInterger,ByValyAsInterge()DimtAsIntergert=x:x=y:y=tEndSubSubS2(xAsInterger,y
窗体上命令按钮Command1的事件过程如下:OptionBase1PrivateSubCommand1_Click()Dima(4,4)AsVariantFori=lTo4Forj=1
文本框接受的最长字符数由文本框的()属性确定。
以下关于控件数组的叙述中,错误的是( )。
可以产生30~50(含30和50)之间的随机整数的表达式是()。
软件按功能可以分为:应用软件、系统软件和支撑软件(或工具软件)。下面属于应用软件的是()。
在窗体上有两个名称分别为Text1、Text2的文本框,一个名称为Command1的命令按钮。运行后的窗体外观如图所示。设有如下的类型和变量声明:PrivateTypePersonnameAsString*8majorAsString
随机试题
在Excel2003中,下列取值相同的表达式是__________。()
患者,男,36岁,因半年来右下第一磨牙咬合面深龋洞不能咬物而就诊。一周前已做一次垫底银汞充填,一天前出现自发痛,冷热痛持续,不能咬物。查:右下第一磨牙咬合面充填体完整,叩痛(+),冷测引起剧痛。
( )是规定要求已得到满足的客观证据的认证和提供。
500kV架空电力线路与VHF(I)频段电视差转台、转播台间的防护间距不应小于()。
()是评估无形资产使用频率最高的方法。
2,4,12,48,240,()
科学家在100亿光年外的星系里发现一颗超亮超新星,其爆发于宇宙大爆炸后约35亿年,正值天文学家所称的“宇宙正午”时期。普通超新星是大质量恒星死亡时发生剧烈爆炸产生的。超亮超新星的亮度比普通超新星高10到100倍,目前还不太清楚其形成机制。以往发现的超亮超新
随着社会现代化程度的不断提高、社会化分工日益精细,人与人之间的依赖程度也越来越高,人们的生活重心正逐渐由工作单位向社区转移。而就本质而言,人与人之间的互动关系构成了社区生活的主要内容。以下哪项,从上述题干中推出最为恰当?
从一组7个人——J,K,L,M,N,P和Q中恰好选出4个去参加某外交官的退休宴会。对出席人员的选择必须遵循以下条件:要么J被选,要么K被选,但两人不能同时被选;要么N被选,要么P被选,但两人不能同时被选;若N被选时,L肯定被选;
设D是由曲线y=sinx+1与三条直线x=0,x=π,y=0所围成的曲边梯形,求D绕x轴旋转一周所围成的旋转体的体积.
最新回复
(
0
)