首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
设在工程中有一个标准模块,并定义了如下类型: 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
60
问题
设在工程中有一个标准模块,并定义了如下类型:
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://www.kaotiyun.com/show/RmHp777K
本试题收录于:
二级VB题库NCRE全国计算机二级分类
0
二级VB
NCRE全国计算机二级
相关试题推荐
设有如下通用过程:PublicFunctionf(xAsInteger) DimyAsInteger x=20 y=2 f=x*yEndFunction在窗体上画一个命令按钮,其名称为Command1,然后编写如下
下列程序的执行结果为()。A=“5”:B=“6”A=Val(A)+Val(B)B=VaI(“56”)IfA◇BThenPrintA-BElsePrintB.A
下面正确使用动态数组的是()。
设:a=2,b=8,c=6,d=3,表达式a>bAndNot(c>d)Ord>c的值是
现有程序如下:OptionBase1PrivateSubForm_Click() Dimx(5,6)AsInteger,y(5)AsInteger Fori=1To5 Forj=1To6 x(i
下面说法中错误的是()。
下列打开“代码窗口”的操作中错误的是
有下面的函数过程:PrivateFunctionfun(strAsString,chAsString)AsIntegern=0Fork=1ToLen(str)IfMid(str,k
假定在图片框Picturel中装入了一个图片,在程序运行中,为了清除该图片(注意,清除图片,而不是删除图片框),应采用的正确方法是
以下不能设置Picture属性的控件是
随机试题
A.肾盂B.肾间质C.肾小球D.肾皮质上行性感染引起的肾盂肾炎首先累及
乙醇在片剂制备中可作为哪种辅料
传染性非典型肺炎的氧疗指征是
空头支票
人民法院保全与会员资格相应的会员资格费或交易席位,应当依法裁定()。
下列关于客户资产保护的表述,错误的是()。
A、 B、 C、 D、 A
执行下段程序后 MOV CX, 5 MOV AX, 50 LPl: SUB AX, CX LOOP LPl HLT AX=( )。
有以下程序: #include<stdio.h> structtt{intx;structtt*y;}*p; structtta[4]={20,a+1,15,a+2,30,a+3,17,a}; main() { inti;
Solar-generatedelectricitydocsnotcarrythehealthorenvironmentalrisksofnuclearenergy.Wecanneverrunoutofsolaren
最新回复
(
0
)