首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
设在工程中有一个标准模块,并定义了如下类型: Type Stutype ino As Integer stmame As String*20 strsex As String*2 smark As Single
设在工程中有一个标准模块,并定义了如下类型: Type Stutype ino As Integer stmame As String*20 strsex As String*2 smark As Single
admin
2020-07-22
65
问题
设在工程中有一个标准模块,并定义了如下类型:
Type Stutype
ino As Integer
stmame 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:.stmame="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 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 RandomAs As#1
Len=Len(Student)
put#1,Record_no,Student
Close#1
End Sub
C、Private Sub Command1_Click()
DimStudent As 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#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:.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 FileNamn For Random As#文件号[Len=记录长度],然后以Put方法写入一条记录,方法的格式为:Put[#]文件号,[记录号],变量名。
转载请注明原文地址:https://kaotiyun.com/show/0fHp777K
本试题收录于:
二级VB题库NCRE全国计算机二级分类
0
二级VB
NCRE全国计算机二级
相关试题推荐
有如下函数过程:Functionrl(xAsInteger)AsLongDimSAsLong,iAsIntegerS=0Fori=1Toxs=s+iNextif
下列事件的事件过程中,参数是输入字符ASCII码的是( )。
下列表达式的值为2123的是()。
以下能正确定义数据类型Systemlnfo的代码是()。
一棵二叉树中共有80个叶子结点与70个度为1的结点,则该二叉树中的总结点数为
以下能从字符串“VisualBasic”中直接取出子字符串“Basic”的函数是()。
假定有以下两个过程:SubS1(ByValxAsInterger,ByValyAsInterger)DimtAsIntergert=x:x=y:y=tEndSubSubS2(xAsInterger,yAsInter
下列关于滚动条的叙述中,错误的是
在窗体上没有进行任何属性设置,然后编写如下事件过程,则程序运行结果是()。PrivateSubForm_Load()Fori=1To10sum=sum+iNex
在VisualBasic环境下设计应用程序时,系统能自动检查出的错误是
随机试题
女性,41岁,半小时前被车撞伤,诉剧烈胸痛,并有胸闷、呼吸困难、发绀。胸片:左侧第2~9肋多处骨折,右侧肋骨未见明显骨折征象。此患者发生呼吸衰竭的主要原因是
患者发热恶热,汗出,肢体困倦,小便短黄,舌红苔黄腻,脉细数,此属()
运算放大器应用电路如图所示,在运算放大器线性工作区,输出电压与输入电压之间的运算关系是:
项目经理应当履行()的职责。
甲企业只生产一种产品,单位变动成本6元,单价10元,固定成本16600元,若想实现7400元的利润,则应使销售量达到( )件。
万州太白岩有晋代道教绝迹“绝尘龛”,也是唐代诗人杜甫访道之处。()
有人说战争没有什么可写的,因为战争是丑的、破坏的。假如社会上的一切都可以作为文艺作品的材料,不知为何单单把战争除外;假如文艺含有奖善罚恶的目的,那么,__________。为什么不可以写呢?填入画横线部分最恰当的一项是()。
第一部称作以结构和功能相结合的原则编写的对外汉语教材是_____。
Itisanastonishingfactthattherearelawsofnature,rulesthatsummarizeconveniently(1)_____qualitativelybutquantitati
以下叙述中正确的是()。
最新回复
(
0
)