首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
现有如下程序: 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
2015-08-28
26
问题
现有如下程序:
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://kaotiyun.com/show/z6Lp777K
本试题收录于:
二级VB题库NCRE全国计算机二级分类
0
二级VB
NCRE全国计算机二级
相关试题推荐
决定一个窗体有无控制菜单的属性是______。
下列事件过程的功能是:建立一个名为Datal的随机文件,存放角度值及这些角度的正弦函数值和余弦函数值,角度为1,2,3,…,90。请在空白处填入适当的内容,将程序补充完整()。PrivateTypeAngKAsInt
设有语句Open"C:\Test.Dat"ForOutPutAs#1,则下列叙述中错误的是()。
在窗体上画4个文本框,并用这4个文本框建立一个控件数组,名称为Text1(下标从0开始,自左至右顺序增大),然后编者按写如下事件过程:PrivateSubCommand1_Cliek()ForEachTextBoxIn
只能用来显示文本信息的控件是()。
在文本框中输入字符时,通过()事件过程可以得到字符的ASCII码值。
在程序设计阶段,当双击窗体上的某个控件时,所打开的窗口是______。
数据库设计的根本目标是要解决______。
为了把一个记录型变量的内容写入文件中指定的位置,所使用的语句的格式为______。
符号%是声明______类型变量的类型定义符。
随机试题
下列哪种激素的分泌不受腺垂体的控制
肝颈静脉回流征不出现于下列哪种疾病()
充抵保证金的有价证券,在计算保证金金额时应当以证券市值按一定折算率进行折算,其中折算率最高的是()。
公共物品的效率由()组成。
边防工作可以分为()。
马克思主义哲学认为,社会进步具有曲折性和___________。社会的进步是通过_____________实现的。因为____________对于旧势力和反动阶级来说,就意味着被推翻、被打倒、被抛出历史舞台。正因为如此,他们的抵御和反抗是顽固而持久的。这
下列有关数据库的描述,正确的是()。
Whatwastheresearchabout?
Thegameendedafewhoursearly,leavingplayersand______unsatisfied.
Duringsleep,thefatigue(疲劳)ofthebody【S1】______andrecuperation(恢复)begins.Thetiredmindgathersnewenergy.Onceawake,the
最新回复
(
0
)