首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
设在工程中有一个标准模块,并定义了如下类型: Type Stutype ino As Integer stmame As String*20 strsex As String*2 smark As Single
设在工程中有一个标准模块,并定义了如下类型: Type Stutype ino As Integer stmame As String*20 strsex As String*2 smark As Single
admin
2020-07-22
66
问题
设在工程中有一个标准模块,并定义了如下类型:
Type Stutype
ino As Integer
stmame 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:.stmame="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 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 RandomAs As#1
Len=Len(Student)
put#1,Record_no,Student
Close#1
End Sub
C、Private Sub Command1_Click()
DimStudent As Stutype
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_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:.stmame="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 FileNamn For Random As#文件号[Len=记录长度],然后以Put方法写入一条记录,方法的格式为:Put[#]文件号,[记录号],变量名。
转载请注明原文地址:https://kaotiyun.com/show/0fHp777K
本试题收录于:
二级VB题库NCRE全国计算机二级分类
0
二级VB
NCRE全国计算机二级
相关试题推荐
一般情况下,当对关系R和S进行自然连接时,要求R和S含有一个或者多个共有的
有如下函数过程:Functionrl(xAsInteger)AsLongDimSAsLong,iAsIntegerS=0Fori=1Toxs=s+iNextif
编写如下程序:PrivateSubCommand1_Click()DimnAsLong,sAsStringn=InputBox("输入一个数")DoWhilen0Printn\10
下列可以打开立即窗口的操作是()。
能得到组合框Combo1中最后一个列表项序号的表达式是()。
以下关于VB文件的叙述中,正确的是
下列数组定义语句中错误的是
下列哪一条小属于数据库设计的任务?()
某二叉树共有12个结点,其中叶子结点只有1个。则该二叉树的深度为(根结点在第l层)
在深度为7的满二叉树中,叶子结点的个数为
随机试题
中等卫校毕业生林某,在乡卫生院工作,2000年取得执业助理医师执业证书。他要参加执业医师资格考试,根据《执业医师法》规定,应取得执业助理医师执业证书后,在医疗机构中工作
下列不属于烷化剂结构类型的是()。
建筑企业项目经理资质管理制度向建造师执业资格制度过渡的时间定为( )年。
“鼓”是一个企业运行OPT的开端,即识别一个企业的瓶颈所在。瓶颈控制着企业同步生产的节奏——“鼓点”。要维持企业内部生产的同步、企业生产和市场需求的同步,存在着一系列的问题。()
根据幻觉产生的特殊条件,幻觉又可以分为()。
所有好的乐评人都喜欢迈克在这次演讲中提到的每一个指挥家,虽然道格拉斯是非常优秀的指挥家,但是没有一个好的乐评人喜欢他。根据以上陈述,可以得出以下哪项结论?
Undoubtedly,______winstheelectionisgoingtohaveatoughjobgettingtheeconomybackonitsfeet
(2013年真题)简述法律责任的构成要件。
粮食安全是治国安邦的头等大事,是国家发展的“定海神针”。下列有关粮食安全的表述,错误的是()。
请将文本的第二段设置为2倍间距。
最新回复
(
0
)