首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
现有如下程序: 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-10-23
37
问题
现有如下程序:
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/3WLp777K
本试题收录于:
二级VB题库NCRE全国计算机二级分类
0
二级VB
NCRE全国计算机二级
相关试题推荐
下列程序的执行结果是上______。t=0m=1Sam=0Dot=t+mSum=Sum+tm=m+2LoopWhilem<=9PrintSum
下面四个语句中,输出逻辑为“真”的是()。
下列关于闲置循环的四个叙述中,错误的是()。
下面关于对象概念的描述中,错误的是
设已经在窗体上添加了一个通用对话框控件CommonDialogl,以下正确的语句是()。
如果准备读文件,打开顺序文件"text.dat"的正确语句是
使图像(Image)控件中的图像自动适宜控件的大小需要
有下面一个程序段,从文本框中输人数据,如果该数据满足条件“除以4余1,除以5余2”,则输出,否则,将焦点定位在文本框中,并清除文本框的内容。PrivateSubCommandl_Click()x=Val(Text1.Text)
假定在工程文件中有一个标准模块,其中定义了如下记录类型:TypeBooksNameAsString*10TelNumAsString*20EndType要求在执行事件过程Command1_Click时,在顺序文件Person.txt中
某二叉树中度为2的结点有n个,则该二叉树中有【】个叶子结点。
随机试题
会计最基本的职能是()。
作为传统组织理论和管理理论的汇集者,法约尔提出了计划、协调、控制、预算等组织管理七要素。
A.缺铁性贫血B.巨幼细胞性贫血C.溶血性贫血D.铁粒幼细胞性贫血E.再生障碍性贫血网织红细胞计数减低的是
修复体粘固后患牙长时间持续疼痛,最可能
下述哪种表现不是血栓闭塞性脉管炎的特点
做尿糖定量检查的尿标本,容器中应加入的防腐剂是()
(2017年)某法院推行办案责任制后,直接由独任法官、合议庭裁判的案件比例达到99.9%,提交审委会讨论的案件仅占0.1%。对此,下列说法正确的是:()
某隔板絮凝池设计流量为50000m3/d,絮凝池总水头损失为0.29m。水厂自用水量按照5%计,水的密度ρ水=1.00g/cm3,水的动力黏滞系数μ=1.0×10-3Pa.s;测得的絮凝池总的速度梯度G为20s-1,则絮凝池的有效容积为()m3。
投资者以市价申报的方式参与科创板股票交易,不包括以下()。
现有A、B两个互斥项目,A项目的净现值为50万元,年限为4年;B项目的净现值为60万元,年限为6年。假设折现率为10%,在用共同年限法(用最小公倍数法确定共同年限)确定两个项目的优劣时,下列说法中正确的有()。
最新回复
(
0
)