在窗体上画一个命令按钮,然后编写如下代码: Private Type Record ID As Integer Name As String *20 End Type Private Sub Command1_Click() Dim Maxsize, NextChar, MyChar Open "d:\temp\female.txt" For Input As #1 Maxsize = LOF(1) For NextChar = Maxsize To 1 Step -1 Seek #1, NextChar MyChar = Input(1, #1) Next NextChar Print EOF(I) Close 31 End Sub 程序运行后,单击命令按钮,其输出的结果为
A.True
B.False
C.0
D.Null
第1题:
在窗体上画一个命令按钮和一个文本框,并将窗体的KeyPreview属性设置为True,然后编写如下代码: Dim SaveAll As String Private Sub Form_Load() Show Text1.Text=" " Text1.SetFocus End Sub Private Sub Command1_Click() Text1.Text = Ucase(SaveAll) End Sub Private Sub Form_KeyPress(KeyAscii As Integer) SaveAll=SaveAll+Chr(KeyAscii) End Sub 程序运行后,在键盘上输入abcdefg,单击命令按钮,则文本框中显示的内容为
A.abcdefg
B.不显示任何信息
C.ABCDEFG
D.出错
第2题:
在窗体上画一个命令按钮,然后编写如下程序: Private Sub Command1_Click() Dim a As Integer, b As integer b = 1 For a = 1 To 100 If b >= 10 Then Exit For If b Mod 3 = 1 Then b = b + 3 End If Next a Print a End Sub 在命令按钮上单击后,窗体上显示的结果是 ______。
A.101
B.6
C.5
D.4
第3题:
在窗体上画一个名称为Command1命令按钮,然后编写如下事件过程: Private Function fun1(n As Integer)As Integer Dim k As Integer If n = 1 Then k = 1 Else k = 1 + fun1(n - 1)* 2 End If fun1 = k End Function Private Sub Command1_Click () Dim m As Integer, x As Integer x = 4 m = fun1 (x) Print m End Sub 程序运行后,单击命令按钮,则窗体上显示的内容是
A.4
B.6
C.9
D.15
第4题:
在窗体上画一个命令按钮(名称为Command1),然后编写如下事件过程: Private Sub Command1_Click() Dim b As Integer b=b+1 End Sub 运行程序,三次单击命令按钮后,变量b的值是: ______。
A.0
B.1
C.2
D.3
第5题:
设在工程文件中有—个标准模块,其中定义了如下记录类型:Type Books Name As String *10 TelNum As String*20End Type在窗体上画—个名为Command1的命令按钮,要求当执行事件过程Command1_Click时,在顺序文件Petson.txt中写入一条Books类型的记录。下列能够完成该操作的事件过程是 ______。
A.Private Sub Command1_ Click() Dim B As Books Open "Person.txt" For Output As #1 B. Name=InputBox(“输入姓名”) B. TelNum=InputBox(“输入电话号码”) Write #1, B. Name, B. TelNum Close #1End Sub
B.Private Sub Command1_ Click() Dim B As Books Open "Person.txt" For Input As #1 B. Name=InputBox(“输入姓名”) B.TelNum=InputBox(“输入电话号码”). Print #1, B. Name, B.TelNum Close #1End Sub
C.Private Sub Command1_Click() Dim B As Books Open "Person.txt" For Output As #1 B.Name= InputBox(“输入姓名”) B.TelNum=InputBox(“输入电话号码”) Write #1,B Close #1End Sub
D.Private Sub Command1_ Click() Open "Person. txt" For Input As #1 Name=InputBox(“输入姓名”) TelNum=InputBox(“输入电话号码”) Print #1, Name, TelNum Close #1End Sub
第6题:
在窗体上画一个命令按钮,然后编写如下代码: Private Type Record ID As Integer Name As String * 20 End Type Private Sub Command1_Click( ) Dim MaxSize, NextChar, MyChar Open "d:\vb\tt. txt" For Input As #1 MaxSize = LOF(1) For NextChar = MaxSize To 1 Step - 1 Seek # 1, NextChar MyChar = Input(1, # 1) Next NextChar Print EOF(1) Close $1 End Sub 假设文件d:\vb\tt. txt 的内容为 Hello eveybody! 那么程序运行后,单击命令按钮,其输出结果为 ______。
A.True
B.False
C.0
D.Null
第7题:
在窗体上画一个按钮,然后编写如下的事件代码。在按钮上单击,输出为( )。 Private Sub fun() Static a As Integer a=a+2 Print a; End Sub Private Sub Command1_Click() Dim m As Integer For m=1 To 3 Call fun Next m End Sub
A.2 2 2
B.0 0 0
C.2 4 8
D.2 4 6
第8题:
在窗体上画一个命令按钮,然后编写如下代码: Private Type Record ID As Integer Name As String*20 End Type Private Sub Command1_Click() Dim MaxSize.NextChar,MyChar Open"D:\temp\female.txt"For Input As #1 MaxSize=LOF(1) For NextChar=1 To MaxSize Seek#1,NextChar MyChar=Input(1,#1) Next NextChar Print EOF(1) Close #1 End Sub 程序运行后,单击命令按钮,其输出结果为 ______。
A.True
B.False
C.0
D.Null
第9题:
在窗体上画一个命令按钮,然后编写如下代码: Private Type Record ID As Integer Name As String * 20 End Type Private Sub Command1_Click() Dim MaxSize,NextChar,MyChar Open"D:\temp\female.txt"For Input As # 1 Max Size=LOF(1) For Next Char=1 To MaxSize Seek # 1,NextChar MyChar=Input(1,# 1) Next NextChar Print EOF(1) Close # 1 End Sub 程序运行后,单击命令按钮,其输出结果为 ______。
A.True
B.False
C.0
D.Null
第10题:
在窗体上画一个名称为Command1的命令按钮,然后编写如下事件过程: Private Sub sub1(ByVal x As Integer, ByVal y As Integer, ByVal z As Integer) z=x * x+ y * y End Sub Private Sub Command1_Click() Dim a As Integer a = 8 Call sub1(1, 2,A)Print a End Sub 程序运行后,单击命令按钮,则窗体上显示的内容是
A.8
B.2
C.5
D.11
第11题:
在窗体上画一个命令按钮,然后编写如下程序 Private Sub Command1_Click( ) Dim a As Integer,b As hiteger a=1 b=2 Print N(a,B)End Sub Function N(x As Integer,y As Integer)As Integer N=IIf(x>y,x,y) End Function 程序运行后,单击命令按钮,输出结果为
A.1
B.2
C.5
D.8
第12题:
窗体上画一个命令按钮,然后编写如下代码:Private Type Record ID As Integer Name As String * 20End TypePrivate Sub command1 _ Click( Open "c: \file. txt" for Input As MaxSize = LOF (1) for NextChar =MaxSize To Step-1 Seek #1, NextChar MyChar=Input(1,#1) Next NextChar Print EOF(1) Close #1 End Sub程序运行后,单击命令按钮,其输出结果为______。
A.True
B.False
C.0
D.Null
第13题:
在窗体上添加一个命令按钮(名为Command1),然后编写如下程序:
Private Sub Command1_Click()
Dim a As Integer,b As Integer
x=10
y=20
End Sub
打开窗体运行后,单击命令按钮,消息框的输出结果为( )。
第14题:
设在工程中有一个标准模块,其中定义了如下类型: Type stutype ino As Integer strname As String*20 strsex As String*1 smark As Single End Type 在窗体上画一个名为Connnand1的命令按钮,要求当执行事件过程Command1_Click时,在c:\的随机文件student..dat写入一条记录。下列能够完成该操作的事件过程是( )。
A.Sub Command1_C1ick() Dim student As studtype Dim record_no As Integer record_no=1 With student .ino=12 .strname="smith" .strsex="男" .smark=89 End With Open" c:\student.dat" For input As # 1 len=len(student) Put # 1,record_
B.Sub Command1_Click( ) Dim student As studtype Dim record_no As Integer record_no=1 With student .ino=12 .strname="smith" .strsex="男" .smark=89 End With Open"c:\student.dat" For random As #1 len=len(student) Put #1,record_n
C.Sub Command1_Click() Dim student As studtype Dim record_no As integer record_no=1 With student .ino=12 .stmame="smith" .strsex="男" .smark=89 End With Open"c:\student.dat" For random As #1 len=len(student) Write #1,record_n
D.Sub Command1_Click() Dim Student As studtype Dim Record_no As Integer record_no=1 With student .ino=12 .strname="smith" .strsex="男" .smark=89 End With Open"c:\student.dat"For output As #1 len=len(student) Put #1,record_no,
第15题:
在窗体上画一个命令按钮,然后编写如下代码:
Private Type Record
R_ID As Integer
R_Name As String * 20
Ene Type
Private Sub Commandl_Click( )
Dim M _Sise, N_Char, M_Char
Open" c: \file. txt" For Input As 1
M_sise=LOF(1)
For N_Char = M_Sise To 1 Step - 1
Seek1, Next Char
M_char = Input(1 ,1)
Next
Print EOF(1)
Close1
End Sub
程序运行后,单击命令按钮,其输出结果为【 】。
第16题:
设在工程中有一个标准模块,其中定义了如下记录类型: TyPe Record ID A3 Integer Name As String*20 End TyPe 在窗体中添加一个名为Command1的命令按钮,假设d:\F1.dat文件中含有5个用户自定义类型的记录。要求当执行事件过程Command1_Click时,随机访问该文件,并把文件中的第4条记录读出。下列能够完成该操作的程序段是
A.Private Sub Command1_Click( ) Dim MyRecord As Record,Position Open"d:\F1.dat"For Random As#1 Len=Len(My RecorD)Position=4 Get#1,Position,Myrecord Close #1 End Sub
B.Private Sub Command1_Click( ) Dim MyRecord As Record,Position Open"d:\F1.dat"For Random As #1 Len=Len(MyRecorD)Position=4 Put #1,Position,MyRecord Close#1 End Sub
C.Private Sub Command1_Click( ) Dim MyRecord As Record,Position Open"d:\F1.dar"For OutPut As #1 Len=Len(My RecorD0Position=4 Get #1,Position,MyRecord Close#1 End Sub
D.Private Sub Command1_Click( ) Dim MyRecord As record,Position Open"d:\F1.dat"For lnput As #1 Len=Len(MyRecorD)Position=4 Get #1,Position,MyRecord Close#1 End Sub
第17题:
在窗体上画一个命令按钮和一个文本框,并把窗体的KeyPreview属性设置为True,然后编写如下代码: Dim SaveAll As String Private Sub Command1_Click() Text1.Text=UCase(SaveAll) End Sub Private Sub Form_KeyPress(KeyAscii As Integer) SaveAll=SaveAll+Chr(KeyAseii) End Sub 程序运行后,在键盘上输入“abcdefg”,单击命令按钮,则文本框中显示的内容为 ______ 。
A.abcdefg
B.不显示任何信息
C.ABCDEFG
D.出错
第18题:
设在工程中有一个标准模块,其中定义了如下记录类型Type Books Name As String *10 TelNum As String *20End Type在窗体上画一个名为Command1的命令按钮,要求当执行事件过程Command1_ Click时,在顺序文件Person.txt中写入一条记录。下列能够完成该操作的事件过程是______。
A.Private Sub Command1_Click() Dim B As Books Open "c:\Person.txt" For Output As #1 B.Name=InpuBox(“输入姓名”) B.TelNum=InputBox(“输入电话号码”) Write #1,B.Name,B.TelNum Close #1End Sub
B.Private Sub Command1_ Click() Dim B As Books Open "c:\Person.txt" For Input As #1 B.Name=InputBox(“输入姓名”) B.teLNum=InputBox(“输入电话号码”) Ptint #1,B.Name,B.TelNum Close #1End Sub
C.Private Sub Command1_ Click() Dim B As Books Open "c:\Person.txt" For Output As #1 B.Name=InputBox(“输入姓名”) B.TelNum=InputBox(“输入电话号码”) Write #1,B Close #1End Sub
D.Private Sub Command1_ Click() Dim B As Books Open "c:\Person.txT" For Input As #1 Name=InputBox(“输入姓名”) TelNum=InputBox(“输入电话号码”) Print #1 Name. TelNum Close #1End Sub
第19题:
已知c:\1.txt是一个非空文件,其程序代码如下。 Private Sub Command1_Click() Dim MaxSize,NextChar,MyChat Open"c:\1.txt"For Input As#1 MaxSize=LOF(1) For NextChar=MaxSize To 1 Step-1 Seek #1,NextChar MyChar=Input(1,#1) Next NextChar Print EOF(1) Close #1 End Sub 程序运行后,单击命令按钮,其输出结果为______。
A.True
B.Null
C.0
D.False
第20题:
在窗体上画一个命令按钮,名称为Command1。然后编写如下程序: Private Sub Command1_Click() Dim a As Integer,b As Integer,c As Integer If a=0 Then x=x-1 Else If b<>0 Then End If End If If c<>0 Then x=3 Else x=4 End If Print x End Sub 程序运行后,单击命令按钮,其输出结果为 ______。
A.34
B.4
C.35
D.3
第21题:
在窗体上画一个名称为Command1的命令按钮,然后编写如下事件过程: Private Sub Command1_Click() Dim x(5)As String Dim n AS Integer For n : 4 TO 0 Step -1 x(n)= n + 1 Print x(n); Next n End Sub 程序运行后,单击命令按钮,则窗体上显示的内容是
A.54321
B.4
C.54321
D.0
第22题:
设在工程中有一个标准模块,其中定义了如下记录类型 Type Books Name As String* 10 TelNum As String * 20 End Type 在窗体上画一个名为 Command1的命令按钮,要求当执行事件过程Command1 Click时, 在顺序文件Person.txt中写入一条记录。 下列能够完成该操作的事件过程是 ______。
A.Private Sub Command1_Click( ) Dim B As Books Open "c:\Person.txt" For Output As #1 B.Name = InputBox("输入姓名") B.TelNum = InputBox("输入电话号码") Write #1, B.Name, B.TelNum
B.Private Sub Command1_Click( ) Dim B As Books Open "c:\Person.txt, For Input As # 1 B.Name = lnputBox("输入姓名") B.TelNum = InputBox("输入电话号码") Print #1, B.Name, B.TelNttm
C.Private Sub Command1_Click( ) Dim B As Books Open "c:\Person.txt" For Output As #1 B.Name = InputBox("输入姓名") B.TelNum = InputBox("输入电话号码") Write # 1, B Close #
D.Private Sub Command1_Click( ) Dim B As Books Open"c:\Person.txt" For Input As #1 Name=InputBox("输入姓名") TelNum=InputBox("输入电话号码") Print #1,Name,TelNum Close #1 End Sub
第23题:
在窗体上画一个命令按钮,名称为Command1。然后编写如下程序: Private Sub Command1_Click() Dim a As Integer,b As Integer,c As Integer If a=0 Then x=x-1 Else If b<>0 Then End If End If If c<>0 Then x=3 Else x=4 End If Print x End Sub程序运行后,如果单击命令按钮,则在窗体上显示的内容是( )。
A.34
B.4
C.35
D.3