首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
设在工程中有一个标准模块,并定义了如下类型: 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
64
问题
设在工程中有一个标准模块,并定义了如下类型:
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全国计算机二级
相关试题推荐
(1)在考生文件夹中有工程文件sjt3.vbp,其中的窗体如图4所示。程序刚运行时,会生成一个有10个元素的整型数组。若选中“查找最大值"(或“查找最小值”)单选按钮,再单击“查找”按钮,则找出数组中的最大值(或最小值),并显示在标签Label2中。
语句:PrintInt(Rnd*5+20)的输出不可能是
设有如下程序:PrivateSubsV(ByValmAsInteger,nAsInteger)m=m*2n=n-5Printm;nEndSubPrivateSubForm_Cli
下列叙述中,不属于软件需求规格说明书的作用的是()。
某二叉树共有12个结点,其中叶子结点只有1个。则该二叉树的深度为(根结点在第1层)
以下关于控件数组的叙述中,正确的是( )。
已知:x=-6y=39则表达式"y\x*Sgn(x)"的值为( )。
定义学生选修课程的关系模式如下:S(S#,Sn,Sd,Sa)(其属性分别为学号、姓名、所在系、年龄);C(C#,Cn,P#)(其属性分别为课程号、课程名、先选课);SC(S#,C#,G)(其属性分别学号、课号和成绩)。检索选修课程名为“操作系统”的
一棵二叉树中共有80个叶子结点与70个度为1的结点,则该二叉树中的总结点数为
一棵二叉树共有25个结点,其中5个是叶子结点,则度为1的结点数为( )。
随机试题
我们应当确立的科学的、高尚的人生目的是
Access2003数据库中的“列标题的名称”叫做字段。()
"增水行舟"之剂为"逆流挽舟"之剂为
表示数据的相对离散波动程度的离散程度特征值是( )。
每一笔证券回购交易涉及两个交易主体、二次交易契约行为。()
李某和张某是好朋友,李某在张某的推荐下,在甲商场购买了乙公司生产的健身器材。购后第二天李某健身时,因健身器材的质量问题导致腿部被严重砸伤,经丙医院及时治疗后仍留下轻微残疾。根据以上资料,回答下列问题。李某主张权利的途径可以是()。
王某为某县劳动与社会保障局的一名科长,因违纪受到降级处分。下列哪种说法符合《中华人民共和国公务员法》的规定?
嵌入式系统对软件可移植性要求较高,为提高软件可移植性,应________________。
Peopleplayitintheopenair.Peoplecanbuyfoodandothergoodsthere.
【S1】【S7】
最新回复
(
0
)