首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
设在工程中有一个标准模块,并定义了如下类型: Type Stutype ino As Integer strname As String*20 strsex As String*2 smark As Single End Type 在窗体上画一个名为Com
设在工程中有一个标准模块,并定义了如下类型: Type Stutype ino As Integer strname As String*20 strsex As String*2 smark As Single End Type 在窗体上画一个名为Com
admin
2019-06-20
108
问题
设在工程中有一个标准模块,并定义了如下类型:
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:.stmame="smith"
.strsex="男":.smark=89
End With
Open"c:\Student.dat"For Input As#1Len
=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
EndWith
Open"c:\student.dat"For Random As#1
Len=Len(Student)
Put#1.Record no,Student
Close#1
End Sub
C、Private Sub Command1_Click()
Dim Student As Stutype
Dim Record_no As Integer
Record_no=1
Wim Student
.ino=12:.stmame="smith"
.strsex="男":.smark=89
End Wim
Open"c:\student.dat"For Random As1
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 File Name For Random As撑文件号[Len=记录长度],然后以Put方法写入一条记录,方法的格式为:Put[#]文件号,[记录号],变量名。
转载请注明原文地址:https://www.kaotiyun.com/show/ffUp777K
本试题收录于:
二级VB题库NCRE全国计算机二级分类
0
二级VB
NCRE全国计算机二级
相关试题推荐
函数过程F1的功能是:如果参数a为奇数,则返回值为1,否则返回值为0。以下能正确实现所述功能的代码的是()。
关于MDI窗体下列说法正确的是()。
下面的程序运行时,单击窗体后,窗体上显示的结果是()。PrivateSubForm_Click()Dima(1To6)AsIntegerDimmini%,i%,j%,n%,t%,k%a(1)=8
在软件开发中,需求分析阶段可以使用的工具是
在标准模块中,将a定义为全局整型变量的语句是
结构化程序设计中,下面对goto语句使用描述正确的是
若在窗体模块的声明部分声明了如下自定义类型和数组PrivateTyperecCodeAsInteger:CaptionAsStringEndTypeDimarr(5)Asrec则下面的输出语句中正确的是
(1)在标题为“列表框”、名称为Form1的窗体上添加一个名称为List1的列表框,通过属性窗口输入4个列表项:“数学”、“语文”、“历史”、“地理”,列表项形式采用复选框形式,如图所示。列表框的宽为1100,高不限。注意:存盘时必须存放在考生文
开发软件所需高成本和产品的低质量之间有着尖锐的矛盾,这种现象称做()。
下面的数写成普通十进制数是()。2.65358979335278D-6
随机试题
按冶炼钢时脱氧程度分类,钢材分为_______、_______、_______、_______。
皮肤黏膜出现发绀时,毛细血管血液的还原血红蛋白超过
张某,女性,产后6h主诉腹胀、腹痛。叩诊:耻骨联合上呈鼓音。可能的原因是
室内空气污染物中的甲醛,对健康的影响表现为
价值工程的目的是在满足功能的前提下寻求( )。
电力电缆的选用通常从()方面考虑。
2013年9月7日举行的国际奥运会125次全会上,获得2020年夏季奥运会主办权的城市是()。
忠心耿耿:阳奉阴违
根据“干部教育第一,国民教育第二”的方针,干部教育成为抗日民主根据地教育的重心。下列学校中不是抗日民主根据地中培养高级干部的学校的是
PASSAGEFOURWhatistheadvantageoftheinternetincombatingtrafficking?
最新回复
(
0
)