首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
设在工程中有一个标准模块,并定义了如下类型: 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
2019-06-11
79
问题
设在工程中有一个标准模块,并定义了如下类型:
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
Dimrecord_no As Integer
record_no=1
With student
.ino=12:.stmame="smith":
.strsex="男":.smark=89
End With
Open"c:\Studont.dat"For Input As #1 Len
=Len(Student)
Put #1,record_no Student
Close#1
End Sub
B、Sub Command 1_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 Random As#1
Len=Len(Student)
Put#1,Record_no,Student
Close #1
End Sub
C、Private Sub Command 1_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 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
EndWith
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/gyUp777K
本试题收录于:
二级VB题库NCRE全国计算机二级分类
0
二级VB
NCRE全国计算机二级
相关试题推荐
要将单选按钮Opt1设为被选中,应设置的属性是
假设用复制、粘贴的方法建立了一个命令按钮数组Command1,以下对该数组的说法错误的是()。
在窗体上有2个图片框,名称分别为Picture1和Picture2,Picture2中添加了香蕉图片(见图3),且将Picture2.DragMode属性设置为1。要求程序运行时,可以用鼠标把Picture2拖拽到Picture1中(见图4)。以下可以实现
下列叙述中有错误的是()。
设:a=12,b=5,c=7,表达式x=(a\c+aModb)+Int(13/5)的值是
表达式12/2\4的值是
能够产生1到50之间(含1和50)随机整数的表达式是
设a=2,b=3,c=4,d=5,下列表达式的值是()。3>2*bOra=cAndb<>cOrb<>a+c
随机试题
女性,30岁,间断尿频、尿痛、尿急1年,尿沉渣白细胞30—50/HP,但多次尿培养检查均无细菌生长,最可能是患
关于焦点的MTF叙述正确的是
《出入境检验检疫机构实施检验检疫的进出境商品目录》中检验检疫类别代码对应正确的有( )。
在不涉及补价的情况下,下列各项交易事项中,属于非货币性资产交换的是()。(2015年改编)
节俭属于性格的()特征。
A、 B、 C、 D、 D分析左边纸板,发现进行折叠后,只有D项是正确的。
修整一条水渠,原计划由16人修,每天工作7.5h,6天可以完成任务.由于特殊原因,现要求4天完成,为此又增加了2人,现在每天要工作的时间为[]h.
TheComplexitiesofReadingThislectureisthefirstofsixof"TheMysteriesofReadingandWriting".Wetendtothinkt
PresidentBarackObama’spicktoheadtheEnvironmentalProtectionAgency(EPA),LisaJackson,hasspent20yearsasanenvironme
Thismethodwasnever___________(被利用过).
最新回复
(
0
)