首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
设在工程中有一个标准模块,并定义了如下类型: 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
52
问题
设在工程中有一个标准模块,并定义了如下类型:
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全国计算机二级
相关试题推荐
假定有如下程序:PrivateSubForm_Click()Dima(4)AsInteger,b(4)AsIntegerFork=0To2a(k+1)=Val(InputBox("请
在窗体上有两个名称分别为Text1、Text2的文本框,一个名称为Command1的命令按钮。运行后的窗伪外观如图所示。设有如下的类型和变量声明:PrivateTypePersonnameAsString*8maj
假定已在窗体上画了多个控件,其中有一个被选中,为J了存属性窗口中设置窗体的属性,预先应执行的操作是()。
下面程序的执行结果是( )。PrivateSubCommand1_Click() a=0 k=1 DoWhilek
下列哪一条小属于数据库设计的任务?()
下列关于通用对话框CommonDialog1的叙述中,错误的是( )。
下列关于菜单项的描述中,错误的是
在E-R图中.用来表示属性的图形是()。
设工程文件中包名称分别为Form1、Form2的两个窗体,且Form1的菜单属性设置如下:窗体Form1中的程序如下:DimFlagAsBooleanPrivateSubForm_Load() Flag=TrueEndSubPr
在考生文件夹下有一个数据库文件“samp3.accdb”,其中存在已经设计好的表对象“tEmployee”和查询对象“qEmployee”,同时还设计出以“qEmployee”为数据源的报表对象“rEmployee”。请在此基础上按照以下要求补充报表设计。
随机试题
A.钨酸钙B.硫酸铅钡C.硫酸锌D.硫化锌镉E.硫氧化钇软组织摄影用屏的荧光体是
药品分类管理的目的是
使用减鼻充血药时应注意()。
为减少钢构发热,可采取的措施有()。
开户单位收入现金应于次日送存开户银行,送存确有困难的,由开户银行确定送存时间。()
以下属于“十三五”时期经济社会发展基本理念的有()。
()年山东省旅游总收入跃居全国第四位。
集成电路制造技术是嵌入式系统发展的重要基础,下面关于集成电路技术发展的叙述中,错误的是()。
对于下面定义的类MyClass,请在函数f()中添加对象成员把n的值修改为50。classMyClass{public:MyClass(intx){n=x;}voidSetNum(i
ホームページで食欲の秋を満喫しょう。自炊派なら、テレビの料理番組ヘアクセスすれば、玄人はだしの料理がてぎわよく出来上がる。満喫
最新回复
(
0
)