首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
设在工程中有一个标准模块,并定义了如下类型: 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
2019-06-11
65
问题
设在工程中有一个标准模块,并定义了如下类型:
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
Dimrecord_no As Integer
record_no=1
With student
.ino=12:.stmame="smith":
.strsex="男":.smark=89
End With
Open"c:\Studont.dat"For Input As #1 Len
=Len(Student)
Put #1,record_no Student
Close#1
End Sub
B、Sub Command 1_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 Random As#1
Len=Len(Student)
Put#1,Record_no,Student
Close #1
End Sub
C、Private Sub Command 1_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 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
EndWith
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/gyUp777K
本试题收录于:
二级VB题库NCRE全国计算机二级分类
0
二级VB
NCRE全国计算机二级
相关试题推荐
下列叙述中正确的是
窗体上有一个名称为Timer1的计时器控件,一个名称为Shape1的形状控件,其Shape属性值为3(Circle)。编写程序如下:PrivateSubForm_Load()PrivateSubTimer1_Timer()Shape1.qbp
在窗体上画一个命令按钮,然后编写如下程序:Subinc(aAsInteger)PrivateSubCommand1_Click()StaticxAsIntegerinc2:inc3:inc4x=x+aPrintx;E
下面变量定义中错误的是
似定有如下的程序段:DimintVarAsIntegerintvar=TruePrintintVar则输出结果是
已知二叉树后序遍历序列是CDABE,中序遍历序列是CADEB,它的前序遍历序列是()。
表达式12/2\4的值是
产生100以内(不含100)2位随机整数的VisualBasic表达式是
随机试题
在Windows中,文件的属性有()。
A.血管紧张素转换酶抑制剂B.钙通道阻滞剂C.β受体阻滞剂D.噻嗪类利尿剂(2013年第140题)变异型心绞痛并发高血压患者禁用的药物是
症见身目发黄,黄色鲜明,上腹、右胁胀闷疼痛,牵引肩背,身热不退,或寒热往来。口苦,咽干,呕吐呃逆,尿黄赤,大便秘,苔黄舌红,脉弦滑数,辨证为
A、夜尿宁丸B、健儿清解液C、小儿化滞散D、导赤丸E、龙牡壮骨颗粒属于小儿泄泻类药的是
下列关于工资数据录入的表述,不正确的是()。
融资租入的固定资产均应按租赁期与固定资产尚可使用年限两者中较短的期间计提折旧。()
【2014年威海市】简述德育过程的基本规律。
世界上从来没有抽象的法治。在这样的意义上,每一个判例,都是公众法治信仰的_______;而每一次失误,都可能导致信仰的_______。填入画横线部分最恰当的一项是:
OurculturehascausedmostAmericanstoassumenotonlythatourlanguageisuniversalbutthatthegesturesweuseareunderst
WhichofthefollowingstatementsisINCORRECT?
最新回复
(
0
)