首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
设在工程中有一个标准模块,并定义了如下类型: 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
93
问题
设在工程中有一个标准模块,并定义了如下类型:
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全国计算机二级
相关试题推荐
某人编写了如下程序,用来求10个整数(整数从键盘输入)中的最大值:PrivateSubCommand1_Click() Dima(10)AsInteger,maxAsInteger Fork=1To10 a(k)=In
数据字典(DD)所定义的对象都包含于
下列关于通用对话框CommonDialog1的叙述中,错误的是( )。
以下能正确定义数据类型Systemlnfo的代码是()。
下列数据结构中,能用二分法进行查找的是()。
在窗体上画一个名称为Command1的命令按钮,然后编写如下程序:OptionBase1PrivateSubCommand1_Click() d=0 c=10 x=Array(10,12,21,32,24) Fori=
在考生文件夹下有一个工程文件sjt5.vbp,已给出了所有控件(如图3.62所示)和部分程序。程序运行时,请按以下顺序操作:1)单击“读入文件”按钮,把考生目录下的文件in5.dat中的内容读入内存并显示在上面的文本框(Text1)中;2)单击“加密”
假定在标准模块中的声明部分有如下语句:PublicVarAAsInteger而在窗体模块的声明部分有如下语句:PublicVarBAsInteger则以下叙述中正确的是
有如下过程代码:Subvar_dim()StaticnumaAsIntegerDimnumbAsIntegernuma=numa+2numb=numb+1printnuma
设树T的深度为4,其中度为1,2,3,4的结点个数分别为4,2,1,1。则T中的叶子结点数为
随机试题
为了尽量减少偏倚,在进行病因研究时,病例对照研究中最为理想的病例是()。
足月新生儿,第一胎,男,母乳喂养,生后24小时出现黄疸。检查:Hb110g/L,母血型O,子血型B。患儿出现嗜睡、尖叫、肌张力下降,胆红素上升,该患儿可能发生了
排除掉交易行为中的一些特殊因素所造成的交易价格偏差的修正方法称为()。
泥水平衡式盾构排土体积Q3=Q2-Q1(Q1为送泥流量,Q2是排泥流量),若Q为单位掘进循环开挖土量理论计算值,以下关于泥水平衡式盾构排土量控制的判断,说法错误的是()。
()是按一定的应用条件,将干粉储存装置和喷头等部件预先组装起来的成套灭火装置。
1905年摄制的(),标志着中国电影的诞生。
学校教育是一种非制度化的教育,在现代教育体系中,学校教育形态是教育的主体形态。()
设f(x)一阶连续可导,且f(0)=0,f’(0)≠0,则=____________.
"Doyoumind______?""Goahead.Idon’tmind."
A、Gotoameetingforthehandicapped.B、Designauniformforthemeeting.C、Dosomecharityinthemeeting.D、Lookforajobin
最新回复
(
0
)