首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
设在工程中有一个标准模块,并定义了如下类型: Type Stutype ino As Integer strname As String*20 strsex As String*2 smark As Single
设在工程中有一个标准模块,并定义了如下类型: Type Stutype ino As Integer strname As String*20 strsex As String*2 smark As Single
admin
2020-07-22
74
问题
设在工程中有一个标准模块,并定义了如下类型:
Type Stutype
ino As Integer
strname As String*20
strsex As String*2
smark As Single
End Type
在窗体上画一个名为Command1的命令按钮,要求当执行事件过程Command1_Click时,在C盘根目录下的随机文件Student.dat中写入一条记录。下列能够完成该操作的是( )。
选项
A、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 Input As #1 Len
=Len(Student)
Put #1,record_no,Student
Close #1
End Sub
B、Sub CommandI_Click()
Dim Student As Stutype
Dim Record_no As Integer
Record no=1
With Student
Ano=12:.strname="smith"
.strsex="男":.smark=89
EndWith
Open"c:\student.dat"ForRandomAs #1
Len=Len(Student)
Put #1,Record no,Student
Close #1
End Sub
C、Private Sub Command1_Click()
Dim Student As Smtype
Dim Record_no As Integer
Record_no=1
With Student
.ino=12:.strname="smith"
.strsex="男":.smark=89
EndWith
Open"c:\student.dat"For Random As 1
Len=Len(Student)
Write #1,Record_no,Student
Close #1
End Sub
D、Sub Command1_Click()
Dim Student As Stutype
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,Student
Close #1
End Sub
答案
B
解析
本题考查文件操作。题目中要求以随机的方式(Random)打开一个文件,打开文件的方法格式为:Open FileName For Random As #文件号[Len=记录长度],然后以Put方法写入一条记录,方法的格式为:Put[#]文件号,[记录号],变量名。
转载请注明原文地址:https://www.kaotiyun.com/show/gcHp777K
本试题收录于:
二级VB题库NCRE全国计算机二级分类
0
二级VB
NCRE全国计算机二级
相关试题推荐
假定有如下语句:answer$=MsgBox("String1",,"String2","String3",2)执行该语句后,将显示一个信息框,单击其中的“确定”按钮,则answer$的值为
两个或两个以上模块之间关联的紧密程度称为
窗体上有一个名称为Text1的文本框,一个名称为Command1的命令按钮。命令按钮的单击事件过程如下:PrivateSubCommand1_Click()Dimx1AsInteger,x2AsInteger,x3AsInteger
在窗体上画一个名称为Commandl的命令按钮,并编写如下程序:OptionBase1PrivateSubCommandl_Click()Dima(4,4)Fori=1To4
设在一个工程的窗体中有如下代码:PublicxAsIntegerPrivateSubForm_Load()DimYAsIntegerEndSub在该工程的标准模块的声明部分有代码:PublicaAsInteger:P
下列叙述中正确的是
设窗体上有一个列表框控件List1,含有若干列表项。以下能表示当前被选中的列表项内容的是
顺序文件在一次打开期间
在考生文件夹下有一个工程文件sjt5.vbp。程序运行时,单击“装人数据”按钮,则从考生文件夹下的in5.txt文件中读入所有城市名称和距离,城市名称按顺序添加到列表框List1中,距离放到数组a中;当选中列表框中的一个城市时,它的距离就在Text1中显示
下面对软件测试描述错误的是()。
随机试题
组织结构设计的核心是()。
世界上的事物千差万别的原因是()
21世纪人人享有卫生保健的总体目标不包括
《支付结算办法》规定,票据金额以中文大写和阿拉伯数字同时记载,二者不一致的()。
已知市场组合的期望收益率为15%,无风险收益率为5%。某项金融资产的β值为0.5,则该项金融资产的期望收益率为()。
机动车交通事故责任强制保险与商业三责险的区别是()。
把下面六个图形分为两类,使得每一类图形都有各自的共同特征或规律,分类正确的一项是:
设实二次型f(x1,x2,x3)=(x1一x2+x3)2+(x2+x3)2+(x1+ax3)2,其中a是参数•(I)求f(x1,x2,x3)=0的解;(Ⅱ)求f(x1,x2,x3)的规范形.
If2x=3y=4z=20,then12xyz=
It’ssaidthemostexcitingkindofeducationisalsothemostpersonal.Nothingcan【C1】______thejoyofdiscoveringsomethin
最新回复
(
0
)