首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
设在工程中有一个标准模块,并定义了如下类型: 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
84
问题
设在工程中有一个标准模块,并定义了如下类型:
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全国计算机二级
相关试题推荐
软件设计中划分模块的一个准则是
有下面程序代码:PrivateSubCommand1_Click()a=3s=0Fork=1To5s=s+aModka=a+kNextkPrintsEndSub程序运行后,单击命令按钮Command1,输出结果是(
编写如下程序:PrivateSubCommandlCliek()Dim.str1AsString,str2AsStringstr1=InputBox(“输入一个字符串”):subfstr1,str2:Printstr2
下列选项中不属于结构化程序设计方法的是
下面对类-对象主要特征描述正确的是
在面向对象的程序设计中,可被对象识别的动作称为
表达式2*3^2+4*2/2+3^2的值是
下列对队列的描述中正确的是
通常软件测试实施的步骤是()。
下面不属于软件测试实施步骤的是
随机试题
设A、B为随机事件,已知P(A)=0.7,P(B)=0.5,P(A-B)=0.3,则P(AB)=________.
A.3~6个月B.1~2岁C.4~6岁D.9~11岁E.16岁以后正颌外科矫治颌骨畸形的时间为()
肠外营养的适应证是()
甲、乙两公司签订协议,约定甲公司向乙公司采购面包券。双方交割完毕,面包券上载明“不记名、不挂失,凭券提货”。甲公司将面包券转让给张某,后张某因未付款等原因被判处合同诈骗罪。面包券全部流入市场。关于协议和面包券的法律性质,下列哪一表述是正确的?(2015年卷
属于项目组织实施方案分析的是()
财政政策的宏观经济目标包括()等。
光盘是外存储器的一种。()
小华在搜索某地点的时候用的是比例尺为1:1000的电子地图,为了更详细地了解该地点附近的商场等设施,他将地图放大到原来的200%,则此时的地图相当于比例尺为多少的地图?()
TheresultoftheincreasingcostsinnaturaldisastersisThepurposeofinsurancecompaniestosupportdisasterpredictionre
SoonafterstartinghisjobassuperintendentoftheMemphis,Tenn.,publicschools,KrinerCashorderedanassessmentofhisne
最新回复
(
0
)