首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
设在工程中有一个标准模块,并定义了如下类型: 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
35
问题
设在工程中有一个标准模块,并定义了如下类型:
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全国计算机二级
相关试题推荐
能够用于标识对象名称的属性是
有两个关系R和T如下图所示:则由关系R得到关系T的运算是()。
下面描述中错误的是
窗体上有1个名称为Text1的文本框;1个名称为Timerl的计时器控件,其Interval属性值为5000,Enabled属性值是True。Timer1的事件过程如下:PrivateSubTimerl_Timer()StaticflagAs
在下列模式中,能够给出数据库物理存储结构与物理存取方法的是
VB中,若没有显式声明变量的数据类型,则默认的类型是
在VB中,函数过程与子程序过程的区别之一是
可以产生30~50(含30和50)之间的随机整数的表达式是
以下叙述中正确的是
产生100以内(不含100)2位随机整数的VisualBasic表达式是
随机试题
阅读下面这篇短文,回答问题。答司马谏议书王安石某启:昨日蒙教,窃以为与君实游处相好之日久,而议事每不合,
A.肩外侧疼痛,并向肘部、前臂及手指放射,肩功能正常B.肩外侧面疼痛,串至三角肌止端,上臂外展外旋运动时疼痛加剧,肩峰下压痛明显C.肩关节疼痛,外旋时疼痛明显D.肩关节广泛性疼痛,肩部主、被动活动障碍E.肩外侧疼痛,肩关节外展60~120度时疼痛加
A.GPIaB.GPIcC.GPⅢaD.GPⅣE.GPV哪种血小板膜糖蛋白是凝血酶的受体
()是指财务预定目标,拟定出多种可行性方案,并从中选择最合理有效的行动方案的过程。
关于不可抗力的说法,下列正确的是( )。
(2015年)乙公司有个塔吊,甲和乙公司签订了代理合同,甲代理乙公司将该塔吊出售,甲的下列情况中属于滥用代理权的有()。
下列叙述不正确的是()。
现代化信息沟通的方式是()。
Betweenthelastapplicationseasonandthecurrentone,SwarthmoreCollege,aschoolnationallyrenownedforitsacademicrigor
Nexttimeyouenterausernameandpassword,thinkabouttherhythmofyourtyping.Notonlycanitbeusedtoidentifyyou,i
最新回复
(
0
)