首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
设在工程中有一个标准模块,并定义了如下类型: Type Stutype ino As Integer stmameAs String*20 strsexAs String*2 smark As Single
设在工程中有一个标准模块,并定义了如下类型: Type Stutype ino As Integer stmameAs String*20 strsexAs String*2 smark As Single
admin
2016-03-21
56
问题
设在工程中有一个标准模块,并定义了如下类型:
Type Stutype
ino As Integer
stmameAs String*20
strsexAs String*2
smark As Single
EndType
在窗体上画一个名为Commandl的命令按钮,要求当执行事件过程Commandl Click时,在C盘根目录下的随机文件Student.dat中写入一条记录。下列能够完成该操作的是( )。
选项
A、Sub Command 1_Click()
Dim student As Studtype
Dim record_no As Integer
record no=l
With student
ino=12:strname=“smith”:
strsex=“男”:smark=89
EndWith
Open“c:\Student.dat”For Input As#1 Len=
Len(Student)
Put#1.record no.Student
Close#1
End Sub
B、Sub Command 1 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 Random As#1 Len
=Len(Student)
Put#1,Record no,Student
Close#1
End Sub
C、Private Sub Commandt Click()
Dim StudentAs 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
D、Sub Commandl—Click()
Dim Student As Stutype
Dim Record——no As Integer
Record—no=1
With Student
.ino=12:.strname=“smith”
.strsex=“男”:.smark=89
EndWith
Open“c:\student.dat”For Output As#1 Len=
Len(Student)
Put#1,Recor
答案
B
解析
本题考查文件操作。题目中要求以随机的方式(Random)打开一个文件,打开文件的方法格式为:0pen File NameForRandomAs#文件号[Len=记录长度],然后以Put方法写入一条记录,方法的格式为:Put[#]文件号,[记录号],变量名。
转载请注明原文地址:https://www.kaotiyun.com/show/egLp777K
本试题收录于:
二级VB题库NCRE全国计算机二级分类
0
二级VB
NCRE全国计算机二级
相关试题推荐
结构化程序设计的核心和基础是()。
以下程序用于计算“1+1/3+1/5+…+1/(2n+1)”,直至“1/(2n+1)”小于10-4。阅读下面程序,请在【】和【】处填上正确内容。PrivateSubCommand1_Click()Sum=h:n=idon=【
假定有如下的窗体事件过程:PrivateSubForm_Click()a$="MicrosoftVisualBasic"b$=Right(a$,5)c$=Mid(a$,1,9)MsgBoxa$,34,b$,c
数据独立性是数据库技术的重要特点之一。所谓数据独立性是指()。
有如下程序:PrivateSubCommand1_Click()a$="AWORKERISHERE"x=Len(a$)Fori=1Tox-1b$=Mid$(a$,i,3)Ifb$="WOR"ThenS
定义有5个整数型元素的数组,正确的语句是
实体完整性约束要求关系数据库中元组的属性值不能为空。
表达式(3/2+1)*(5/2+2)的值是
产生[10,27]之间的随机整数的VisualBasic表达式是
如果x是一个正的实数,将千分位四舍五入,保留两位小数的表达式是()。
随机试题
Asweexpect,thenewlybuiltamusementparkhas________alotofyoungpeople.
新生儿败血症出生后感染的主要途径是
吴某,男,18岁。受凉3天后出现壮热,喘咳上气,痰黄黏稠,口渴喜冷饮。舌红,苔黄,脉数。PE:面红唇绀,鼻翼煽动,双肺底听诊有湿性啰音。血常规:白细胞12×109/L,宜诊断
水污染防治控制区为特殊控制区的水域功能分类有()。
累积带薪缺勤应当在职工提供了服务从而增加了其未来享有的带薪缺勤权利时,确认与累积带薪缺勤相关的职工薪酬,并以累积未行使权利而增加的预期支付金额计量。()
某宾馆位于市区,2009年6月经营业务如下:(1)客房收入1000万元。(2)餐饮收入400万元。(3)所属车队取得客运收入200万元,支付燃油等费用30万元。(4)夜总会收入100万元(其中门票费20万元,点歌费15万元,
某项工程8个人用35天完成了全工程量的1/3,如果再增加6个人,那么完成剩余的工程还需要的天数是()。
Asitturnedouttobeasmallhouseparty,we______soformally.(北京大学2008年试题)
Itisthenaturalandperhapsunderstandabletendencyofnewspaperstoconcentrateonbadnewsandbydoingsotocontributeto
Isn’tItTimetoRighttheWrong?—ByTomSeligsonInt
最新回复
(
0
)