首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
设在工程中有一个标准模块,并定义了如下类型: Type Stutype ino As Integer stmame As String*20 strsex As String*2 smarkAs Single End Type 在窗体上画一个名为Comma
设在工程中有一个标准模块,并定义了如下类型: Type Stutype ino As Integer stmame As String*20 strsex As String*2 smarkAs Single End Type 在窗体上画一个名为Comma
admin
2020-06-30
62
问题
设在工程中有一个标准模块,并定义了如下类型:
Type Stutype
ino As Integer
stmame As String*20
strsex As String*2
smarkAs Single
End Type
在窗体上画一个名为Commandl的命令按钮,要求当执行事件过程Commandl Click时,在C盘根目录下的随机文件Student.dat中写入一条记录。下列能够完成该操作的是( )。
选项
A、Sub Commandl_Click( )
Dim student As Studtype
Dim record_no As Integer
record_no=1
With student
.ino=12:.stmame=“smitll”:
.strsex=“男”:.smark=89
End With
Open”c:\Student.dat”ForInputAs#1 Len=
Len(Student)
Put#1,record_no,Student
Close#1
EndSub
B、Sub Commandl_click( )
Dim Student As Stutype
Dim Record_no As Integer
Record_no=1
With Student
.ino=12:.stmame=“smith”
.sffsex=“男”:.smark=89
End With
Open”c:\student.dat”For Random As#1 Len
=Len(Student)
Put#1,Record_no,Student
Close#1
EndSub
C、Private Sub Commandl_Click( )
Dim StudentAs Stutype
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 Commandl_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 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/RmHp777K
本试题收录于:
二级VB题库NCRE全国计算机二级分类
0
二级VB
NCRE全国计算机二级
相关试题推荐
设有如下通用过程:PublicFunctionf(xAsInteger) DimyAsInteger x=20 y=2 f=x*yEndFunction在窗体上画一个命令按钮,其名称为Command1,然后编写如下
程序运行后,单击命令按钮,文本框中显示的是( )。35.设有如下通用过程:PublicFunctionFun(xStrAsString)AsString DimtStrAsString,strLAsInteger tSt
要求在程序运行时,如果按住鼠标左键不放而移动鼠标,鼠标的位置坐标同步显示在窗体右上角的标签(名称为Label1)中,如右图所示,放开鼠标左键后,停止同步显示。下面可以实现此功能的程序是( )。
下列叙述中正确的是( )。
己知在4行3列的全局数组score(4,3)中存放了4个学生3门课程的考试成绩(均为整数)。现需要计算每个学生的总分,某人编写程序如下:OptionBase1PrivateSubCommand1Click()DimsumAsInteg
表达式Sgn(0.25)的值是
深度为5的完全二叉树的结点数不可能是()。
对长度为n的线性表排序,在最坏情况下,比较次数不是n(n-1)/2的排序方法是( )。
设数据集合为D={1,3,5,7,9},D上的关系为R,下列数据结构B=(D,R)中为非线性结构的是
随机试题
世行在华咨询服务需要提供国际和国内两方面的咨询服务,并以()为主。
《会计法》所指的会计主管人员就是通常所说的负责某个会计岗位的会计主办人员。()
申请境外直接上市企业筹资额不少于()。
下列不属于货币市场基金的申购和赎回原则的是()。
()是进行投资组合管理的基础。
主要以国家机构、国有企业和国有控股公司等公有制单位为资金募集对象的证券称为公募证券。( )
中央银行在市场中向商业银行大量卖出证券,从而减少商业银行超额存款准备金,引起货币供应量减少、市场利率上升,中央银行动用的货币政策工具是( )。
JackMaplestartedhiscareerin______.AccordingtoJackMaple,tocutcrime______.
Whileit’seasyenoughtobrushoffafewsleeplessnightswithapotofcoffeeandtheoccasionaldesknap,youmaybedoingmo
A、Theyinvitedhimtoaparty.B、Theyaskedhimtomakeaspeech.C、Theygaveaspecialdinnerforhim.D、Theyinvitedhiswife
最新回复
(
0
)