设有如下通用过程: Public Function Fun(xStr As String)As String Dim tStr As String.strL As Integer tStr="" strL=Len(xStr)i=1

admin2018-10-15  28

问题 设有如下通用过程:
Public Function Fun(xStr As String)As String
    Dim tStr As String.strL As Integer tStr=""
    strL=Len(xStr)i=1
    Do While i<=strL/2
       tStr=tStr&Mid(xStr,i,1)&Mid(xStr,strL-i+1,1)
       i=i+1
    Loop
    Fun=tStr
    End Function
    在窗体上画一个名称为Commandl的命令按钮。然后编写如下的事件过程:
    Private Sub Command1_Click()
    Dim S1 As String
    S1=”abcdef”:Print UCase(Fun(S1))
    End Sub
    程序运行后,单击命令按钮,输出结果是

选项 A、ABCDEF
B、abcdef
C、AFBECD
D、DEFABC

答案C

解析 本题通用过程的功能是:从字符串变量xStr值的左右两端同时开始,由外向里每次取出两个字符(左右各一个),组成一个新的字符串。
    本题程序运行后,当调用通用过程函数Fun后,返回值应为“afbecd”,转换为大写后在文本框中的显示结果为“AFBECD”。
转载请注明原文地址:https://jikaoti.com/ti/vym0FFFM
0

最新回复(0)