首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下事件过程: Private Sub Form_Load() Show Dim Arr() As Variant Arr = Array(1, 3, 5, 7, 9, 11, 13, 15) Call converse(
有如下事件过程: Private Sub Form_Load() Show Dim Arr() As Variant Arr = Array(1, 3, 5, 7, 9, 11, 13, 15) Call converse(
admin
2020-07-22
81
问题
有如下事件过程:
Private Sub Form_Load()
Show
Dim Arr() As Variant
Arr = Array(1, 3, 5, 7, 9, 11, 13, 15)
Call converse(Arr)
For i = 0 To 7
Print arr(i);
Next i
End Sub
以上程序的功能是,通过调用Converse过程,将数组Arr中的元素逆序存放并输出。过程Converse的正确代码是
选项
A、 Private Sub converse(dim a() as Variant )
Dim T
For i = LBound(A) To UBound(A)
T = a(i)
a(i) = a(UBound(A) - i)
a(UBound(A) - i) = T
Next i
End Sub
B、Private Sub converse(dim a() as Variant)
Dim T
Dim J As Integer
J = (LBound(A) + UBound(A)) / 2
For i = LBound(A) To J
T = a(i)
a(i) = a(UBound(A) - i)
a(UBound(A) - i) = T
Next i
End Sub
C、 Private Sub converse(a() As Variant)
Dim T
For i = LBound(A) To UBound(A)
T = a(i)
a(i) = a(UBound(A) - i)
a(UBound(A) - i) = T
Next i
End Sub
D、 Private Sub converse(a() As Variant)
Dim T
Dim J As Integer
J = Int((LBound(A) + UBound(A)) / 2)
For i = LBound(A) To J
T = a(i)
a(i) = a(UBound(A) - i)
a(UBound(A) - i) = T
Next i
End Sub
答案
D
解析
采用for循环的方式,实现将数组元素逆序排列,判断循环终止的条件为数组A的最小下标和最大下标和的一半,并且定义变量T,作为中间变量用来互换中心对称的元素。故正确答案为选项D。
转载请注明原文地址:https://kaotiyun.com/show/tNHp777K
本试题收录于:
二级VB题库NCRE全国计算机二级分类
0
二级VB
NCRE全国计算机二级
相关试题推荐
在菜单编辑器中建立如下图所示的菜单,并为了每个菜单项编写了鼠标单击事件过程。关于此菜单,以下叙述中错误的是( )。
在窗体上有一个文本框Textl,Text属性值为空,然后编写如下事件过程:PrivateSubTextlKeyPress(KeyAsciiAsInteger)DimstrAsString,nAsInteger
在考生文件夹下有一个工程文件sjt5.vbp,其窗体上面有两个名称分别为Text1、Text2的义本框,其中Textl可多行显示。请画两个名称为Commandl、Command2,标题为“产生数组”、“查找”的命令按钮。如图2.216所示。程序功能如下:
下面程序运行时,若输入"VisualBasicProgramming",则在窗体上输出的是( )。PrivateSubCommand1_Click() Dimcount(25)AsInteger,chAsString ch=U
要清除已经在图片框Picturel中打印的字符串而不清除图片框中的图像,应使用语句()。
设窗体上有一个Command1命令按钮,还有以下程序代码:PrivateSubCommand1_Click()StaticxAsIntegerx=x+1Callproc(x)Printx,E
对于能够获得焦点的控件,若要使其不能接收焦点,应该
窗体上有一个名称为Command1的命令按钮,一个名称为Text1的文本框。编写如下程序:PrivateSubCommand1_Click() DimxAsInteger x=Val(InputBox("输入数据")) Text1=
表达式Str(Len("123"))+Str(77.7)的值是()。
已知:x=-6y=39则表达式"y\x*Sgn(x)"的值为( )。
随机试题
下列适合使用社交界域语的是()。
__________属于房产税征税对象的房屋。
A.一般在产后3~7天出现症状B.又称为股白肿C.最为常见的感染D.产后1~2周内出现弛张热、下腹疼痛和压痛E.在产后7~14天出现症状
国土指一个国家主权管辖之下的陆地和水域。()是一个国家进行经济社会活动的基本条件。
一般资料:男性,25岁,三年级研究生。主诉:一个月来经常失眠,无食欲,常感到浑身无力,对任何活动和事物都不感兴趣,情绪低落,提不起精神。下面的对话是心理治疗片断。请根据对话回答后面的问题。心理咨询师:你说你是个笨蛋,是什么意思呢?是
Americansocietyisnotnap(午睡)friendly.Infact,saysDavidDinges,asleepspecialistattheUniversityofPennsylvaniaScho
以下关于控制结构的描述,错误的是()。
Whatdoesthewomanwantthemantodo?
HeofferedheratriptoAustraliabutshe____him____flat.
Whatisthepurposeofthispassage?ScientistRamOrenisoftheopinionthatcommonbeliefsofthetree’sabilitytoabsorbc
最新回复
(
0
)