首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
设在工程中有一个标准模块,并定义了如下类型: 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
77
问题
设在工程中有一个标准模块,并定义了如下类型:
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全国计算机二级
相关试题推荐
在窗体上画一个名称为Command1的命令按钮,然后编写如下程序代码:DimxAsIntegerPrivateSubMySub()StaticxAsIntegerDimyAsIntegerx=x+10
某二叉树有5个度为2的结点,则该二叉树中的叶子结点数是( )。
窗体上有2个名称分别为Text1和Text2的文本框。编写如下程序:PrivateSubForm_Load()Text1.Text=""Text2.Text=""EndSubPrivateSubCommand1_Cl
以下关于VB文件的叙述中,正确的是
下列工具中,不属于结构化分析的常用工具的是()。
设有窗体的Form_MouseMove事件过程如下:PrivateSubForm_MouseMove(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle) If(Button
下面关于菜单的叙述中正确的是
在考生文件夹下有一个工程文件sjt5.vbp,已给出了所有控件(如图3.62所示)和部分程序。程序运行时,请按以下顺序操作:1)单击“读入文件”按钮,把考生目录下的文件in5.dat中的内容读入内存并显示在上面的文本框(Text1)中;2)单击“加密”
在考生文件夹下有一个工程文件sjt5.vbp。其窗体中有2个标题分别为“读数据”和“查找水仙花数”的命令按钮。请画1个名称为Text1、初始值为空的文本框,该文本框允许显示多行内容,且有垂直滚动条,如图所示。程序功能如下:(1)考生文件
下面不属于软件设计阶段任务的是
随机试题
以下花卉不属于球根花卉的是:
流行性乙型脑炎镜下可见
肝硬化假小叶形成的最主要因素是
继发不孕绝对不孕
A、高侧壁心肌梗死B、前壁心肌梗死C、前侧壁心肌梗死D、内膜下心肌梗死E、下壁心肌梗死窦性心动过缓多见于
在下列投资方案评价指标中,不考虑资金时间价值的指标是()。
人民警察礼貌待人、文明执勤主要体现在()。
一个民族的生命基因,熔铸着文化的力量;一个民族前进的每一行足印,都闪耀着文化的光芒;一个民族的兴衰存亡,说到底是文化的兴衰存亡。当今世界各国,除了经济、科技、军事力量等“硬实力”的比拼,文化软实力的竞争也日趋激烈,因为文化愈来愈成为民族凝聚力和创造力的重要
现有的数据处理和声音通信的信息网一般采用(36)。
A、Themanwasquiteallright.B、Thewomanwaslateforcoming.C、Thewomanaskedthemantowait.D、Themanwasannoyedbyher
最新回复
(
0
)