首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有下面的函数过程: Private Function fun(str As String, ch As String) As Integer n = 0 For k = 1 To Len(str) If Mid(str, k
有下面的函数过程: Private Function fun(str As String, ch As String) As Integer n = 0 For k = 1 To Len(str) If Mid(str, k
admin
2019-01-17
28
问题
有下面的函数过程:
Private Function fun(str As String, ch As String) As Integer
n = 0
For k = 1 To Len(str)
If Mid(str, k, 1) = ch Then
n = n + 1
End If
Next k
fun = n
End Function
此函数返回的是
选项
A、字符ch在字符串str中第一次出现的位置
B、字符ch在字符串str中出现的次数
C、字符ch在字符串str中最后一次出现的位置
D、以上都是错误的
答案
B
解析
字符串函数Len(str)返回字符串str长度;Mid(str, k, 1)表示从第K个字符开始向后截取一个字符,并与字符ch进行比较,若表达式返回True,则n的值加1,题目中函数返回n的值为字符ch在字符串str中出现的次数。故正确答案为选项B。
转载请注明原文地址:https://kaotiyun.com/show/1gFp777K
本试题收录于:
二级VB题库NCRE全国计算机二级分类
0
二级VB
NCRE全国计算机二级
相关试题推荐
有下面程序代码:PrivateSubCommand1_Click()a=3s=0Fork=1To5s=s+aModka=a+kNext
有下面事件过程:PrivateSubForm_MouseMove(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSi
数据库设计过程不包括
编写如下程序:PrivateSubCommand1_Click()DimnAsLong,sAsStringn=InputBox("输入一个数")DoWhilen0Printn\10
下列关于滚动条的叙述中,错误的是
在窗体上画一个文本框(名称为Text1)和一个标签(名称为Label1),程序运行后,在文本框中每输入一个字符,都会立即在标签中显示文本框中字符的个数。以下可以实现上述操作的事件过程是( )。
下列关于利用通用对话框产生的文件对话框的相关属性的描述中,错误的是( )。
为了显示弹出式菜单,要使用
按照下表建立菜单:单击菜单的事件过程如下:PrivateSubmnu1_Click(IndexAsInteger)SelectCaseIndexCase1Print"选中菜单项1"Case2IfMnu
把数学表达式2y—b表示为正确的VB表达似乎应该是
随机试题
A.肾结核病灶清除术B.肾部分切除术C.肾切除术D.乙状结肠膀胱扩大术E.输尿管皮肤造口术男性不育患者,30岁,腹部平片示左肾钙化,排泄性尿路造影左肾不显影,右肾功能正常。应行()
患者,男性,35岁,青藏高原工作5年,体检发现Hct明显增高。为得到满意结果,制备血涂片时应注意
洋地黄中毒所致的室性心动过速忌用()
月经周期长短取决于
肿瘤患者最常见的发热类型是
甲公司为上市公司,2015年有关资料如下:(1)甲公司2015年初的递延所得税资产借方余额为140万元,递延所得税负债贷方余额为10万元,具体构成如下:(2)甲公司2015年度实现的利润总额为1500万元。2015年度相关交易或事项资料如下:①
关于内部控制评价的观点,以下说法错误的有()。
个体执行任务时追求成功的内在驱动力称为()
我国政治体制改革的基本原则有
A、Agriculturalproducts.B、Fisheriesproducts.C、Dairyproducts.D、Alloftheabove.C细节题。文中提到:双方的免税或者低关税协议将适用于农产品和鱼类,而乳制品、家禽以及蛋
最新回复
(
0
)