首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
设在工程中有一个标准模块,并定义了如下类型: 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
58
问题
设在工程中有一个标准模块,并定义了如下类型:
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全国计算机二级
相关试题推荐
窗体上有一个名称为Command1的命令按钮,有程序如下:OptionBase1PrivateSubCommand1_Click()Dima(10)AsInteger’第1个ForFori=1To1
要求如果x被7除余2,则输出x的值,下列语句中不能实现此功能的语句是( )。
下面描述中不属于数据库系统特点的是
要求在程序运行时,如果按住鼠标左键不放而移动鼠标,鼠标的位置坐标同步显示在窗体右上角的标签(名称为Label1)中,如右图所示,放开鼠标左键后,停止同步显示。下面可以实现此功能的程序是( )。
下面程序段中Print方法不能执行6次的是
以下程序执行后,在窗体上输出的图案是()。Form1.ClsFora=1To5PrintSpace(5-A);String(a,"*") Nexta
如果要将一个窗体从内存中清除,应使用的语句是
在考生文件夹下有一个工程文件sjt3.vbp,相应的窗体文件为sjt3.frm。其功能是随机产生30个0~1000的整数,将其放入一个数组中,然后输出其中的最大值。程序运行后,单击命令按钮(名称为Commandl,标题为“输出最大值”,如图所示),即可求出
以下不能用形状控件画出的图形是
窗体上有一个名称为Timer1的计时器控件,一个名称为Shapel的形状控件,其Shape属性值为3(Circle)。编写程序如下:PrivateSubForm_Load()Shape1.Top=0:Timer1.Interval=100
随机试题
牙嵌式快开盲板接触面泄漏的原因是O形圈损坏和密封面有污物,其处理方法是更换O形圈和清除密封面上的污物。()
地球上最耐旱,且由超旱生的灌木、半灌木或半乔木占优势的地上不郁闭的一类生物群落是()
IfonlyI_____howtooperateacomputerasyoudo.
图a)所示电路的激励电压如图b)所示,那么,从t=0时刻开始,电路出现暂态过程的次数和在换路时刻发生跳变的量分别是()。
乙级工程咨询单位所能承担()以及中小型项目的工程咨询业务。
品牌可以帮助消费者迅速找到所需要的产品,从而减少消费者在搜寻过程中花费的时间和精力。这体现了品牌的()功能。
小商品批发市场、水果集散中心这类经营体属于渠道中的()。
It’snosurprisethatJenniferSenior’sinsightful,provocativemagazinecoverstory,"IloveMyChildren,IHateMyLife",isa
下列程序段执行以后,内存变量X和Y的值是()。CLEARSTORE3TOXsTORE5TOYPLUS((X),Y)?X,YPROCEDUREPLUSPARAMETERSA1.A2A1=A1+A2
Startinginthemid-1990s,majorAmericancitiesbeganaradicaltransformation.Yearsofhighviolentcrimerates,thefts,ro
最新回复
(
0
)