首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
设在工程中有一个标准模块,并定义了如下类型: 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
90
问题
设在工程中有一个标准模块,并定义了如下类型:
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://kaotiyun.com/show/gcHp777K
本试题收录于:
二级VB题库NCRE全国计算机二级分类
0
二级VB
NCRE全国计算机二级
相关试题推荐
设窗体上有1个水平滚动条,已经通过属性窗口把它的Max属性设置为1,Min属性设置为100。下面叙述中正确的是
有如下程序:PrivateSubForm_Click()DimsAsInteger,pAsIntegerp=1Fori=1To4Forj
窗体上有1个名称为Command1的命令按钮,事件过程如下:PrivateSubCommand1_Click()Dimarr_x(5,5)AsIntegerFori=1To3Forj=2To4arr_x(i,j)=i*jNextj
下列关于栈叙述正确的是
在软件设计中,不属于过程设计工具的是
在考生文件夹中有一个工程文件sjt5.vbp。窗体外观如图3—169所示。运行程序,单击“读数据”按钮,文件中的数据被读入字符串变量中并显示在Labe12标签中。单击“排序”按钮时,对读入的数据从小到大排序,并将排序结果显示在窗体的Labe14控件中。要求
在考生文件夹下有一个数据库文件“samp3.accdb”,其中存在已经设计好的表对象“tAddr”和“tUser”。同时还有窗体对象“fEdit”和“fEuser”。请在此基础上按照以下要求补充“fEdit”窗体的设计。(1)将窗体中名称为“Lr
关系的实体完整性要求关系中不能为空的属性是()。
设a=2,b=3,c=4,d=5,表达式Nota<=cOr4*c=b^2Andb<>a+c的值是
软件测试用例包括()。
随机试题
动物咬伤后伤口的处理方法哪些是正确的
与苏木精发生亲和的是()
A.CRT显示器B.2MP显示器C.2K显示器D.平板式显示器E.16:9的宽屏显示器按照显示荧光屏可显示像素数量分类的是
糖尿病病人失明的主要原因为()
患者,女,45岁。心悸,多汗,消瘦2月,甲状腺轻度肿大,心率100次/分,基础代谢率30%,血清甲状腺素为18μg/dl(正常4~11μg]dl)。初治阶段应选用药物及剂量为()。
进度控制工作流程不包括()。
关于建筑工程施工许可的说法正确的有()。
Rome,June13—Alawthatimposesstrictrulesonassistedfertilitywillremainonthebooks,afterthefailureonMondayofah
地球上最热的地方在哪里?许多人认为是赤道地区。其实,最热的地方并不在赤道。世界上有许多地方,像中国的塔克拉玛干沙漠、非洲的撒哈拉大沙漠等,白天的最高温度都超过了45℃;而赤道地区,尽管阳光的照射很强烈,但白天气温很少超过35℃。这是因为赤道附近大
【B1】【B4】
最新回复
(
0
)